@Test public void testReloadBrooklynPropertiesNonDeploy() { CampPlatform platform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(platform); brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertEquals(reloadedPlatform, platform); }
public static boolean isEnabled(ManagementContext mgmt, String prefix) { ConfigKey<Boolean> key = ConfigKeys.newConfigKeyWithPrefix(prefix + ".", LocationConfigKeys.ENABLED); Boolean enabled = mgmt.getConfig().getConfig(key); if (enabled != null) return enabled.booleanValue(); return true; }
@Test public void testReloadBrooklynPropertiesDeploy() { brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(reloadedPlatform); Reader input = Streams.reader( new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml")); AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input); try { Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform); LOG.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); LOG.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template"); EntityTestUtils.assertAttributeEqualsEventually(app, Startable.SERVICE_UP, true); } catch (Exception e) { LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e); throw Exceptions.propagate(e); } }
public static String getMgmtBaseDir(ManagementContext mgmt) { return getMgmtBaseDir(mgmt.getConfig()); }
/** Returns the CAMP platform associated with a management context, if there is one. */ public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) { CampPlatform result = mgmt.getConfig().getConfig(BrooklynServerConfig.CAMP_PLATFORM); if (result != null) return Maybe.of(result); return Maybe.absent("No CAMP Platform is registered with this Brooklyn management context."); }
/** * @deprecated since 0.7.0 use {@link #resolvePersistencePath(String, StringConfigMap, String)} */ public static String getPersistenceDir(ManagementContext mgmt) { return getPersistenceDir(mgmt.getConfig()); }