Skip to content

Commit

Permalink
Merge pull request #1331 from andreaturli/test/mongodb
Browse files Browse the repository at this point in the history
add MongoDbSoftLayerLiveTest
  • Loading branch information
brooklyn-images committed Apr 24, 2014
2 parents debc793 + 9e1f31c commit 9ff9db8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package brooklyn.entity;

import java.util.List;
import java.util.Map;

import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import brooklyn.config.BrooklynProperties;
import brooklyn.entity.basic.ApplicationBuilder;
import brooklyn.entity.basic.Entities;
Expand All @@ -8,15 +19,6 @@
import brooklyn.management.internal.LocalManagementContext;
import brooklyn.test.entity.TestApplication;
import brooklyn.util.collections.MutableMap;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.List;
import java.util.Map;

/**
* Runs a test with many different distros and versions.
Expand Down Expand Up @@ -72,7 +74,7 @@ public void test_Ubuntu_12_0_4() throws Exception {
@Test(groups = {"Live"})
public void test_Centos_6_0() throws Exception {
// Image: {id=CENTOS_6_64, providerId=CENTOS_6_64, os={family=centos, version=6.5, description=CentOS / CentOS / 6.5-64 LAMP for Bare Metal, is64Bit=true}, description=CENTOS_6_64, status=AVAILABLE, loginUser=root}
runTest(ImmutableMap.<String,Object>of("imageId", "CENTOS_^_64"));
runTest(ImmutableMap.<String,Object>of("imageId", "CENTOS_6_64"));
}

protected void runTest(Map<String,?> flags) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package brooklyn.entity.nosql.mongodb;

import static org.testng.Assert.assertEquals;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import com.google.common.collect.ImmutableList;
import com.mongodb.DBObject;

import brooklyn.entity.AbstractSoftlayerLiveTest;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.location.Location;
import brooklyn.test.EntityTestUtils;

public class MongoDBSoftLayerLiveTest extends AbstractSoftlayerLiveTest {

@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(MongoDBSoftLayerLiveTest.class);

@Override
protected void doTest(Location loc) throws Exception {
MongoDBServer entity = app.createAndManageChild(EntitySpec.create(MongoDBServer.class)
.configure("mongodbConfTemplateUrl", "classpath:///test-mongodb.conf"));
app.start(ImmutableList.of(loc));

EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_UP, true);

String id = MongoDBTestHelper.insert(entity, "hello", "world!");
DBObject docOut = MongoDBTestHelper.getById(entity, id);
assertEquals(docOut.get("hello"), "world!");
}

@Test(enabled=false)
public void testDummy() {} // Convince TestNG IDE integration that this really does have test methods

}

0 comments on commit 9ff9db8

Please sign in to comment.