Java Code Examples for org.apache.brooklyn.core.internal.BrooklynProperties#remove()
The following examples show how to use
org.apache.brooklyn.core.internal.BrooklynProperties#remove() .
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: RubyRepRackspaceLiveTest.java From brooklyn-library with Apache License 2.0 | 6 votes |
public void test(String osRegex) throws Exception { PostgreSqlNode db1 = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class) .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT) .configure(PostgreSqlNode.POSTGRESQL_PORT, PortRanges.fromInteger(9111))); PostgreSqlNode db2 = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class) .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT) .configure(PostgreSqlNode.POSTGRESQL_PORT, PortRanges.fromInteger(9111))); BrooklynProperties brooklynProperties = mgmt.getBrooklynProperties(); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageNameRegex", osRegex); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.image-id"); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageId"); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.inboundPorts", Arrays.asList(22, 9111)); Location loc = mgmt.getLocationRegistry().getLocationManaged("jclouds:rackspace-cloudservers-uk"); startInLocation(app, db1, db2, loc); //hack to get the port for mysql open; is the inbounds property not respected on rackspace?? for (DatastoreCommon node : ImmutableSet.of(db1, db2)) { SshMachineLocation l = (SshMachineLocation) node.getLocations().iterator().next(); l.execCommands("add iptables rule", ImmutableList.of(IptablesCommands.insertIptablesRule(Chain.INPUT, Protocol.TCP, 9111, Policy.ACCEPT))); } testReplication(db1, db2); }
Example 2
Source File: MySqlLiveRackspaceTest.java From brooklyn-library with Apache License 2.0 | 6 votes |
public void test(String osRegex) throws Exception { MySqlNode mysql = app.createAndManageChild(EntitySpec.create(MySqlNode.class) .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT) .configure("test.table.name", "COMMENTS")); BrooklynProperties brooklynProperties = mgmt.getBrooklynProperties(); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageNameRegex", osRegex); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.image-id"); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageId"); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.inboundPorts", Arrays.asList(22, 3306)); JcloudsLocation jcloudsLocation = (JcloudsLocation) mgmt.getLocationRegistry().getLocationManaged("jclouds:rackspace-cloudservers-uk"); app.start(ImmutableList.of(jcloudsLocation)); SshMachineLocation l = (SshMachineLocation) mysql.getLocations().iterator().next(); l.execCommands("add iptables rule", ImmutableList.of(IptablesCommands.insertIptablesRule(Chain.INPUT, Protocol.TCP, 3306, Policy.ACCEPT))); new VogellaExampleAccess("com.mysql.jdbc.Driver", mysql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase(); }
Example 3
Source File: MariaDbLiveRackspaceTest.java From brooklyn-library with Apache License 2.0 | 6 votes |
public void test(String osRegex) throws Exception { MariaDbNode mariadb = app.createAndManageChild(EntitySpec.create(MariaDbNode.class) .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT)); BrooklynProperties brooklynProperties = mgmt.getBrooklynProperties(); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageNameRegex", osRegex); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.image-id"); brooklynProperties.remove("brooklyn.location.jclouds.rackspace-cloudservers-uk.imageId"); brooklynProperties.put("brooklyn.location.jclouds.rackspace-cloudservers-uk.inboundPorts", Arrays.asList(22, 3306)); JcloudsLocation jcloudsLocation = (JcloudsLocation) mgmt.getLocationRegistry().getLocationManaged("jclouds:rackspace-cloudservers-uk"); app.start(ImmutableList.of(jcloudsLocation)); SshMachineLocation l = (SshMachineLocation) mariadb.getLocations().iterator().next(); l.execCommands("add iptables rule", ImmutableList.of(IptablesCommands.insertIptablesRule(Chain.INPUT, Protocol.TCP, 3306, Policy.ACCEPT))); new VogellaExampleAccess("com.mysql.jdbc.Driver", mariadb.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase(); }
Example 4
Source File: AbstractJcloudsLiveTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
public static void stripBrooklynProperties(BrooklynProperties props) { // remove all location properties except for identity and credential // (so key, scripts, etc settings don't interfere with tests) for (String key : ImmutableSet.copyOf(props.asMapWithStringKeys().keySet())) { if (key.startsWith(BROOKLYN_PROPERTIES_PREFIX) && !(key.endsWith("identity") || key.endsWith("credential"))) { props.remove(key); } if (key.startsWith(BROOKLYN_PROPERTIES_LEGACY_PREFIX) && !(key.endsWith("identity") || key.endsWith("credential"))) { props.remove(key); } // Also removes scriptHeader (e.g. if doing `. ~/.bashrc` and `. ~/.profile`, then that can cause "stdin: is not a tty") if (key.startsWith("brooklyn.ssh")) { props.remove(key); } } }
Example 5
Source File: AbstractSoftlayerLiveTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Override protected BrooklynProperties getBrooklynProperties() { List<String> propsToRemove = ImmutableList.of("imageId", "imageDescriptionRegex", "imageNameRegex", "inboundPorts", "hardwareId", "minRam"); // Don't let any defaults from brooklyn.properties (except credentials) interfere with test BrooklynProperties result = BrooklynProperties.Factory.newDefault(); for (String propToRemove : propsToRemove) { for (String propVariant : ImmutableList.of(propToRemove, CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, propToRemove))) { result.remove("brooklyn.locations.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.locations."+propVariant); result.remove("brooklyn.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.jclouds."+propVariant); } } // Also removes scriptHeader (e.g. if doing `. ~/.bashrc` and `. ~/.profile`, then that can cause "stdin: is not a tty") result.remove("brooklyn.ssh.config.scriptHeader"); return result; }
Example 6
Source File: AbstractDockerLiveTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Override protected BrooklynProperties getBrooklynProperties() { // Don't let any defaults from brooklyn.properties (except credentials) interfere with test List<String> propsToRemove = ImmutableList.of("imageDescriptionRegex", "imageNameRegex", "inboundPorts", "hardwareId", "minRam"); BrooklynProperties result = BrooklynProperties.Factory.newDefault(); for (String propToRemove : propsToRemove) { for (String propVariant : ImmutableList.of(propToRemove, CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, propToRemove))) { result.remove("brooklyn.locations.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.locations."+propVariant); result.remove("brooklyn.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.jclouds."+propVariant); } } // Also removes scriptHeader (e.g. if doing `. ~/.bashrc` and `. ~/.profile`, then that can cause "stdin: is not a tty") result.remove("brooklyn.ssh.config.scriptHeader"); return result; }
Example 7
Source File: AbstractGoogleComputeLiveTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Override protected BrooklynProperties getBrooklynProperties() { // Don't let any defaults from brooklyn.properties (except credentials) interfere with test List<String> propsToRemove = ImmutableList.of("imageId", "imageDescriptionRegex", "imageNameRegex", "inboundPorts", "hardwareId", "minRam"); BrooklynProperties result = BrooklynProperties.Factory.newDefault(); for (String propToRemove : propsToRemove) { for (String propVariant : ImmutableList.of(propToRemove, CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, propToRemove))) { result.remove("brooklyn.locations.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.locations."+propVariant); result.remove("brooklyn.jclouds."+PROVIDER+"."+propVariant); result.remove("brooklyn.jclouds."+propVariant); } } // Also removes scriptHeader (e.g. if doing `. ~/.bashrc` and `. ~/.profile`, then that can cause "stdin: is not a tty") result.remove("brooklyn.ssh.config.scriptHeader"); return result; }
Example 8
Source File: ServerResourceTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test void testGetMissingConfigThrowsException() throws Exception { final String key = "foo.bar.baz"; BrooklynProperties properties = ((ManagementContextInternal)getManagementContext()).getBrooklynProperties(); Object existingValue = null; boolean keyAlreadyPresent = false; if (properties.containsKey(key)) { existingValue = properties.remove(key); keyAlreadyPresent = true; } try { final WebClient webClient = client().path("/server/config/" + key); Response response = webClient.get(); assertEquals(response.getStatus(), 204); } finally { if (keyAlreadyPresent) { properties.put(key, existingValue); } } }