org.joda.time.DateTimeUtils.MillisProvider Java Examples
The following examples show how to use
org.joda.time.DateTimeUtils.MillisProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestDateTimeUtils.java From astor with GNU General Public License v2.0 | 6 votes |
public void testMillisProviderSecurity() { if (OLD_JDK) { return; } try { try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); DateTimeUtils.setCurrentMillisProvider(new MillisProvider() { public long getMillis() { return 0L; } }); fail(); } catch (SecurityException ex) { // ok } finally { System.setSecurityManager(null); Policy.setPolicy(ALLOW); } } finally { DateTimeUtils.setCurrentMillisSystem(); } }
Example #2
Source File: TestDateTimeUtils.java From astor with GNU General Public License v2.0 | 6 votes |
public void testMillisProviderSecurity() { if (OLD_JDK) { return; } try { try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); DateTimeUtils.setCurrentMillisProvider(new MillisProvider() { public long getMillis() { return 0L; } }); fail(); } catch (SecurityException ex) { // ok } finally { System.setSecurityManager(null); Policy.setPolicy(ALLOW); } } finally { DateTimeUtils.setCurrentMillisSystem(); } }
Example #3
Source File: DataflowExecutionStateTrackerTest.java From beam with Apache License 2.0 | 5 votes |
@Before public void setUp() { options = PipelineOptionsFactory.create(); clock = mock(MillisProvider.class); sampler = ExecutionStateSampler.newForTest(clock); counterSet = new CounterSet(); }
Example #4
Source File: TestDateTimeUtils.java From astor with GNU General Public License v2.0 | 5 votes |
public void testMillisProvider() { try { DateTimeUtils.setCurrentMillisProvider(new MillisProvider() { public long getMillis() { return 1L; } }); assertEquals(1L, DateTimeUtils.currentTimeMillis()); } finally { DateTimeUtils.setCurrentMillisSystem(); } }
Example #5
Source File: TestDateTimeUtils.java From astor with GNU General Public License v2.0 | 5 votes |
public void testMillisProvider() { try { DateTimeUtils.setCurrentMillisProvider(new MillisProvider() { public long getMillis() { return 1L; } }); assertEquals(1L, DateTimeUtils.currentTimeMillis()); } finally { DateTimeUtils.setCurrentMillisSystem(); } }
Example #6
Source File: ExecutionStateSampler.java From beam with Apache License 2.0 | 4 votes |
private ExecutionStateSampler(MillisProvider clock) { this.clock = clock; }
Example #7
Source File: ExecutionStateSampler.java From beam with Apache License 2.0 | 4 votes |
@VisibleForTesting public static ExecutionStateSampler newForTest(MillisProvider clock) { return new ExecutionStateSampler(checkNotNull(clock)); }
Example #8
Source File: ExecutionStateTrackerTest.java From beam with Apache License 2.0 | 4 votes |
@Before public void setUp() { clock = mock(MillisProvider.class); sampler = ExecutionStateSampler.newForTest(clock); }
Example #9
Source File: ExecutionStateSamplerTest.java From beam with Apache License 2.0 | 4 votes |
@Before public void setUp() { clock = mock(MillisProvider.class); sampler = ExecutionStateSampler.newForTest(clock); }