You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:48:01 UTC
[25/51] [abbrv] [partial] brooklyn-library git commit: move subdir
from incubator up a level as it is promoted to its own repo (first
non-incubator commit!)
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveEc2Test.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveEc2Test.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveEc2Test.java
deleted file mode 100644
index 362e966..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveEc2Test.java
+++ /dev/null
@@ -1,79 +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.entity.database.mariadb;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.entity.AbstractEc2LiveTest;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-@Test(groups = { "Live" })
-public class MariaDbLiveEc2Test extends AbstractEc2LiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- // TODO For some CentOS VMs (e.g. in AWS 6.3, us-east-1/ami-a96b01c0), currently need to turn off iptables unfortunately.
- // Should really just open the ports in iptables.
- MariaDbNode mariadb = app.createAndManageChild(EntitySpec.create(MariaDbNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, MariaDbIntegrationTest.CREATION_SCRIPT)
- .configure(MariaDbNode.PROVISIONING_PROPERTIES.subKey(JcloudsLocation.STOP_IPTABLES.getName()), true));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("com.mysql.jdbc.Driver", mariadb.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Override
- @Test(enabled=false, groups = "Live")
- public void test_Debian_7_2() throws Exception { } // Disabled because MariaDB not available
-
- @Test(groups = {"Live"})
- public void testWithOnlyPort22() throws Exception {
- // CentOS-6.3-x86_64-GA-EBS-02-85586466-5b6c-4495-b580-14f72b4bcf51-ami-bb9af1d2.1
- jcloudsLocation = mgmt.getLocationRegistry().resolve(LOCATION_SPEC, ImmutableMap.of(
- "tags", ImmutableList.of(getClass().getName()),
- "imageId", "us-east-1/ami-a96b01c0",
- "hardwareId", SMALL_HARDWARE_ID));
-
- MariaDbNode server = app.createAndManageChild(EntitySpec.create(MariaDbNode.class)
- .configure(MariaDbNode.PROVISIONING_PROPERTIES.subKey(CloudLocationConfig.INBOUND_PORTS.getName()), ImmutableList.of(22)));
-
- app.start(ImmutableList.of(jcloudsLocation));
-
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_UP, true);
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
-
- Integer port = server.getAttribute(MariaDbNode.MARIADB_PORT);
- assertNotNull(port);
-
- assertViaSshLocalPortListeningEventually(server, port);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveRackspaceTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveRackspaceTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveRackspaceTest.java
deleted file mode 100644
index b5474f8..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mariadb/MariaDbLiveRackspaceTest.java
+++ /dev/null
@@ -1,103 +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.entity.database.mariadb;
-
-import java.util.Arrays;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.net.Protocol;
-import org.apache.brooklyn.util.ssh.IptablesCommands;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Chain;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Policy;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * The MariaDbLiveTest installs MariaDb on various operating systems like Ubuntu, CentOS, Red Hat etc. To make sure that
- * MariaDb works like expected on these Operating Systems.
- */
-public class MariaDbLiveRackspaceTest extends MariaDbIntegrationTest {
- @Test(groups = {"Live"})
- public void test_Debian_6() throws Exception {
- test("Debian 6");
- }
-
- @Test(groups = {"Live"})
- public void test_Ubuntu_10_0() throws Exception {
- test("Ubuntu 10.0");
- }
-
- @Test(groups = {"Live", "Live-sanity"})
- public void test_Ubuntu_12_0() throws Exception {
- test("Ubuntu 12.0");
- }
-
- @Test(groups = {"Live"})
- public void test_Ubuntu_13() throws Exception {
- test("Ubuntu 13");
- }
-
- @Test(groups = {"Live"})
- public void test_CentOS_6() throws Exception {
- test("CentOS 6");
- }
-
- @Test(groups = {"Live"})
- public void test_CentOS_5() throws Exception {
- test("CentOS 5");
- }
-
- @Test(groups = {"Live"})
- public void test_Fedora() throws Exception {
- test("Fedora ");
- }
-
- @Test(groups = {"Live"})
- public void test_Red_Hat_Enterprise_Linux_6() throws Exception {
- test("Red Hat Enterprise Linux 6");
- }
-
- @Test(groups = {"Live"})
- public void test_localhost() throws Exception {
- super.test_localhost();
- }
-
- public void test(String osRegex) throws Exception {
- MariaDbNode mariadb = tapp.createAndManageChild(EntitySpec.create(MariaDbNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT));
-
- 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) managementContext.getLocationRegistry().resolve("jclouds:rackspace-cloudservers-uk");
-
- tapp.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();
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterIntegrationTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterIntegrationTest.java
deleted file mode 100644
index baaefe4..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterIntegrationTest.java
+++ /dev/null
@@ -1,200 +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.entity.database.mysql;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.effector.EffectorTasks;
-import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport;
-import org.apache.brooklyn.entity.database.mysql.MySqlCluster.MySqlMaster;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.core.task.ssh.SshTasks;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.ssh.BashCommands;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-public class MySqlClusterIntegrationTest extends BrooklynAppLiveTestSupport {
-
- private static final String TEST_LOCATION = "localhost";
-
- @Test(groups="Integration")
- public void testAllNodesInit() throws Exception {
- try {
- MySqlClusterTestHelper.test(app, getLocation());
- } finally {
- cleanData();
- }
- }
-
- @Test(groups = {"Integration"})
- public void testMasterInit() throws Exception {
- try {
- MySqlClusterTestHelper.testMasterInit(app, getLocation());
- } finally {
- cleanData();
- }
- }
-
- @Test(groups="Integration")
- public void testDumpReplication() throws Exception {
- try {
- Location loc = getLocation();
- EntitySpec<MySqlCluster> clusterSpec = EntitySpec.create(MySqlCluster.class)
- .configure(MySqlMaster.MASTER_CREATION_SCRIPT_CONTENTS, MySqlClusterTestHelper.CREATION_SCRIPT)
- .configure(MySqlNode.MYSQL_SERVER_CONF, MySqlClusterTestHelper.minimalMemoryConfig());
- MySqlCluster cluster = MySqlClusterTestHelper.initCluster(app, loc, clusterSpec);
- MySqlNode master = (MySqlNode) cluster.getAttribute(MySqlCluster.FIRST);
- purgeLogs(cluster, master);
-
- // test dump replication from master
- MySqlNode slave = (MySqlNode) Iterables.getOnlyElement(cluster.invoke(MySqlCluster.RESIZE_BY_DELTA, ImmutableMap.of("delta", 1)).getUnchecked());
- assertEquals(cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT).getEntityId(), master.getId());
- MySqlClusterTestHelper.assertReplication(master, slave);
-
- // test dump replication from slave, missing dump on node
- deleteSnapshot(cluster);
- cluster.config().set(MySqlCluster.REPLICATION_PREFERRED_SOURCE, slave.getId());
- MySqlNode secondSlave = (MySqlNode) Iterables.getOnlyElement(cluster.invoke(MySqlCluster.RESIZE_BY_DELTA, ImmutableMap.of("delta", 1)).getUnchecked());
- assertEquals(cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT).getEntityId(), slave.getId());
- MySqlClusterTestHelper.assertReplication(master, secondSlave);
-
- // test dump replication from slave, missing snapshot entity
- Entities.destroy(slave);
- cluster.config().set(MySqlCluster.REPLICATION_PREFERRED_SOURCE, secondSlave.getId());
- MySqlNode thirdSlave = (MySqlNode) Iterables.getOnlyElement(cluster.invoke(MySqlCluster.RESIZE_BY_DELTA, ImmutableMap.of("delta", 1)).getUnchecked());
- assertEquals(cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT).getEntityId(), secondSlave.getId());
- MySqlClusterTestHelper.assertReplication(master, thirdSlave);
- } finally {
- cleanData();
- }
- }
-
- @Test(groups="Integration")
- public void testReplicationDatabaseFiltering() throws Exception {
- try {
- Location loc = getLocation();
- EntitySpec<MySqlCluster> clusterSpec = EntitySpec.create(MySqlCluster.class)
- .configure(MySqlMaster.MASTER_CREATION_SCRIPT_CONTENTS, MySqlClusterTestHelper.CREATION_SCRIPT)
- .configure(MySqlNode.MYSQL_SERVER_CONF, MySqlClusterTestHelper.minimalMemoryConfig())
- .configure(MySqlCluster.SLAVE_REPLICATE_DO_DB, ImmutableList.of("feedback", "items", "mysql"))
- .configure(MySqlCluster.SLAVE_REPLICATE_DUMP_DB, ImmutableList.of("feedback", "items", "mysql"));
-
- MySqlCluster cluster = MySqlClusterTestHelper.initCluster(app, loc, clusterSpec);
- MySqlNode master = (MySqlNode) cluster.getAttribute(MySqlCluster.FIRST);
- purgeLogs(cluster, master);
-
- // test dump replication from master
- MySqlNode slave = (MySqlNode) Iterables.getOnlyElement(cluster.invoke(MySqlCluster.RESIZE_BY_DELTA, ImmutableMap.of("delta", 1)).getUnchecked());
- assertEquals(cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT).getEntityId(), master.getId());
- MySqlClusterTestHelper.assertReplication(master, slave, "db_filter_test");
- } finally {
- cleanData();
- }
- }
-
- private void deleteSnapshot(MySqlCluster cluster) {
- ReplicationSnapshot replicationSnapshot = cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT);
- Entity snapshotEntity = mgmt.getEntityManager().getEntity(replicationSnapshot.getEntityId());
- SshMachineLocation machine = EffectorTasks.getSshMachine(snapshotEntity);
- Entities.submit(snapshotEntity, SshEffectorTasks.ssh(
- "cd $RUN_DIR",
- "rm " + replicationSnapshot.getSnapshotPath())
- .summary("clear snapshot")
- .machine(machine)
- .environmentVariable("RUN_DIR", snapshotEntity.getAttribute(MySqlNode.RUN_DIR))
- .requiringExitCodeZero())
- .asTask()
- .getUnchecked();
- }
-
- private void purgeLogs(MySqlCluster cluster, MySqlNode master) {
- String preFlushBinaryLogFile = getBinaryLogFile(master);
- ReplicationSnapshot replicationSnapshot = master.getParent().getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT);
- assertEquals(preFlushBinaryLogFile, replicationSnapshot.getBinLogName());
- MySqlClusterTestHelper.execSql(master, "FLUSH LOGS");
- String postFlushBinaryLogFile = getBinaryLogFile(master);
- waitSlavesCatchUp(cluster, postFlushBinaryLogFile);
- assertNotEquals(postFlushBinaryLogFile, preFlushBinaryLogFile);
- MySqlClusterTestHelper.execSql(master, "PURGE BINARY LOGS TO '" + postFlushBinaryLogFile + "';");
- assertFalse(fileExists(master, preFlushBinaryLogFile));
- }
-
- private void waitSlavesCatchUp(final MySqlCluster cluster, final String binLog) {
- Asserts.succeedsEventually(new Runnable() {
- @Override
- public void run() {
- MySqlNode master = (MySqlNode) cluster.getAttribute(MySqlCluster.FIRST);
- for (Entity node : cluster.getMembers()) {
- if (node == master) continue;
- String status = MySqlClusterTestHelper.execSql((MySqlNode) node, "SHOW SLAVE STATUS \\G");
- Map<String, String> map = MySqlRowParser.parseSingle(status);
- assertEquals(map.get("Relay_Master_Log_File"), binLog);
- }
- }
- });
- }
- private String getBinaryLogFile(MySqlNode master) {
- String status = MySqlClusterTestHelper.execSql(master, "SHOW MASTER STATUS \\G");
- Map<String, String> map = MySqlRowParser.parseSingle(status);
- return map.get("File");
- }
- private boolean fileExists(MySqlNode node, String binLogName) {
- String dataDir = Strings.nullToEmpty(node.getConfig(MySqlNode.DATA_DIR));
- String path = Os.mergePathsUnix(dataDir, binLogName);
- String cmd = BashCommands.chain(
- "cd $RUN_DIR",
- BashCommands.requireTest(String.format("-f \"%s\"", path), "File " + path + " doesn't exist."));
- String summary = "Check if file " + path + " exists";
- SshMachineLocation machine = EffectorTasks.getSshMachine(node);
- return Entities.submit(node, SshTasks.newSshExecTaskFactory(machine, cmd)
- .allowingNonZeroExitCode()
- .environmentVariable("RUN_DIR", node.getAttribute(SoftwareProcess.RUN_DIR))
- .summary(summary)
- .allowingNonZeroExitCode()).asTask().getUnchecked() == 0;
- }
- private void cleanData() {
- if (app.getChildren().isEmpty()) return;
- for (Entity member : Iterables.getOnlyElement(app.getChildren()).getChildren()) {
- String runDir = member.getAttribute(MySqlNode.RUN_DIR);
- if (runDir != null) {
- Os.deleteRecursively(runDir);
- }
- }
- }
-
- private Location getLocation() {
- return mgmt.getLocationRegistry().resolve(TEST_LOCATION);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveEc2Test.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveEc2Test.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveEc2Test.java
deleted file mode 100644
index 93fe0c9..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveEc2Test.java
+++ /dev/null
@@ -1,41 +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.entity.database.mysql;
-
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.entity.AbstractEc2LiveTest;
-
-@Test(groups = { "Live" })
-public class MySqlClusterLiveEc2Test extends AbstractEc2LiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- MySqlClusterTestHelper.test(app, loc);
- }
-
- @Override
- @Test(enabled=false, groups = "Live")
- public void test_Debian_7_2() throws Exception { } // Disabled because MySQl not available
-
- @Test(enabled=false)
- public void testDummy() {} // Convince testng IDE integration that this really does have test methods
-
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveSoftlayerTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveSoftlayerTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveSoftlayerTest.java
deleted file mode 100644
index c711265..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterLiveSoftlayerTest.java
+++ /dev/null
@@ -1,37 +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.entity.database.mysql;
-
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.entity.AbstractSoftlayerLiveTest;
-
-@Test(groups = { "Live" })
-public class MySqlClusterLiveSoftlayerTest extends AbstractSoftlayerLiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- MySqlClusterTestHelper.test(app, loc);
- }
-
- @Test(enabled=false)
- public void testDummy() {} // Convince testng IDE integration that this really does have test methods
-
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterTestHelper.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterTestHelper.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterTestHelper.java
deleted file mode 100644
index 71c0165..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterTestHelper.java
+++ /dev/null
@@ -1,199 +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.entity.database.mysql;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.entity.database.mysql.MySqlCluster.MySqlMaster;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-/**
- * Runs a slightly modified version of the popular Vogella MySQL tutorial,
- * from
- * http://www.vogella.de/articles/MySQLJava/article.html
- */
-public class MySqlClusterTestHelper {
- public static final Logger log = LoggerFactory.getLogger(MySqlClusterTestHelper.class);
-
- // From http://www.vogella.de/articles/MySQLJava/article.html
- public static final String CREATION_SCRIPT = Joiner.on("\n").join(ImmutableList.of(
- "CREATE DATABASE feedback;",
- "CREATE USER 'sqluser'@'localhost' IDENTIFIED BY 'sqluserpw';",
- "GRANT USAGE ON *.* TO 'sqluser'@'localhost';",
- "GRANT ALL PRIVILEGES ON feedback.* TO 'sqluser'@'localhost';",
- "CREATE USER 'sqluser'@'%' IDENTIFIED BY 'sqluserpw';",
- "GRANT USAGE ON *.* TO 'sqluser'@'%';",
- "GRANT ALL PRIVILEGES ON feedback.* TO 'sqluser'@'%';",
- "FLUSH PRIVILEGES;",
- "USE feedback;",
- "CREATE TABLE COMMENTS (",
- " id INT NOT NULL AUTO_INCREMENT,",
- " MYUSER VARCHAR(30) NOT NULL,",
- " EMAIL VARCHAR(30), ",
- " WEBPAGE VARCHAR(100) NOT NULL,",
- " DATUM DATE NOT NULL, ",
- " SUMMARY VARCHAR(40) NOT NULL,",
- " COMMENTS VARCHAR(400) NOT NULL,",
- " PRIMARY KEY (ID)",
- " );",
- "",
- "INSERT INTO COMMENTS values (default, 'lars', 'myemail@gmail.com','http://www.vogella.de', '2009-09-14 10:33:11', 'Summary','My first comment' );",
- "",
- "CREATE DATABASE items;",
- "GRANT ALL PRIVILEGES ON items.* TO 'sqluser'@'localhost';",
- "GRANT ALL PRIVILEGES ON items.* TO 'sqluser'@'%';",
- "FLUSH PRIVILEGES;",
- "",
- "USE items;",
- "CREATE TABLE INVENTORY (MYUSER VARCHAR(30) NOT NULL);",
- "INSERT INTO INVENTORY values ('lars');",
- "",
- "CREATE DATABASE db_filter_test;",
- "USE db_filter_test;",
- "CREATE TABLE FILTERED (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID));"
- ));
-
- public static void test(TestApplication app, Location location) throws Exception {
- test(app, location, EntitySpec.create(MySqlCluster.class)
- .configure(MySqlCluster.INITIAL_SIZE, 2)
- .configure(MySqlNode.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT)
- .configure(MySqlNode.MYSQL_SERVER_CONF, minimalMemoryConfig()));
- }
-
- public static MutableMap<String, Object> minimalMemoryConfig() {
- // http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html
- return MutableMap.<String, Object>of()
- .add("skip-name-resolve","")
- .add("performance_schema","0")
- .add("innodb_buffer_pool_size","5M")
- .add("innodb_log_buffer_size","256K")
- .add("query_cache_size","0")
- .add("max_connections","10")
- .add("key_buffer_size","8")
- .add("thread_cache_size","0")
- .add("host_cache_size","0")
- .add("innodb_ft_cache_size","1600000")
- .add("innodb_ft_total_cache_size","32000000")
-
- // per thread or per operation settings
- .add("thread_stack","131072")
- .add("sort_buffer_size","32K")
- .add("read_buffer_size","8200")
- .add("read_rnd_buffer_size","8200")
- .add("max_heap_table_size","16K")
- .add("tmp_table_size","1K")
- .add("bulk_insert_buffer_size","0")
- .add("join_buffer_size","128")
- .add("net_buffer_length","1K")
- .add("innodb_sort_buffer_size","64K")
-
- // settings that relate to the binary log (if enabled)
- .add("binlog_cache_size","4K")
- .add("binlog_stmt_cache_size","4K");
- }
-
- public static void testMasterInit(TestApplication app, Location location) throws Exception {
- test(app, location, EntitySpec.create(MySqlCluster.class)
- .configure(MySqlCluster.INITIAL_SIZE, 2)
- .configure(MySqlMaster.MASTER_CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT)
- .configure(MySqlNode.MYSQL_SERVER_CONF, minimalMemoryConfig()));
- }
-
- public static void test(TestApplication app, Location location, EntitySpec<MySqlCluster> clusterSpec) throws Exception {
- MySqlCluster cluster = initCluster(app, location, clusterSpec);
- MySqlNode master = (MySqlNode) cluster.getAttribute(MySqlCluster.FIRST);
- MySqlNode slave = (MySqlNode) Iterables.find(cluster.getMembers(), Predicates.not(Predicates.<Entity>equalTo(master)));
- assertEquals(cluster.getMembers().size(), 2);
- assertEquals(cluster.getAttribute(MySqlCluster.SLAVE_DATASTORE_URL_LIST).size(), 1);
- assertEquals(cluster.getAttribute(MySqlNode.DATASTORE_URL), master.getAttribute(MySqlNode.DATASTORE_URL));
- assertReplication(master, slave);
- }
-
- public static void assertReplication(MySqlNode master, MySqlNode slave, String... notReplicatedSchemas) throws ClassNotFoundException, Exception {
- VogellaExampleAccess masterDb = new VogellaExampleAccess("com.mysql.jdbc.Driver", master.getAttribute(MySqlNode.DATASTORE_URL));
- VogellaExampleAccess slaveDb = new VogellaExampleAccess("com.mysql.jdbc.Driver", slave.getAttribute(MySqlNode.DATASTORE_URL));
- masterDb.connect();
- slaveDb.connect();
-
- assertSlave(masterDb, slaveDb, 1);
- masterDb.modifyDataBase();
- masterDb.execute("items", "INSERT INTO INVENTORY values (?);", "Test");
- assertSlave(masterDb, slaveDb, 2);
- masterDb.revertDatabase();
- masterDb.execute("items", "delete from INVENTORY where myuser= ?;", "Test");
- assertSlave(masterDb, slaveDb, 1);
-
- Set<String> dbSchemas = slaveDb.getSchemas();
- for (String schema : notReplicatedSchemas) {
- assertFalse(dbSchemas.contains(schema), "Database " + schema + " exists on slave");
- }
-
- masterDb.close();
- slaveDb.close();
-
- log.info("Ran vogella MySQL example -- SUCCESS");
- }
-
- public static MySqlCluster initCluster(TestApplication app, Location location, EntitySpec<MySqlCluster> spec) {
- MySqlCluster mysql = app.createAndManageChild(spec);
- app.start(ImmutableList.of(location));
- log.info("MySQL started");
- return mysql;
- }
-
- private static void assertSlave(final VogellaExampleAccess masterDb, final VogellaExampleAccess slaveDb, final int recordCnt) throws Exception {
- Asserts.succeedsEventually(new Runnable() {
- private static final String QUERY = "SELECT C.myuser, webpage, datum, summary, COMMENTS from COMMENTS as C INNER JOIN items.INVENTORY as I ON C.MYUSER=I.MYUSER";
- @Override
- public void run() {
- try {
- List<List<String>> masterResult = masterDb.read(QUERY);
- assertEquals(masterResult.size(), recordCnt);
- assertEquals(masterResult, slaveDb.read(QUERY));
- } catch (Exception e) {
- throw Exceptions.propagate(e);
- }
- }
- });
- }
-
- public static String execSql(MySqlNode node, String cmd) {
- return node.invoke(MySqlNode.EXECUTE_SCRIPT, ImmutableMap.of("commands", cmd)).asTask().getUnchecked();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlIntegrationTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlIntegrationTest.java
deleted file mode 100644
index 139a1e7..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlIntegrationTest.java
+++ /dev/null
@@ -1,105 +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.entity.database.mysql;
-
-import java.io.File;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.os.Os;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.io.Files;
-
-/**
- * Runs a slightly modified version of the popular Vogella MySQL tutorial,
- * from
- * http://www.vogella.de/articles/MySQLJava/article.html
- */
-public class MySqlIntegrationTest extends BrooklynAppLiveTestSupport {
-
- public static final Logger log = LoggerFactory.getLogger(MySqlIntegrationTest.class);
-
- // can start in AWS by running this -- or use brooklyn CLI/REST for most clouds, or programmatic/config for set of fixed IP machines
- static String hostname = Networking.getLocalHost().getHostName();
-
- // From http://www.vogella.de/articles/MySQLJava/article.html
- // Expects COMMENTS to be injected as the test.table.name config value, for VogellaExampleAccess to work.
- public static final String CREATION_SCRIPT = Joiner.on("\n").join(ImmutableList.of(
- "CREATE DATABASE feedback;",
- "CREATE USER 'sqluser'@'localhost' IDENTIFIED BY 'sqluserpw';",
- "GRANT USAGE ON *.* TO 'sqluser'@'localhost';",
- "GRANT ALL PRIVILEGES ON feedback.* TO 'sqluser'@'localhost';",
- "CREATE USER 'sqluser'@'%' IDENTIFIED BY 'sqluserpw';",
- "GRANT USAGE ON *.* TO 'sqluser'@'%';",
- "GRANT ALL PRIVILEGES ON feedback.* TO 'sqluser'@'%';",
- "CREATE USER 'sqluser'@'$hostname' IDENTIFIED BY 'sqluserpw';",
- "GRANT USAGE ON *.* TO 'sqluser'@'$hostname';",
- "GRANT ALL PRIVILEGES ON feedback.* TO 'sqluser'@'$hostname';",
- "FLUSH PRIVILEGES;",
- "USE feedback;",
- "CREATE TABLE ${config['test.table.name']} (",
- " id INT NOT NULL AUTO_INCREMENT,",
- " MYUSER VARCHAR(30) NOT NULL,",
- " EMAIL VARCHAR(30), ",
- " WEBPAGE VARCHAR(100) NOT NULL,",
- " DATUM DATE NOT NULL, ",
- " SUMMARY VARCHAR(40) NOT NULL,",
- " COMMENTS VARCHAR(400) NOT NULL,",
- " PRIMARY KEY (ID)",
- " );",
- "",
- "INSERT INTO ${config['test.table.name']} values (default, 'lars', 'myemail@gmail.com','http://www.vogella.de', '2009-09-14 10:33:11', 'Summary','My first comment' );"
- ));
-
- @Test(groups = {"Integration"})
- public void test_localhost() throws Exception {
- File dataDir = Files.createTempDir();
- try {
- MySqlNode mysql = app.createAndManageChild(EntitySpec.create(MySqlNode.class)
- .configure("mysql.server.conf", MutableMap.of("skip-name-resolve",""))
- .configure("creationScriptContents", CREATION_SCRIPT)
- .configure("dataDir", dataDir.getAbsolutePath())
- .configure("test.table.name", "COMMENTS")); // to ensure creation script is templated
- LocalhostMachineProvisioningLocation location = new LocalhostMachineProvisioningLocation();
-
- app.start(ImmutableList.of(location));;
- log.info("MySQL started");
-
- new VogellaExampleAccess("com.mysql.jdbc.Driver", mysql.getAttribute(MySqlNode.DATASTORE_URL)).readModifyAndRevertDataBase();
-
- log.info("Ran vogella MySQL example -- SUCCESS");
-
- // Ensure the data directory was successfully overridden.
- File mysqlSubdirFile = new File(dataDir, "mysql");
- Assert.assertTrue(mysqlSubdirFile.exists());
- } finally {
- Os.deleteRecursively(dataDir);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveEc2Test.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveEc2Test.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveEc2Test.java
deleted file mode 100644
index c727d2f..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveEc2Test.java
+++ /dev/null
@@ -1,76 +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.entity.database.mysql;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.entity.AbstractEc2LiveTest;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-@Test(groups = { "Live" })
-public class MySqlLiveEc2Test extends AbstractEc2LiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- MySqlNode mysql = app.createAndManageChild(EntitySpec.create(MySqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, MySqlIntegrationTest.CREATION_SCRIPT)
- .configure("test.table.name", "COMMENTS"));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("com.mysql.jdbc.Driver", mysql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Override
- @Test(enabled=false, groups = "Live")
- public void test_Debian_7_2() throws Exception { } // Disabled because MySQl not available
-
- @Test(groups = {"Live"})
- public void testWithOnlyPort22() throws Exception {
- // CentOS-6.3-x86_64-GA-EBS-02-85586466-5b6c-4495-b580-14f72b4bcf51-ami-bb9af1d2.1
- jcloudsLocation = mgmt.getLocationRegistry().resolve(LOCATION_SPEC, ImmutableMap.of(
- "tags", ImmutableList.of(getClass().getName()),
- "imageId", "us-east-1/ami-a96b01c0",
- "hardwareId", SMALL_HARDWARE_ID));
-
- MySqlNode server = app.createAndManageChild(EntitySpec.create(MySqlNode.class)
- .configure(MySqlNode.PROVISIONING_PROPERTIES.subKey(CloudLocationConfig.INBOUND_PORTS.getName()), ImmutableList.of(22)));
-
- app.start(ImmutableList.of(jcloudsLocation));
-
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_UP, true);
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
-
- Integer port = server.getAttribute(MySqlNode.MYSQL_PORT);
- assertNotNull(port);
-
- assertViaSshLocalPortListeningEventually(server, port);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveGceTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveGceTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveGceTest.java
deleted file mode 100644
index 45202a0..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveGceTest.java
+++ /dev/null
@@ -1,48 +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.entity.database.mysql;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.AbstractGoogleComputeLiveTest;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = { "Live" })
-public class MySqlLiveGceTest extends AbstractGoogleComputeLiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- MySqlNode mysql = app.createAndManageChild(EntitySpec.create(MySqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, MySqlIntegrationTest.CREATION_SCRIPT)
- .configure("test.table.name", "COMMENTS"));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("com.mysql.jdbc.Driver", mysql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Test(enabled=false)
- public void testDummy() {} // Convince testng IDE integration that this really does have test methods
-
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveRackspaceTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveRackspaceTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveRackspaceTest.java
deleted file mode 100644
index 46396fd..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlLiveRackspaceTest.java
+++ /dev/null
@@ -1,106 +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.entity.database.mysql;
-
-import java.util.Arrays;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.net.Protocol;
-import org.apache.brooklyn.util.ssh.IptablesCommands;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Chain;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Policy;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * The MySqlLiveTest installs MySQL on various operating systems like Ubuntu, CentOS, Red Hat etc. To make sure that
- * MySQL works like expected on these Operating Systems.
- */
-public class MySqlLiveRackspaceTest extends MySqlIntegrationTest {
- @Test(groups = {"Live"})
- public void test_Debian_6() throws Exception {
- test("Debian 6");
- }
-
- @Test(groups = {"Live"})
- public void test_Ubuntu_10_0() throws Exception {
- test("Ubuntu 10.0");
- }
-
- @Test(groups = {"Live", "Live-sanity"})
- public void test_Ubuntu_12_0() throws Exception {
- test("Ubuntu 12.0");
- }
-
- @Test(groups = {"Live"})
- public void test_Ubuntu_13() throws Exception {
- test("Ubuntu 13");
- }
-
- @Test(groups = {"Live"})
- public void test_CentOS_6() throws Exception {
- test("CentOS 6");
- }
-
- @Test(groups = {"Live"})
- public void test_CentOS_5() throws Exception {
- test("CentOS 5");
- }
-
- @Test(groups = {"Live"})
- public void test_Fedora() throws Exception {
- test("Fedora ");
- }
-
- @Test(groups = {"Live"})
- public void test_Red_Hat_Enterprise_Linux_6() throws Exception {
- test("Red Hat Enterprise Linux 6");
- }
-
- @Test(enabled=false, groups = {"Live"}) // only run this in MySqlIntegrationTest
- public void test_localhost() throws Exception {
- super.test_localhost();
- }
-
- 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().resolve("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();
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
deleted file mode 100644
index 1e2aa91..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
+++ /dev/null
@@ -1,50 +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.entity.database.mysql;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessRestartIntegrationTest;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-/**
- * Tests restart of the software *process* (as opposed to the VM).
- */
-@Test(groups="Integration")
-public class MySqlRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(MySqlRestartIntegrationTest.class);
-
- @Override
- protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
- return EntitySpec.create(MySqlNode.class);
- }
-
- //Fails setting the password on second start (because already changed from first launch)
- @Override
- @Test(groups={"Integration","Broken"})
- public void testStopProcessAndStart() throws Exception {
- super.testStopProcessAndStart();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MysqlDockerLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MysqlDockerLiveTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MysqlDockerLiveTest.java
deleted file mode 100644
index f8a285c..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/mysql/MysqlDockerLiveTest.java
+++ /dev/null
@@ -1,48 +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.entity.database.mysql;
-
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.entity.software.base.AbstractDockerLiveTest;
-
-import com.google.common.collect.ImmutableList;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.testng.annotations.Test;
-
-public class MysqlDockerLiveTest extends AbstractDockerLiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- MySqlNode mysql = app.createAndManageChild(EntitySpec.create(MySqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, MySqlIntegrationTest.CREATION_SCRIPT)
- .configure("test.table.name", "COMMENTS"));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("com.mysql.jdbc.Driver", mysql.getAttribute(DatastoreCommon.DATASTORE_URL))
- .readModifyAndRevertDataBase();
- }
-
- @Test(enabled=false)
- public void testDummy() { } // Convince testng IDE integration that this really does have test methods
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqDockerLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqDockerLiveTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqDockerLiveTest.java
deleted file mode 100644
index 7ba4ec8..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqDockerLiveTest.java
+++ /dev/null
@@ -1,46 +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.entity.database.postgresql;
-
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.entity.software.base.AbstractDockerLiveTest;
-
-import com.google.common.collect.ImmutableList;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.testng.annotations.Test;
-
-public class PostgreSqDockerLiveTest extends AbstractDockerLiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- PostgreSqlNode psql = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("org.postgresql.Driver", psql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Test(enabled=false)
- public void testDummy() { } // Convince testng IDE integration that this really does have test methods
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlChefTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlChefTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlChefTest.java
deleted file mode 100644
index 6f1d014..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlChefTest.java
+++ /dev/null
@@ -1,102 +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.entity.database.postgresql;
-
-import java.util.Random;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.chef.ChefLiveTestSupport;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.api.location.PortRange;
-import org.apache.brooklyn.core.effector.EffectorTasks;
-import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Tests Chef installation of PostgreSql. Requires chef-server (knife).
- * <p>
- * To be able to run repeatedly on the same box, you will need the patched version of the postgresql library,
- * at https://github.com/opscode-cookbooks/postgresql/pull/73 .
- *
- * @author alex
- *
- */
-public class PostgreSqlChefTest extends ChefLiveTestSupport {
-
- private static final Logger log = LoggerFactory.getLogger(PostgreSqlChefTest.class);
-
- PostgreSqlNode psql;
-
- @Test(groups="Live")
- public void testPostgresStartsAndStops() throws Exception {
- ChefLiveTestSupport.installBrooklynChefHostedConfig(app);
- psql = app.createAndManageChild(PostgreSqlSpecs.specChef());
-
- app.start(ImmutableList.of(targetLocation));
-
- Entities.submit(psql, SshEffectorTasks.ssh("ps aux | grep [p]ostgres").requiringExitCodeZero());
- SshMachineLocation targetMachine = EffectorTasks.getSshMachine(psql);
-
- psql.stop();
-
- try {
- // if host is still contactable ensure postgres is not running
- ProcessTaskWrapper<Integer> t = Entities.submit(app, SshEffectorTasks.ssh("ps aux | grep [p]ostgres").machine(targetMachine).allowingNonZeroExitCode());
- t.getTask().blockUntilEnded(Duration.TEN_SECONDS);
- if (!t.isDone())
- Assert.fail("Task not finished yet: "+t.getTask());
- Assert.assertNotEquals(t.get(), (Integer)0, "Task ended with code "+t.get()+"; output: "+t.getStdout() );
- } catch (Exception e) {
- // host has been killed, that is fine
- log.info("Machine "+targetMachine+" destroyed on stop (expected - "+e+")");
- }
- }
-
- @Test(groups="Live")
- public void testPostgresScriptAndAccess() throws Exception {
- ChefLiveTestSupport.installBrooklynChefHostedConfig(app);
- PortRange randomPort = PortRanges.fromString(String.format("%d+", 5420 + new Random().nextInt(10)));
- psql = app.createAndManageChild(PostgreSqlSpecs.specChef()
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT)
- .configure(PostgreSqlNode.POSTGRESQL_PORT, randomPort)
- .configure(PostgreSqlNode.SHARED_MEMORY, "8MB")
- );
-
- app.start(ImmutableList.of(targetLocation));
-
- String url = psql.getAttribute(DatastoreCommon.DATASTORE_URL);
- log.info("Trying to connect to "+psql+" at "+url);
- Assert.assertNotNull(url);
- Assert.assertTrue(url.contains("542"));
-
- new VogellaExampleAccess("org.postgresql.Driver", url).readModifyAndRevertDataBase();
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlEc2LiveTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlEc2LiveTest.java
deleted file mode 100644
index 2d18561..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlEc2LiveTest.java
+++ /dev/null
@@ -1,78 +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.entity.database.postgresql;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.entity.AbstractEc2LiveTest;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class PostgreSqlEc2LiveTest extends AbstractEc2LiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- PostgreSqlNode psql = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("org.postgresql.Driver", psql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Override
- @Test(enabled=false, groups = "Live")
- public void test_Debian_6() throws Exception { } // Disabled because PostgreSql 9.1 not available
-
- @Override
- @Test(enabled=false, groups = "Live")
- public void test_Ubuntu_10_0() throws Exception { } // Disabled because PostgreSql 9.1 not available
-
- @Test(groups = {"Live"})
- public void testWithOnlyPort22() throws Exception {
- // CentOS-6.3-x86_64-GA-EBS-02-85586466-5b6c-4495-b580-14f72b4bcf51-ami-bb9af1d2.1
- jcloudsLocation = mgmt.getLocationRegistry().resolve(LOCATION_SPEC, ImmutableMap.of(
- "tags", ImmutableList.of(getClass().getName()),
- "imageId", "us-east-1/ami-a96b01c0",
- "hardwareId", SMALL_HARDWARE_ID));
-
- PostgreSqlNode server = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(PostgreSqlNode.PROVISIONING_PROPERTIES.subKey(CloudLocationConfig.INBOUND_PORTS.getName()), ImmutableList.of(22)));
-
- app.start(ImmutableList.of(jcloudsLocation));
-
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_UP, true);
- EntityAsserts.assertAttributeEqualsEventually(server, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
-
- Integer port = server.getAttribute(PostgreSqlNode.POSTGRESQL_PORT);
- assertNotNull(port);
-
- assertViaSshLocalPortListeningEventually(server, port);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlGceLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlGceLiveTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlGceLiveTest.java
deleted file mode 100644
index d6dbb45..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlGceLiveTest.java
+++ /dev/null
@@ -1,45 +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.entity.database.postgresql;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.AbstractGoogleComputeLiveTest;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-
-import com.google.common.collect.ImmutableList;
-
-public class PostgreSqlGceLiveTest extends AbstractGoogleComputeLiveTest {
-
- @Override
- protected void doTest(Location loc) throws Exception {
- PostgreSqlNode psql = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, PostgreSqlIntegrationTest.CREATION_SCRIPT));
-
- app.start(ImmutableList.of(loc));
-
- new VogellaExampleAccess("org.postgresql.Driver", psql.getAttribute(DatastoreCommon.DATASTORE_URL)).readModifyAndRevertDataBase();
- }
-
- @Test(enabled=false)
- public void testDummy() { } // Convince testng IDE integration that this really does have test methods
-}
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlIntegrationTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlIntegrationTest.java
deleted file mode 100644
index 2cfe531..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlIntegrationTest.java
+++ /dev/null
@@ -1,95 +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.entity.database.postgresql;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Runs the popular Vogella MySQL tutorial against PostgreSQL
- * from
- * http://www.vogella.de/articles/MySQLJava/article.html
- */
-public class PostgreSqlIntegrationTest {
-
- public static final Logger log = LoggerFactory.getLogger(PostgreSqlIntegrationTest.class);
-
- protected BrooklynProperties brooklynProperties;
- protected ManagementContext managementContext;
- protected TestApplication tapp;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() {
- brooklynProperties = BrooklynProperties.Factory.newDefault();
- managementContext = new LocalManagementContext(brooklynProperties);
- tapp = ApplicationBuilder.newManagedApp(TestApplication.class, managementContext);
- }
-
- @AfterMethod(alwaysRun = true)
- public void ensureShutDown() {
- Entities.destroyAllCatching(managementContext);
- }
-
- //from http://www.vogella.de/articles/MySQLJava/article.html
- public static final String CREATION_SCRIPT =
- "CREATE USER sqluser WITH PASSWORD 'sqluserpw';\n" +
- "CREATE DATABASE feedback OWNER sqluser;\n" +
- "\\c feedback;\n" +
- "CREATE TABLE COMMENTS ( " +
- "id INT8 NOT NULL, " +
- "MYUSER VARCHAR(30) NOT NULL, " +
- "EMAIL VARCHAR(30), " +
- "WEBPAGE VARCHAR(100) NOT NULL, " +
- "DATUM DATE NOT NULL, " +
- "SUMMARY VARCHAR(40) NOT NULL, " +
- "COMMENTS VARCHAR(400) NOT NULL, " +
- "PRIMARY KEY (ID) " +
- ");\n" +
- "GRANT ALL ON comments TO sqluser;\n" +
- "INSERT INTO COMMENTS values (1, 'lars', 'myemail@gmail.com','http://www.vogella.de', '2009-09-14 10:33:11', 'Summary','My first comment' );";
-
- @Test(groups = "Integration")
- public void test_localhost() throws Exception {
- PostgreSqlNode pgsql = tapp.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT)
- .configure(PostgreSqlNode.MAX_CONNECTIONS, 10)
- .configure(PostgreSqlNode.SHARED_MEMORY, "512kB")); // Very low so kernel configuration not needed
-
- tapp.start(ImmutableList.of(new LocalhostMachineProvisioningLocation()));
- String url = pgsql.getAttribute(DatastoreCommon.DATASTORE_URL);
- log.info("PostgreSql started on "+url);
- new VogellaExampleAccess("org.postgresql.Driver", url).readModifyAndRevertDataBase();
- log.info("Ran vogella PostgreSql example -- SUCCESS");
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRackspaceLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRackspaceLiveTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRackspaceLiveTest.java
deleted file mode 100644
index 0e3489e..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRackspaceLiveTest.java
+++ /dev/null
@@ -1,107 +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.entity.database.postgresql;
-
-import java.util.Arrays;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
-import org.apache.brooklyn.entity.database.VogellaExampleAccess;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.net.Protocol;
-import org.apache.brooklyn.util.ssh.IptablesCommands;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Chain;
-import org.apache.brooklyn.util.ssh.IptablesCommands.Policy;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * The PostgreSqlRackspaceLiveTest installs Postgresql on various operating systems like Ubuntu, CentOS, Red Hat etc. To
- * make sure that PostgreSql works like expected on these Operating Systems.
- */
-public class PostgreSqlRackspaceLiveTest extends PostgreSqlIntegrationTest {
- @Test(groups = "Live")
- public void test_Debian_6() throws Exception {
- test("Debian 6");
- }
-
- @Test(groups = "Live")
- public void test_Ubuntu_10_0() throws Exception {
- test("Ubuntu 10.0");
- }
-
- @Test(groups = "Live")
- public void test_Ubuntu_11_0() throws Exception {
- test("Ubuntu 11.0");
- }
-
- @Test(groups = "Live")
- public void test_Ubuntu_12_0() throws Exception {
- test("Ubuntu 12.0");
- }
-
- @Test(groups = "Live")
- public void test_CentOS_6_0() throws Exception {
- test("CentOS 6.0");
- }
-
- @Test(groups = "Live")
- public void test_CentOS_5_6() throws Exception {
- test("CentOS 5.6");
- }
-
- @Test(groups = "Live")
- public void test_Fedora_17() throws Exception {
- test("Fedora 17");
- }
-
- @Test(groups = "Live")
- public void test_Red_Hat_Enterprise_Linux_6() throws Exception {
- test("Red Hat Enterprise Linux 6");
- }
-
- @Test(groups = "Live")
- public void test_localhost() throws Exception {
- super.test_localhost();
- }
-
- public void test(String osRegex) throws Exception {
- PostgreSqlNode psql = tapp.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure(DatastoreCommon.CREATION_SCRIPT_CONTENTS, CREATION_SCRIPT)
- .configure(PostgreSqlNode.POSTGRESQL_PORT, PortRanges.fromInteger(5432))
- .configure(PostgreSqlNode.SHARED_MEMORY, "32MB"));
-
- 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, 5432));
- JcloudsLocation jcloudsLocation = (JcloudsLocation) managementContext.getLocationRegistry().resolve("jclouds:rackspace-cloudservers-uk");
-
- tapp.start(ImmutableList.of(jcloudsLocation));
-
- SshMachineLocation l = (SshMachineLocation) psql.getLocations().iterator().next();
- l.execCommands("add iptables rule", ImmutableList.of(IptablesCommands.insertIptablesRule(Chain.INPUT, Protocol.TCP, 5432, Policy.ACCEPT)));
-
- String url = psql.getAttribute(DatastoreCommon.DATASTORE_URL);
- new VogellaExampleAccess("org.postgresql.Driver", url).readModifyAndRevertDataBase();
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java b/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
deleted file mode 100644
index 320c14b..0000000
--- a/brooklyn-library/software/database/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
+++ /dev/null
@@ -1,57 +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.entity.database.postgresql;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class PostgreSqlRebindIntegrationTest extends RebindTestFixtureWithApp {
-
- private LocalhostMachineProvisioningLocation loc;
-
- @BeforeMethod(alwaysRun=true)
- @Override
- public void setUp() throws Exception {
- super.setUp();
- loc = origApp.newLocalhostProvisioningLocation();
- }
-
- @Test(groups = {"Integration"})
- public void testRebind() throws Exception {
- origApp.createAndManageChild(EntitySpec.create(PostgreSqlNode.class));
- origApp.start(ImmutableList.of(loc));
-
- // rebind
- rebind();
- final PostgreSqlNode newEntity = (PostgreSqlNode) Iterables.find(newApp.getChildren(), Predicates.instanceOf(PostgreSqlNode.class));
-
- // confirm effectors still work on entity
- EntityTestUtils.assertAttributeEqualsEventually(newEntity, PostgreSqlNode.SERVICE_UP, true);
- newEntity.stop();
- EntityTestUtils.assertAttributeEqualsEventually(newEntity, PostgreSqlNode.SERVICE_UP, false);
- }
-}