From ba2cf5d0af6a755769a0e1022ac077e81743c591 Mon Sep 17 00:00:00 2001 From: "graeme.miller" Date: Tue, 14 Mar 2017 15:35:38 +0000 Subject: [PATCH] Revert "add original failing test from @sjcorbett" This reverts commit d7cbaeed46d7fedf8e49df015baa812352060f45. --- rest/rest-server/pom.xml | 6 - .../BrooklynRestApiLauncherTestFixture.java | 2 +- .../entity/RedisClusterIntegrationTest.java | 109 ------------------ 3 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 rest/rest-server/src/test/java/org/apache/brooklyn/rest/test/entity/RedisClusterIntegrationTest.java diff --git a/rest/rest-server/pom.xml b/rest/rest-server/pom.xml index bcd271b4f7..a269b72b22 100644 --- a/rest/rest-server/pom.xml +++ b/rest/rest-server/pom.xml @@ -151,12 +151,6 @@ tests test - - org.apache.brooklyn - brooklyn-software-nosql - ${project.version} - test - org.apache.brooklyn brooklyn-locations-jclouds diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java index 642ef875cd..b84dbcf063 100644 --- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java +++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java @@ -47,7 +47,7 @@ public abstract class BrooklynRestApiLauncherTestFixture { - protected Server server = null; + Server server = null; @AfterMethod(alwaysRun=true) public void stopServer() throws Exception { diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/test/entity/RedisClusterIntegrationTest.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/test/entity/RedisClusterIntegrationTest.java deleted file mode 100644 index 79b162ba80..0000000000 --- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/test/entity/RedisClusterIntegrationTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.brooklyn.rest.test.entity; - -import static org.apache.brooklyn.test.Asserts.assertTrue; -import static org.testng.Assert.assertNotNull; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.api.mgmt.Task; -import org.apache.brooklyn.core.entity.Attributes; -import org.apache.brooklyn.core.entity.Entities; -import org.apache.brooklyn.core.entity.EntityAsserts; -import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; -import org.apache.brooklyn.entity.nosql.redis.RedisCluster; -import org.apache.brooklyn.entity.nosql.redis.RedisStore; -import org.apache.brooklyn.entity.software.base.SoftwareProcess; -import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture; -import org.apache.brooklyn.util.http.HttpAsserts; -import org.apache.brooklyn.util.http.HttpToolResponse; -import org.apache.brooklyn.util.text.Strings; -import org.apache.brooklyn.util.time.Duration; -import org.apache.brooklyn.util.yaml.Yamls; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; - -public class RedisClusterIntegrationTest extends BrooklynRestApiLauncherTestFixture { - - @BeforeMethod(alwaysRun=true) - public void setUp() throws Exception { - useServerForTest(newServer()); - } - - @Test(groups = "Integration") - public void testDeployRedisCluster() throws InterruptedException, ExecutionException, TimeoutException { - final URI webConsoleUri = URI.create(getBaseUriRest()); - - // Test setup - final EntitySpec 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) 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); - } - - private void assertDownloadUrl(Entity entity) { - assertNotNull(entity.config().get(RedisStore.DOWNLOAD_URL), "RedisStore.DOWNLOAD_URL"); - assertNotNull(entity.config().get(SoftwareProcess.DOWNLOAD_URL), "SoftwareProcess.DOWNLOAD_URL"); - assertNotNull(entity.config().get(Attributes.DOWNLOAD_URL), "Attributes.DOWNLOAD_URL"); - } - -} \ No newline at end of file