Java Code Examples for java.time.zone.ZoneRulesProvider#registerProvider()

The following examples show how to use java.time.zone.ZoneRulesProvider#registerProvider() . 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: TCKZoneRulesProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 2
Source File: TCKZoneRulesProvider.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 3
Source File: TCKZoneRulesProvider.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 4
Source File: TCKZoneRulesProvider.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 5
Source File: TCKZoneRulesProvider.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 6
Source File: TCKZoneRulesProvider.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 7
Source File: TCKZoneRulesProvider.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 8
Source File: TCKZoneRulesProvider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 9
Source File: TCKZoneRulesProvider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 10
Source File: TCKZoneRulesProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 11
Source File: TCKZoneRulesProvider.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 12
Source File: TCKZoneRulesProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 13
Source File: TCKZoneRulesProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 14
Source File: TCKZoneRulesProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 15
Source File: TCKZoneRulesProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 16
Source File: TCKZoneRulesProvider.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 17
Source File: TCKZoneRulesProvider.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 18
Source File: TCKZoneRulesProvider.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}
 
Example 19
Source File: TCKZoneRulesProvider.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_getRules_StringBoolean_dynamic() {
    MockDynamicProvider dynamicProvider = new MockDynamicProvider();
    ZoneRulesProvider.registerProvider(dynamicProvider);

    assertEquals(dynamicProvider.count, 0);
    ZoneRules rules1 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 2);
    assertEquals(rules1, dynamicProvider.BASE);
    ZoneRules rules2 = ZoneId.of("DynamicLocation").getRules();
    assertEquals(dynamicProvider.count, 4);
    assertEquals(rules2, dynamicProvider.ALTERNATE);
}
 
Example 20
Source File: TCKZoneRulesProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test_registerProvider() {
    Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(pre.contains("FooLocation"), false);
    ZoneRulesProvider.registerProvider(new MockTempProvider());
    assertEquals(pre.contains("FooLocation"), false);
    Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
    assertEquals(post.contains("FooLocation"), true);
    assertEquals(ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
}