@Test public void testDynamicPolicy() throws PEException { final DVEClientToolTestConsole console = new DVEClientToolTestConsole(new DVEConfigCLI(null)); String uPolicy = PEFileUtils.getCanonicalResourcePath(this.getClass(), "policy1.xml"); console.executeInteractiveCommand("delete catalog", "y"); console.executeCommand("setup localhost catalog 5 5"); console.executeCommand("add policy '" + uPolicy + "'"); CatalogDAO c = CatalogDAOFactory.newInstance(); List<DynamicPolicy> policies = c.findAllDynamicPolicies(); assertTrue("Should have 2 dynamic policies but have " + policies.size(), policies.size() == 2); DynamicPolicy policy = c.findDynamicPolicy(DEFAULT_POLICY, false); assertTrue("Policy " + DEFAULT_POLICY + " should exist", policy != null); policy = c.findDynamicPolicy(TEST_POLICY, false); assertTrue("Policy " + TEST_POLICY + " should exist", policy != null); Provider provider = verifyProvider(c, TEST_PROVIDER, 1); DynamicPolicy matchPolicy = new DynamicPolicy(TEST_POLICY, true, provider.getName(), "none", 1, provider.getName(), "none", 1, provider.getName(), "none", 2, provider.getName(), "none", 3); verifyPolicy(policy, matchPolicy); c.close(); console.executeCommand("set default policy " + TEST_POLICY); c = CatalogDAOFactory.newInstance(); String defaultPolicyName = KnownVariables.DYNAMIC_POLICY.lookupPersistentConfig(c).getValue(); policy = c.findDynamicPolicy(defaultPolicyName); assertEquals(defaultPolicyName, TEST_POLICY); c.close(); uPolicy = PEFileUtils.getCanonicalResourcePath(this.getClass(), "policy1b.xml"); console.executeCommand("configure policy '" + uPolicy + "'"); c = CatalogDAOFactory.newInstance(); policies = c.findAllDynamicPolicies(); assertTrue("Should have 2 dynamic policies but have " + policies.size(), policies.size() == 2); policy = c.findDynamicPolicy(TEST_POLICY, false); assertTrue("Policy " + TEST_POLICY + " should exist", policy != null); matchPolicy = new DynamicPolicy(TEST_POLICY, false, "AnotherProvider", "test", 1, "AnotherProvider", "test", 2, "YetAnotherProvider", null, 3, "YetAnotherProvider", null, 5); verifyPolicy(policy, matchPolicy); c.close(); console.close(); console.assertValidConsoleOutput(); }
@Override public void close() { if (catHelper != null) { catHelper.close(); catHelper = null; } super.close(); }
DVEConfigCLI extends CLIBuilder { @Override public void close() { if (catHelper != null) { catHelper.close(); catHelper = null; } super.close(); } }
DVEConfigCLI extends CLIBuilder { @Override public void close() { if (catHelper != null) { catHelper.close(); catHelper = null; } super.close(); } DVEConfigCLI(String[] args); }
DVEConfigCLI extends CLIBuilder { @Override public void close() { if (catHelper != null) { catHelper.close(); catHelper = null; } super.close(); } DVEConfigCLI(String[] args); @Override void close(); void cmd_dump(Scanner scanner); void cmd_locate_catalog(Scanner scanner); void cmd_encrypt(Scanner scanner); void cmd_delete_catalog(); void cmd_set_root_user(Scanner scanner); void cmd_setup_localhost_catalog(Scanner scanner); void cmd_setup_catalog(Scanner scanner); void cmd_set_default_pg(Scanner scanner); void cmd_show_pg(Scanner scanner); void cmd_add_provider(Scanner scanner); void cmd_configure_provider(Scanner scanner); void cmd_show_provider(Scanner scanner); void cmd_remove_provider(Scanner scanner); void cmd_add_policy(Scanner scanner); void cmd_configure_policy(Scanner scanner); void cmd_show_policy(Scanner scanner); void cmd_set_default_policy(Scanner scanner); void cmd_set_groupService(Scanner scanner); @SuppressWarnings("unused") void cmd_show_variables(Scanner scanner); void cmd_set_variable(Scanner scanner); void cmd_add_es(Scanner scanner); void cmd_configure_es(Scanner scanner); void cmd_show_es(Scanner scanner); void cmd_remove_es(Scanner scanner); void cmd_upgrade_catalog(); void cmd_check_catalog_version(); void cmd_truncate_servers(); void cmd_action_list(); void cmd_action_report(Scanner scanner); void cmd_action_run(Scanner scanner); void cmd_connect(Scanner scanner); void cmd_disconnect(); void cmd_add_template(Scanner scanner); void cmd_add_templates(Scanner scanner); void cmd_update_template(Scanner scanner); void cmd_update_templates(Scanner scanner); void registerJMXCommands(); void cmd_jmx_connect(Scanner scanner); void cmd_jmx_disconnect(); void cmd_jmx_list_domains(); void cmd_jmx_domain(Scanner scanner); void cmd_jmx_list_mbeans(); void cmd_jmx_mbean(Scanner scanner); void cmd_jmx_get_attribute(Scanner scanner); void cmd_jmx_get_attributes(); void cmd_jmx_list_operations(); void cmd_jmx_invoke(Scanner scanner); static void main(String[] args); }
DVEConfigCLI extends CLIBuilder { @Override public void close() { if (catHelper != null) { catHelper.close(); catHelper = null; } super.close(); } DVEConfigCLI(String[] args); @Override void close(); void cmd_dump(Scanner scanner); void cmd_locate_catalog(Scanner scanner); void cmd_encrypt(Scanner scanner); void cmd_delete_catalog(); void cmd_set_root_user(Scanner scanner); void cmd_setup_localhost_catalog(Scanner scanner); void cmd_setup_catalog(Scanner scanner); void cmd_set_default_pg(Scanner scanner); void cmd_show_pg(Scanner scanner); void cmd_add_provider(Scanner scanner); void cmd_configure_provider(Scanner scanner); void cmd_show_provider(Scanner scanner); void cmd_remove_provider(Scanner scanner); void cmd_add_policy(Scanner scanner); void cmd_configure_policy(Scanner scanner); void cmd_show_policy(Scanner scanner); void cmd_set_default_policy(Scanner scanner); void cmd_set_groupService(Scanner scanner); @SuppressWarnings("unused") void cmd_show_variables(Scanner scanner); void cmd_set_variable(Scanner scanner); void cmd_add_es(Scanner scanner); void cmd_configure_es(Scanner scanner); void cmd_show_es(Scanner scanner); void cmd_remove_es(Scanner scanner); void cmd_upgrade_catalog(); void cmd_check_catalog_version(); void cmd_truncate_servers(); void cmd_action_list(); void cmd_action_report(Scanner scanner); void cmd_action_run(Scanner scanner); void cmd_connect(Scanner scanner); void cmd_disconnect(); void cmd_add_template(Scanner scanner); void cmd_add_templates(Scanner scanner); void cmd_update_template(Scanner scanner); void cmd_update_templates(Scanner scanner); void registerJMXCommands(); void cmd_jmx_connect(Scanner scanner); void cmd_jmx_disconnect(); void cmd_jmx_list_domains(); void cmd_jmx_domain(Scanner scanner); void cmd_jmx_list_mbeans(); void cmd_jmx_mbean(Scanner scanner); void cmd_jmx_get_attribute(Scanner scanner); void cmd_jmx_get_attributes(); void cmd_jmx_list_operations(); void cmd_jmx_invoke(Scanner scanner); static void main(String[] args);  }