Java Code Examples for org.apache.brooklyn.api.mgmt.Task#get()
The following examples show how to use
org.apache.brooklyn.api.mgmt.Task#get() .
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: DslTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
static Maybe<?> execDslImmediately(final BrooklynDslDeferredSupplier<?> dsl, final TypeToken<?> type, final Entity context, boolean execInTask) throws Exception { // Exec'ing immediately will call DSL in current thread. It needs to find the context entity, // and does this using BrooklynTaskTags.getTargetOrContextEntity(Tasks.current()). // If we are not in a task executed by the context entity, then this lookup will fail. Callable<Maybe<?>> job = new Callable<Maybe<?>>() { @Override public Maybe<?> call() throws Exception { return Tasks.resolving(dsl).as(type) .context(context) .description("Computing "+dsl) .immediately(true) .getMaybe(); } }; if (execInTask) { Task<Maybe<?>> task = ((EntityInternal)context).getExecutionContext().submit("Resolving DSL for test: "+dsl, job); task.get(Asserts.DEFAULT_LONG_TIMEOUT); assertTrue(task.isDone()); return task.get(); } else { return job.call(); } }
Example 2
Source File: CompoundTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test public void testComplexOrdering() throws Exception { List<String> data = new CopyOnWriteArrayList<String>(); SequentialTask<String> taskA = new SequentialTask<String>( appendAfterDelay(data, "a1"), appendAfterDelay(data, "a2"), appendAfterDelay(data, "a3"), appendAfterDelay(data, "a4")); SequentialTask<String> taskB = new SequentialTask<String>( appendAfterDelay(data, "b1"), appendAfterDelay(data, "b2"), appendAfterDelay(data, "b3"), appendAfterDelay(data, "b4")); Task<List<String>> t = ec.submit(new ParallelTask<String>(taskA, taskB)); t.get(); LOG.debug("Tasks happened in order: {}", data); assertEquals(data.size(), 8); assertEquals(new HashSet<String>(data), ImmutableSet.of("a1", "a2", "a3", "a4", "b1", "b2", "b3", "b4")); // a1, ..., a4 should be in order List<String> as = Lists.newArrayList(), bs = Lists.newArrayList(); for (String value : data) { ((value.charAt(0) == 'a') ? as : bs).add(value); } assertEquals(as, ImmutableList.of("a1", "a2", "a3", "a4")); assertEquals(bs, ImmutableList.of("b1", "b2", "b3", "b4")); }
Example 3
Source File: SoftwareProcessEntityLatchTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
public void doTestLatchBlocks(ConfigKey<Boolean> latch, List<String> preLatchEvents, Object latchValue, Function<? super MyService, Void> customAssertFn) throws Exception { final AttributeSensor<Object> latchSensor = Sensors.newSensor(Object.class, "latch"); final MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class) .configure(ConfigKeys.newConfigKey(Object.class, latch.getName()), (Object)DependentConfiguration.attributeWhenReady(app, latchSensor))); final Task<Void> task; final Task<Void> startTask = Entities.invokeEffector(app, app, MyService.START, ImmutableMap.of("locations", ImmutableList.of(loc))); if (latch != SoftwareProcess.STOP_LATCH) { task = startTask; } else { startTask.get(Duration.THIRTY_SECONDS); task = Entities.invokeEffector(app, app, MyService.STOP); } assertEffectorBlockingDetailsEventually(entity, task.getDisplayName(), "Waiting for config " + latch.getName()); assertDriverEventsEquals(entity, preLatchEvents); assertFalse(task.isDone()); app.sensors().set(latchSensor, latchValue); customAssertFn.apply(entity); task.get(Duration.THIRTY_SECONDS); assertDriverEventsEquals(entity, getLatchPostTasks(latch)); }
Example 4
Source File: TaskPredicatesTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test public void testIsDone() throws Exception { CountDownLatch latch = new CountDownLatch(1); Task<?> task = app.getExecutionContext().submit("await latch", () -> { try { latch.await(); } catch (InterruptedException e) { throw Exceptions.propagate(e); } }); assertFalse(TaskPredicates.isDone().apply(task)); latch.countDown(); task.get(); assertTrue(TaskPredicates.isDone().apply(task)); }
Example 5
Source File: EffectorUtilsRestTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
/** * Invoking an effector with sensitive parameters. * Invocation imitates {@link EffectorResource#invoke(String, String, String, String, Map)} */ @Test public void testInvokingEffector() { Maybe<Effector<?>> effector = EffectorUtils.findEffectorDeclared(entity, "resetPassword"); final String sensitiveField1 = "newPassword"; final String sensitiveField2 = "secretPin"; Task<?> t = entity.invoke(effector.get(), ImmutableMap.of(sensitiveField1, "#$%'332985$23$#\"sd'", "secretPin", 1234)); TaskSummary summary = TaskTransformer.taskSummary(t, uriBuilder); try { t.get(); } catch (InterruptedException|ExecutionException e) { throw Exceptions.propagate(e); } log.debug("Result description: "+summary.getDescription()); assertEquals( summary.getDescription(), "Invoking effector resetPassword on "+TestEntityWithEffectors.class.getSimpleName()+":"+entity.getId().substring(0,4) +" with parameters {"+sensitiveField1+"=xxxxxxxx, "+sensitiveField2+"=xxxxxxxx}", "Task summary must hide sensitive parameters"); }
Example 6
Source File: EntityExecutionManagerTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test(groups="Integration") public void testEffectorTasksGcedForAge() throws Exception { Duration maxTaskAge = Duration.millis(100); Duration maxOverhead = Duration.millis(250); Duration earlyReturnGrace = Duration.millis(10); BrooklynProperties brooklynProperties = BrooklynProperties.Factory.newEmpty(); brooklynProperties.put(BrooklynGarbageCollector.GC_PERIOD, Duration.ONE_MILLISECOND); brooklynProperties.put(BrooklynGarbageCollector.MAX_TASK_AGE, maxTaskAge); replaceManagementContext(LocalManagementContextForTests.newInstance(brooklynProperties)); setUpApp(); final TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); Stopwatch stopwatch = Stopwatch.createStarted(); Task<?> oldTask = entity.invoke(TestEntity.MY_EFFECTOR, ImmutableMap.<String,Object>of()); oldTask.get(); Asserts.succeedsEventually(new Runnable() { @Override public void run() { Set<Task<?>> storedTasks = app.getManagementContext().getExecutionManager().getTasksWithAllTags(ImmutableList.of( BrooklynTaskTags.tagForTargetEntity(entity), ManagementContextInternal.EFFECTOR_TAG)); assertEquals(storedTasks, ImmutableSet.of(), "storedTasks="+storedTasks); }}); Duration timeToGc = Duration.of(stopwatch); assertTrue(timeToGc.isLongerThan(maxTaskAge.subtract(earlyReturnGrace)), "timeToGc="+timeToGc+"; maxTaskAge="+maxTaskAge); assertTrue(timeToGc.isShorterThan(maxTaskAge.add(maxOverhead)), "timeToGc="+timeToGc+"; maxTaskAge="+maxTaskAge); }
Example 7
Source File: EntityAssertsTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void shouldAssertPredicateEventuallyTrue() throws Exception { final int testVal = 987654321; final CountDownLatch eventuallyEntered = new CountDownLatch(2); Task<?> assertValue = entity.getExecutionContext().submit("assert predicate", () -> EntityAsserts.assertPredicateEventuallyTrue(entity, (input) -> { eventuallyEntered.countDown(); return testVal == input.getSequenceValue(); })); eventuallyEntered.await(); entity.setSequenceValue(testVal); assertValue.get(); }
Example 8
Source File: DynamicClusterTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testReportsServiceUpAsSoonAsQuorumSize() throws Exception { final Duration shortWait = Duration.millis(50); final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure("initialSize", 2) .configure("firstMemberSpec", EntitySpec.create(BlockingEntity.class) .configure(BlockingEntity.STARTUP_LATCH, latch1)) .configure("memberSpec", EntitySpec.create(BlockingEntity.class) .configure(BlockingEntity.STARTUP_LATCH, latch2))); // Invoke start: should report starting Task<Void> task = cluster.invoke(Startable.START, ImmutableMap.of("locations", ImmutableList.of(loc))); EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_UP, false); EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STARTING); EntityAsserts.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE, 2); // Allow first member to complete: we are now quorate, so should report service.isUp=true; // but will still be starting. latch1.countDown(); EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_UP, true); EntityAsserts.assertAttributeEqualsContinually(ImmutableMap.of("timeout", shortWait), cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STARTING); assertFalse(task.isDone()); // Allow second member to complete; we are now fully up. latch2.countDown(); task.get(); EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_UP, true); EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); }
Example 9
Source File: BasicTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testRetrievingTasksWithTagsExcludesNonMatchingTasks() throws Exception { Task<?> t = new BasicTask<Void>(newNoop()); em.submit(MutableMap.of("tag", "A"), t); t.get(); assertEquals(em.getTasksWithTag("B"), ImmutableSet.of()); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("B")), ImmutableSet.of()); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A", "B")), ImmutableSet.of()); }
Example 10
Source File: BasicTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testRetrievingTasksWithAllTagsWhenFirstNotMatched() throws Exception { Task<?> t = new BasicTask<Void>(newNoop()); em.submit(MutableMap.of("tags", ImmutableList.of("A")), t); t.get(); assertEquals(em.getTasksWithAllTags(ImmutableList.of("not_there","A")), ImmutableSet.of()); }
Example 11
Source File: DynamicFabricTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testDynamicFabricStartsEntitiesInParallel() throws Exception { Collection<Location> locs = ImmutableList.of(loc1, loc2); int numLocs = locs.size(); CountDownLatch executingStartupNotificationLatch = new CountDownLatch(numLocs); CountDownLatch startupLatch = new CountDownLatch(1); DynamicFabric fabric = app.createAndManageChild(EntitySpec.create(DynamicFabric.class) .configure("memberSpec", EntitySpec.create(BlockingEntity.class) .configure(BlockingEntity.EXECUTING_STARTUP_NOTIFICATION_LATCH, executingStartupNotificationLatch) .configure(BlockingEntity.STARTUP_LATCH, startupLatch))); final Task<?> task = fabric.invoke(Startable.START, ImmutableMap.of("locations", locs)); boolean executing = executingStartupNotificationLatch.await(Asserts.DEFAULT_LONG_TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS); assertTrue(executing); assertFalse(task.isDone()); startupLatch.countDown(); task.get(Asserts.DEFAULT_LONG_TIMEOUT); assertEquals(fabric.getChildren().size(), locs.size(), "children="+fabric.getChildren()); for (Entity it : fabric.getChildren()) { assertEquals(((TestEntity)it).getCounter().get(), 1); } }
Example 12
Source File: BasicTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testRetrievingTasksWithMultipleTags() throws Exception { Task<?> t = new BasicTask<Void>(newNoop()); em.submit(MutableMap.of("tags", ImmutableList.of("A", "B")), t); t.get(); assertEquals(em.getTasksWithTag("A"), ImmutableList.of(t)); assertEquals(em.getTasksWithTag("B"), ImmutableList.of(t)); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A")), ImmutableList.of(t)); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("B")), ImmutableList.of(t)); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A", "B")), ImmutableList.of(t)); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A", "B")), ImmutableList.of(t)); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A")), ImmutableList.of(t)); assertEquals(em.getTasksWithAllTags(ImmutableList.of("B")), ImmutableList.of(t)); }
Example 13
Source File: BasicTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void runMultipleBasicTasksMultipleTags() throws Exception { data.put(1, 1); Collection<Task<Integer>> tasks = Lists.newArrayList(); tasks.add(em.submit(MutableMap.of("tag", "A"), new BasicTask<Integer>(newIncrementCallable(1)))); tasks.add(em.submit(MutableMap.of("tags", ImmutableList.of("A","B")), new BasicTask<Integer>(newIncrementCallable(1)))); tasks.add(em.submit(MutableMap.of("tags", ImmutableList.of("B","C")), new BasicTask<Integer>(newIncrementCallable(1)))); tasks.add(em.submit(MutableMap.of("tags", ImmutableList.of("D")), new BasicTask<Integer>(newIncrementCallable(1)))); int total = 0; for (Task<Integer> t : tasks) { log.debug("BasicTask {}, has {}", t, t.get()); total += t.get(); } assertEquals(10, total); //now that all have completed: assertEquals(data.get(1), 5); assertEquals(em.getTasksWithTag("A").size(), 2); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A")).size(), 2); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A")).size(), 2); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A", "B")).size(), 3); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A", "B")).size(), 1); assertEquals(em.getTasksWithAllTags(ImmutableList.of("B", "C")).size(), 1); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A", "D")).size(), 3); }
Example 14
Source File: BasicTaskExecutionTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testRetrievingTasksWithTagsReturnsExpectedTask() throws Exception { Task<?> t = new BasicTask<Void>(newNoop()); em.submit(MutableMap.of("tag", "A"), t); t.get(); assertEquals(em.getTasksWithTag("A"), ImmutableList.of(t)); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A")), ImmutableList.of(t)); assertEquals(em.getTasksWithAnyTag(ImmutableList.of("A", "B")), ImmutableList.of(t)); assertEquals(em.getTasksWithAllTags(ImmutableList.of("A")), ImmutableList.of(t)); }
Example 15
Source File: DependentConfigurationTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testRegexReplacementWithAttributeWhenReady() throws Exception { AttributeSensor<String> sourceSensor = Sensors.newStringSensor("test.source"); AttributeSensor<String> replacementSensor = Sensors.newSensor(String.class, "test.replacement"); Task<String> source = DependentConfiguration.attributeWhenReady(entity, sourceSensor); Task<String> pattern = DependentConfiguration.attributeWhenReady(entity, TestEntity.NAME); Task<String> replacement = DependentConfiguration.attributeWhenReady(entity, replacementSensor); Task<String> task = DependentConfiguration.regexReplacement(source, pattern, replacement); submit(task); entity.sensors().set(sourceSensor, "somefootext"); entity.sensors().set(TestEntity.NAME, "foo"); entity.sensors().set(replacementSensor, "bar"); String result = task.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); Assert.assertEquals(result, "somebartext"); }
Example 16
Source File: EffectorBasicTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
protected Exception assertTaskFails(Task<?> t) { try { t.get(); Assert.fail("Should have failed"); } catch (Exception e) { Asserts.expectedFailure(e); return e; } return null; }
Example 17
Source File: EntityAssertsTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test(expectedExceptions = AssertionError.class) public void shouldFailAssertAttributeEqualsContinually() throws Throwable { final String myName = "myname"; entity.sensors().set(TestEntity.NAME, myName); Task<?> assertValue = entity.getExecutionContext().submit("check attr equals", () -> EntityAsserts.assertAttributeEqualsContinually(entity, TestEntity.NAME, myName)); entity.sensors().set(TestEntity.NAME, "something"); try { assertValue.get(); } catch (ExecutionException e) { //strip wrapper exception throw e.getCause(); } }
Example 18
Source File: TestSensorTest.java From brooklyn-server with Apache License 2.0 | 4 votes |
@Test public void testDoesNotLogStacktraceRepeatedly() throws Exception { final long time = System.currentTimeMillis(); final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), time, Identifiers.makeRandomId(8)); // Test case will repeatedly fail until we have finished our logging assertions. // Then we'll let it complete by setting the sensor. TestSensor testCase = app.createAndManageChild(EntitySpec.create(TestSensor.class) .configure(TestSensor.TIMEOUT, Asserts.DEFAULT_LONG_TIMEOUT) .configure(TestSensor.BACKOFF_TO_PERIOD, Duration.millis(1)) .configure(TestSensor.TARGET_ENTITY, app) .configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) .configure(TestSensor.ASSERTIONS, newListAssertion("matches", String.format(".*%s.*", time)))); String loggerName = Repeater.class.getName(); ch.qos.logback.classic.Level logLevel = ch.qos.logback.classic.Level.DEBUG; Predicate<ILoggingEvent> repeatedFailureMsgMatcher = EventPredicates.containsMessage("repeated failure; excluding stacktrace"); Predicate<ILoggingEvent> stacktraceMatcher = EventPredicates.containsExceptionStackLine(TestFrameworkAssertions.class, "checkActualAgainstAssertions"); Predicate<ILoggingEvent> filter = Predicates.or(repeatedFailureMsgMatcher, stacktraceMatcher); try (LogWatcher watcher = new LogWatcher(loggerName, logLevel, filter)) { // Invoke async; will let it complete after we see the log messages we expect Task<?> task = Entities.invokeEffector(app, app, Startable.START, ImmutableMap.of("locations", locs)); // Expect "excluding stacktrace" message at least once List<ILoggingEvent> repeatedFailureMsgEvents = watcher.assertHasEventEventually(repeatedFailureMsgMatcher); assertTrue(repeatedFailureMsgEvents.size() > 0, "repeatedFailureMsgEvents="+repeatedFailureMsgEvents.size()); // Expect stacktrace just once List<ILoggingEvent> stacktraceEvents = watcher.assertHasEventEventually(stacktraceMatcher); assertEquals(Integer.valueOf(stacktraceEvents.size()), Integer.valueOf(1), "stacktraceEvents="+stacktraceEvents.size()); //Set STRING sensor app.sensors().set(STRING_SENSOR, sensorValue); task.get(Asserts.DEFAULT_LONG_TIMEOUT); assertTestSensorSucceeds(testCase); // And for good measure (in case we just checked too early last time), check again // that we didn't get another stacktrace stacktraceEvents = watcher.getEvents(stacktraceMatcher); assertEquals(Integer.valueOf(stacktraceEvents.size()), Integer.valueOf(1), "stacktraceEvents="+stacktraceEvents.size()); } }
Example 19
Source File: EntityExecutionManagerTest.java From brooklyn-server with Apache License 2.0 | 4 votes |
@Test(groups={"Integration"}) public void testEffectorTasksGcedForMaxPerTag() throws Exception { int maxNumTasks = 2; BrooklynProperties brooklynProperties = BrooklynProperties.Factory.newEmpty(); brooklynProperties.put(BrooklynGarbageCollector.GC_PERIOD, Duration.ONE_SECOND); brooklynProperties.put(BrooklynGarbageCollector.MAX_TASKS_PER_TAG, 2); replaceManagementContext(LocalManagementContextForTests.newInstance(brooklynProperties)); setUpApp(); final TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); List<Task<?>> tasks = Lists.newArrayList(); for (int i = 0; i < (maxNumTasks+1); i++) { Task<?> task = entity.invoke(TestEntity.MY_EFFECTOR, ImmutableMap.<String,Object>of()); task.get(); tasks.add(task); // TASKS_OLDEST_FIRST_COMPARATOR is based on comparing EndTimeUtc; but two tasks executed in // rapid succession could finish in same millisecond // (especially when using System.currentTimeMillis, which can return the same time for several millisconds). Thread.sleep(10); } // Should initially have all tasks Set<Task<?>> storedTasks = app.getManagementContext().getExecutionManager().getTasksWithAllTags( ImmutableList.of(BrooklynTaskTags.tagForContextEntity(entity), ManagementContextInternal.EFFECTOR_TAG)); assertEquals(storedTasks, ImmutableSet.copyOf(tasks), "storedTasks="+storedTasks+"; expected="+tasks); // Then oldest should be GC'ed to leave only maxNumTasks final List<Task<?>> recentTasks = tasks.subList(tasks.size()-maxNumTasks, tasks.size()); Asserts.succeedsEventually(new Runnable() { @Override public void run() { Set<Task<?>> storedTasks2 = app.getManagementContext().getExecutionManager().getTasksWithAllTags( ImmutableList.of(BrooklynTaskTags.tagForContextEntity(entity), ManagementContextInternal.EFFECTOR_TAG)); List<String> storedTasks2Str = FluentIterable .from(storedTasks2) .transform(new Function<Task<?>, String>() { @Override public String apply(Task<?> input) { return taskToVerboseString(input); }}) .toList(); assertEquals(storedTasks2, ImmutableSet.copyOf(recentTasks), "storedTasks="+storedTasks2Str+"; expected="+recentTasks); }}); }
Example 20
Source File: RedisClusterViaRestIntegrationTest.java From brooklyn-library with Apache License 2.0 | 4 votes |
/** REST seems to show up a different behaviour in context entity used when adding children entities, * causing different config to be set, so we test that, using Redis as a comparatively simple example. */ @Test(groups = "Integration") public void testDeployRedisCluster() throws InterruptedException, ExecutionException, TimeoutException { final URI webConsoleUri = URI.create(getBaseUriRest()); // Test setup final EntitySpec<BrooklynNode> spec = EntitySpec.create(BrooklynNode.class); final ManagementContext mgmt = getManagementContextFromJettyServerAttributes(server); final BrooklynNode node = mgmt.getEntityManager().createEntity(spec); node.sensors().set(BrooklynNode.WEB_CONSOLE_URI, webConsoleUri); // Deploy it. final String blueprint = "location: localhost\n" + "services:\n" + "- type: org.apache.brooklyn.entity.nosql.redis.RedisCluster"; HttpToolResponse response = node.http().post( "/applications", ImmutableMap.of("Content-Type", "text/yaml"), blueprint.getBytes()); HttpAsserts.assertHealthyStatusCode(response.getResponseCode()); // Assert application is eventually running and not on fire. final Entity entity = mgmt.getApplications().iterator().next().getChildren().iterator().next(); assertTrue(entity instanceof RedisCluster, "expected " + RedisCluster.class.getName() + ", found: " + entity); RedisCluster cluster = RedisCluster.class.cast(entity); Entities.dumpInfo(cluster); assertDownloadUrl(cluster.getMaster()); for (Entity slave : cluster.getSlaves().getMembers()) { assertDownloadUrl(slave); } @SuppressWarnings("unchecked") String taskId = Strings.toString( ((Map<String,Object>) Yamls.parseAll(response.getContentAsString()).iterator().next()).get("id") ); Task<?> task = mgmt.getExecutionManager().getTask(taskId); Assert.assertNotNull(task); task.get(Duration.minutes(20)); Entities.dumpInfo(cluster); EntityAsserts.assertAttributeEquals(entity, SoftwareProcess.SERVICE_UP, true); }