### Question:
JcloudsPropertiesFromBrooklynProperties extends LocationPropertiesFromBrooklynProperties { public Map<String, Object> getJcloudsProperties(String providerOrApi, String regionOrEndpoint, String namedLocation, Map<String, ?> properties) { if(Strings.isNullOrEmpty(namedLocation) && Strings.isNullOrEmpty(providerOrApi)) { throw new IllegalArgumentException("Neither cloud provider/API nor location name have been specified correctly"); } ConfigBag jcloudsProperties = ConfigBag.newInstance(); String provider = getProviderName(providerOrApi, namedLocation, properties); jcloudsProperties.put(LocationConfigKeys.CLOUD_PROVIDER, provider); jcloudsProperties.putAll(transformDeprecated(getGenericLocationSingleWordProperties(properties))); jcloudsProperties.putAll(transformDeprecated(getGenericJcloudsSingleWordProperties(providerOrApi, properties))); jcloudsProperties.putAll(transformDeprecated(getProviderOrApiJcloudsProperties(providerOrApi, properties))); jcloudsProperties.putAll(transformDeprecated(getRegionJcloudsProperties(providerOrApi, regionOrEndpoint, properties))); if (!Strings.isNullOrEmpty(namedLocation)) jcloudsProperties.putAll(transformDeprecated(getNamedJcloudsProperties(namedLocation, properties))); setLocalTempDir(properties, jcloudsProperties); return jcloudsProperties.getAllConfigRaw(); }  @Override Map<String, Object> getLocationProperties(String provider, String namedLocation, Map<String, ?> properties); Map<String, Object> getJcloudsProperties(String providerOrApi, String regionOrEndpoint, String namedLocation, Map<String, ?> properties);  }### Answer:
@Test public void testProviderOrApiProperties() { Map<String, Object> map = parser.getJcloudsProperties("FooServers", null, null, sampleProviderOrApiProps()); Assert.assertEquals(map.get("identity"), "bob"); Assert.assertEquals(map.get("credential"), "s3cr3t"); Assert.assertEquals(map.get("provider"), "FooServers"); }
@Test public void testNamedProperties() { Map<String, Object> map = parser.getJcloudsProperties("openstack-nova", null, "cloudfirst", sampleNamedProps()); Assert.assertEquals(map.get("provider"), "openstack-nova"); Assert.assertEquals(map.get("identity"), "myId"); Assert.assertEquals(map.get("credential"), "password"); Assert.assertEquals(map.get("imageId"), "RegionOne/1"); Assert.assertEquals(map.get("securityGroups"), "universal"); }
@Test public void testOrderOfPreference() { Map<String, Object> allProperties = Maps.newHashMap(); allProperties.putAll(sampleProviderOrApiProps()); allProperties.putAll(sampleNamedProps()); Map<String, Object> map = parser.getJcloudsProperties("openstack-nova", null, "cloudfirst", allProperties); Assert.assertEquals(map.get("provider"), "openstack-nova"); Assert.assertEquals(map.get("identity"), "myId"); Assert.assertEquals(map.get("credential"), "password"); Assert.assertEquals(map.get("imageId"), "RegionOne/1"); Assert.assertEquals(map.get("securityGroups"), "universal"); }