?? profiletest.java
字號:
assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testProfileSuper() { File h = new File(HOME, getClass().getName() + ".testProfileSuper"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), Profile.SUPER) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testProfileDefault() { File h = new File(HOME, getClass().getName() + ".testProfileDefault"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), Profile.DEFAULT) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testAdhocPrivate() { File h = new File(HOME, getClass().getName() + ".testAdhocPrivate"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_ADHOC_PRIVATE))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); assertTrue(exists(new File(h, Env.CONFIG_PROPERTIES))); } public void testEdgeNatAnyAll() { File h = new File(HOME, getClass().getName() + ".testEdgeNatAnyAll"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NAT_ANYALL))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeNat() { File h = new File(HOME, getClass().getName() + ".testEdgeNat"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NAT))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeNoRelayNat() { File h = new File(HOME, getClass().getName() + ".testEdgeNoRelayNat"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NO_RELAY_NAT))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeNoRelayPrivate() { File h = new File(HOME, getClass().getName() + ".testEdgeNoRelayPrivate"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NO_RELAY_PRIVATE))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); assertTrue(exists(new File(h, Env.CONFIG_PROPERTIES))); } public void testEdgeNoRelay() { File h = new File(HOME, getClass().getName() + ".testEdgeNoRelay"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NO_RELAY))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgePrivate() { File h = new File(HOME, getClass().getName() + ".testEdgePrivate"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_PRIVATE))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); assertTrue(exists(new File(h, Env.CONFIG_PROPERTIES))); } public void testLocalPrivate() { File h = new File(HOME, getClass().getName() + ".testLocalPrivate"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_LOCAL_PRIVATE))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); assertTrue(exists(new File(h, Env.CONFIG_PROPERTIES))); } public void testSuperNat() { File h = new File(HOME, getClass().getName() + ".testSuperNat"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_SUPER_NAT))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testSuperPrivate() { File h = new File(HOME, getClass().getName() + ".testSuperPrivate"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_SUPER_PRIVATE))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); assertTrue(exists(new File(h, Env.CONFIG_PROPERTIES))); } public void testEdgeMulticast() { File h = new File(HOME, getClass().getName() + ".testEdgeMulticast"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_MULTICAST))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeNoMulticast() { File h = new File(HOME, getClass().getName() + ".testEdgeNoMulticast"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_NO_MULTICAST))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeMulticastDisabled() { File h = new File(HOME, getClass().getName() + ".testEdgeMulticastDisabled"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_MULTICAST_DISABLED))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testEdgeMulticastUnspecifiedAddress() { File h = new File(HOME, getClass().getName() + ".testEdgeMulticastUnspecifiedAddress"); AbstractConfigurator ac = new AbstractConfigurator(h.toURI(), new Profile(getClass().getResource(PROFILE_EDGE_MULTICAST_UNSPECIFIED_ADDRESS))) { public PlatformConfig createPlatformConfig(Configurator c) throws ConfiguratorException { return c.getPlatformConfig(); } }; try { ac.save(); } catch (ConfiguratorException ce) { fail("AbstractConfigurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testDefaultSave() { File h = new File(HOME, getClass().getName() + ".testDefaultSave"); h.mkdirs(); try { new Configurator().save(h); } catch (ConfiguratorException ce) { fail("Configurator.save() exception: " + ce.getMessage()); } assertTrue(exists(new File(h, Env.PLATFORM_CONFIG))); } public void testWhiteSpaceSave() { File f = new File(HOME, getClass().getName() + ".testWhiteSpace" + File.separator + Env.PLATFORM_CONFIG + ".test"); try { new Configurator().save(f); } catch (ConfiguratorException ce) { fail("Configurator.save() exception: " + ce.getMessage()); } assertTrue(exists(f)); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -