mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-3720] Remove all traces of ContiPerf.
This commit is contained in:
@@ -199,7 +199,6 @@ https://wiki.duraspace.org/display/DSPACE/Code+Contribution+Guidelines
|
||||
* Woodstox (org.codehaus.woodstox:woodstox-core-asl:4.1.4 - http://woodstox.codehaus.org)
|
||||
* Woodstox (org.codehaus.woodstox:wstx-asl:3.2.0 - http://woodstox.codehaus.org)
|
||||
* Woodstox (org.codehaus.woodstox:wstx-asl:3.2.7 - http://woodstox.codehaus.org)
|
||||
* databene ContiPerf (org.databene:contiperf:2.3.4 - http://databene.org/contiperf)
|
||||
* flyway-core (org.flywaydb:flyway-core:4.0.3 - https://flywaydb.org/flyway-core)
|
||||
* Ogg and Vorbis for Java, Core (org.gagravarr:vorbis-java-core:0.1 - https://github.com/Gagravarr/VorbisJava)
|
||||
* Apache Tika plugin for Ogg, Vorbis and FLAC (org.gagravarr:vorbis-java-tika:0.1 - https://github.com/Gagravarr/VorbisJava)
|
||||
|
@@ -500,11 +500,6 @@
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.databene</groupId>
|
||||
<artifactId>contiperf</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
|
@@ -1,118 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.databene.contiperf.junit;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.junit.internal.runners.statements.RunAfters;
|
||||
import org.junit.internal.runners.statements.RunBefores;
|
||||
import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
/**
|
||||
* That is just a workaround to support JUnit 4.12 with the ContiPerfRule.
|
||||
* This performance rule extension makes sure that each statement is wrapped into
|
||||
* the JUnit 4.11 format.
|
||||
*
|
||||
* <p>
|
||||
* From JUnit 4.12, the {@code fNext} field has been replaced with the
|
||||
* {@code next} field on both {@code RunAfters} and {@code RunBefores}
|
||||
* statements. This class is for handling both cases gracefully.
|
||||
* <p>
|
||||
* More details about the issue can be found
|
||||
* <a href="https://github.com/lucaspouzac/contiperf/issues/9">here</a>.
|
||||
*
|
||||
* The lastest ContiPerf release fixes this, but is not available in the Maven repositories:
|
||||
* <a href="https://github.com/lucaspouzac/contiperf/issues/8">https://github.com/lucaspouzac/contiperf/issues/8</a>
|
||||
*
|
||||
*/
|
||||
public class ContiPerfRuleExt extends ContiPerfRule {
|
||||
|
||||
private static final String FIELD_NAME_JUNIT_411 = "fNext";
|
||||
private static final String FIELD_NAME_JUNIT_412 = "next";
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, FrameworkMethod method, Object target) {
|
||||
return super.apply(wrapStatement(base), method, target);
|
||||
}
|
||||
|
||||
private Statement wrapStatement(final Statement base) {
|
||||
if(requiresFieldMapping(base)) {
|
||||
Statement fnext = getFieldValue(FIELD_NAME_JUNIT_412, base);
|
||||
if (base instanceof RunAfters) {
|
||||
return new RunAfters_411((RunAfters) base, fnext);
|
||||
} else if(base instanceof RunBefores) {
|
||||
return new RunBefores_411((RunBefores) base, fnext);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
private Statement getFieldValue(final String fieldNameJunit412, final Statement base) {
|
||||
try {
|
||||
Field field = base.getClass().getDeclaredField(fieldNameJunit412);
|
||||
return (Statement) field.get(base);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
//ignore
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean requiresFieldMapping(Statement it) {
|
||||
return hasField(it, FIELD_NAME_JUNIT_412) && !hasField(it, FIELD_NAME_JUNIT_411);
|
||||
}
|
||||
|
||||
private boolean hasField(Statement it, String fieldName) {
|
||||
try {
|
||||
it.getClass().getDeclaredField(fieldName);
|
||||
return true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
//ignore
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class RunBefores_411 extends RunBefores {
|
||||
|
||||
private Statement delegate;
|
||||
private Statement fNext;
|
||||
|
||||
private RunBefores_411(RunBefores delegate, Statement fNext) {
|
||||
// We delegate to the evaluate method anyway.
|
||||
super(null, null, null);
|
||||
this.delegate = delegate;
|
||||
this.fNext = fNext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
delegate.evaluate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class RunAfters_411 extends RunAfters {
|
||||
|
||||
private Statement delegate;
|
||||
private Statement fNext;
|
||||
|
||||
private RunAfters_411(RunAfters delegate, Statement fNext) {
|
||||
// We delegate to the evaluate method anyway.
|
||||
super(null, null, null);
|
||||
this.delegate = delegate;
|
||||
this.fNext = fNext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
delegate.evaluate();
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,10 +7,7 @@
|
||||
*/
|
||||
package org.dspace;
|
||||
|
||||
import org.databene.contiperf.junit.ContiPerfRule;
|
||||
import org.databene.contiperf.junit.ContiPerfRuleExt;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
|
||||
/**
|
||||
* This is the base class for Integration Tests. It inherits from the class
|
||||
@@ -25,9 +22,5 @@ import org.junit.Rule;
|
||||
@Ignore
|
||||
public class AbstractIntegrationTest extends AbstractUnitTest
|
||||
{
|
||||
|
||||
//We only enable contiperf in the integration tests, as it doesn't
|
||||
//seem so useful to run them in isolated unit tests
|
||||
@Rule
|
||||
public ContiPerfRule contiperfRules = new ContiPerfRuleExt();
|
||||
// This class intentionally left blank.
|
||||
}
|
||||
|
@@ -8,8 +8,6 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.databene.contiperf.PerfTest;
|
||||
import org.databene.contiperf.Required;
|
||||
import org.dspace.AbstractIntegrationTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
@@ -36,11 +34,7 @@ import static org.junit.Assert.assertTrue;
|
||||
/**
|
||||
* This is an integration test to ensure collections and communities interact properly.
|
||||
*
|
||||
* The code below is attached as an example. Performance checks by ContiPerf
|
||||
* can be applied at method level or at class level. This shows the syntax
|
||||
* for class-level checks.
|
||||
* @PerfTest(invocations = 1000, threads = 20)
|
||||
* @Required(max = 1200, average = 250)
|
||||
* The code below is attached as an example.
|
||||
*
|
||||
* @author pvillega
|
||||
* @author tdonohue
|
||||
@@ -91,8 +85,6 @@ public class ITCommunityCollection extends AbstractIntegrationTest
|
||||
* Tests the creation of a community collection tree
|
||||
*/
|
||||
@Test
|
||||
@PerfTest(invocations = 25, threads = 1)
|
||||
@Required(percentile95 = 1200, average = 700, throughput = 1)
|
||||
public void testCreateTree() throws SQLException, AuthorizeException, IOException {
|
||||
//we create the structure
|
||||
context.turnOffAuthorisationSystem();
|
||||
@@ -118,8 +110,6 @@ public class ITCommunityCollection extends AbstractIntegrationTest
|
||||
* Tests the creation of items in a community/collection tree
|
||||
*/
|
||||
@Test
|
||||
@PerfTest(invocations = 25, threads = 1)
|
||||
@Required(percentile95 = 1200, average = 700, throughput = 1)
|
||||
public void testCreateItems() throws SQLException, AuthorizeException, IOException {
|
||||
//we create the structure
|
||||
context.turnOffAuthorisationSystem();
|
||||
@@ -147,8 +137,6 @@ public class ITCommunityCollection extends AbstractIntegrationTest
|
||||
* NOTE: Counts are currently expensive (take a while)
|
||||
*/
|
||||
@Test
|
||||
@PerfTest(invocations = 10, threads = 1)
|
||||
@Required(percentile95 = 2000, average= 1800)
|
||||
public void testCountItems() throws SQLException, AuthorizeException, IOException {
|
||||
int items_per_collection = 2;
|
||||
|
||||
|
@@ -8,8 +8,6 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.databene.contiperf.PerfTest;
|
||||
import org.databene.contiperf.Required;
|
||||
import org.dspace.AbstractIntegrationTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
@@ -75,8 +73,6 @@ public class ITMetadata extends AbstractIntegrationTest
|
||||
* Tests the creation of a new metadata schema with some values
|
||||
*/
|
||||
@Test
|
||||
@PerfTest(invocations = 50, threads = 1)
|
||||
@Required(percentile95 = 500, average= 200)
|
||||
public void testCreateSchema() throws SQLException, AuthorizeException, NonUniqueMetadataException, IOException
|
||||
{
|
||||
String schemaName = "integration";
|
||||
|
@@ -309,11 +309,6 @@
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.databene</groupId>
|
||||
<artifactId>contiperf</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
@@ -346,4 +341,4 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
7
pom.xml
7
pom.xml
@@ -1369,13 +1369,6 @@
|
||||
<version>1.4.187</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Contiperf is used for performance tests within our Unit/Integration tests -->
|
||||
<dependency>
|
||||
<groupId>org.databene</groupId>
|
||||
<artifactId>contiperf</artifactId>
|
||||
<version>2.3.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
Reference in New Issue
Block a user