diff --git a/org.ektorp/src/test/java/org/ektorp/http/BulkTest.java b/org.ektorp/src/test/java/org/ektorp/http/BulkIT.java similarity index 90% rename from org.ektorp/src/test/java/org/ektorp/http/BulkTest.java rename to org.ektorp/src/test/java/org/ektorp/http/BulkIT.java index 10eb2881..f0c9844d 100644 --- a/org.ektorp/src/test/java/org/ektorp/http/BulkTest.java +++ b/org.ektorp/src/test/java/org/ektorp/http/BulkIT.java @@ -11,10 +11,7 @@ import org.ektorp.impl.StdObjectMapperFactory; import org.ektorp.impl.StreamedCouchDbConnector; import org.ektorp.support.CouchDbDocument; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,10 +47,9 @@ at org.ektorp.http.StdHttpClient.executeRequest(StdHttpClient.java:96) ... 5 more */ -@Ignore -public class BulkTest { +public class BulkIT { - private final static Logger LOG = LoggerFactory.getLogger(StdCouchDbInstance.class); + private final static Logger LOG = LoggerFactory.getLogger(BulkIT.class); private HttpClient httpClient; @@ -67,7 +63,7 @@ public class BulkTest { private boolean createDatabaseIfNeeded = true; - private boolean deleteDatabaseIfNeeded = false; + private boolean deleteDatabaseIfNeeded = true; @Before public void setUp() { @@ -165,7 +161,7 @@ public void shouldUpdateInBulkWithManyElementsWithStreamedCouchDbConnector() thr } public void doUpdateInBulkWithOneElement(CouchDbConnector db) throws Exception { - final int iterationsCount = 100; + final int iterationsCount = 10; // create document "myid" try { @@ -192,8 +188,8 @@ public void doUpdateInBulkWithOneElement(CouchDbConnector db) throws Exception { public void doUpdateInBulkWithManyElements(CouchDbConnector db) { - final int iterationsCount = 20; - final int elementsCount = 200; + final int iterationsCount = 10; + final int elementsCount = 20; final List allDocIds = new ArrayList(); @@ -240,11 +236,12 @@ public void doUpdateInBulkWithManyElements(CouchDbConnector db) { List docList = db.queryView(q, TestDocumentBean.class); for (TestDocumentBean b : docList) { + Assert.assertNotNull(b.firstName); + Assert.assertNotNull(b.getLastName()); + Assert.assertNotNull(b.dateOfBirth); // check version is as expected - if (b.version != i - 1) { - throw new IllegalStateException("Bean state is not as expected : " + b); - } - b.version = i; + Assert.assertEquals("Bean state is not as expected", i - 1, b.getVersion()); + b.setVersion(i); } long bulkOpStart = System.currentTimeMillis(); @@ -258,7 +255,7 @@ public void doUpdateInBulkWithManyElements(CouchDbConnector db) { List docList = db.queryView(q, TestDocumentBean.class); for (TestDocumentBean b : docList) { // check version is as expected - if (b.version != iterationsCount) { + if (b.getVersion() != iterationsCount) { throw new IllegalStateException("Bean state is not as expected : " + b); } } @@ -268,7 +265,7 @@ public void doUpdateInBulkWithManyElements(CouchDbConnector db) { } public void doUpdateInBulkWithOneSmallInputStream(CouchDbConnector db) throws Exception { - final int iterationsCount = 100; + final int iterationsCount = 10; // create or update the document, with initial "i" value of 0 final String id = "myid"; @@ -317,7 +314,7 @@ public static class TestDocumentBean extends CouchDbDocument { private String lastName; private String firstName; private Long dateOfBirth; - private int version; + private int version = -1; public TestDocumentBean() { @@ -329,6 +326,38 @@ public TestDocumentBean(String lastName, String firstName, Long dateOfBirth, int this.dateOfBirth = dateOfBirth; this.version = version; } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Long getDateOfBirth() { + return dateOfBirth; + } + + public void setDateOfBirth(Long dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } } } diff --git a/pom.xml b/pom.xml index 51655f8f..f174656c 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,10 @@ false false + + true + jacoco + ${project.basedir}/../target/jacoco-it.exec @@ -149,6 +153,25 @@ findbugs-maven-plugin 2.5.3 + + org.apache.maven.plugins + maven-failsafe-plugin + 2.16 + + ${jacoco.agent.argLine} + + **/*IT.java + + + + + + integration-test + verify + + + + @@ -210,6 +233,23 @@ + + maven-failsafe-plugin + + ${skipITs} + + ${project.build.directory}/surefire-reports + ${jacoco.agent.argLine} + + + + + integration-test + verify + + + + @@ -293,5 +333,60 @@ 2.1 + + + + sonar + + + + false + + + + + + + org.jacoco + jacoco-maven-plugin + + jacoco.agent.argLine + + + org/ektorp/** + + ${project.build.directory}/jacoco-integration.exec + + ${project.build.directory}/jacoco-integration.exec + + + + + agent + + prepare-agent + + + + + report + site + + report + + + + + + + +