Skip to content

Commit

Permalink
HPCC4J-555 Provide Test jar (hpcc-systems#661)
Browse files Browse the repository at this point in the history
- Moved BaseRemoteTests into testing dir
- Added TestResultNotifier to record test failures
- Updated POMs to use and generate test-jar

Signed-off-by: James McMullan [email protected]

Signed-off-by: James McMullan [email protected]
# Conflicts:
#	wsclient/src/test/java/org/hpccsystems/ws/client/BaseRemoteTest.java
#	wsclient/src/test/java/org/hpccsystems/ws/client/WsClientTest.java
  • Loading branch information
Pastrana authored and Pastrana committed Dec 7, 2023
1 parent e0f31ef commit ab1e783
Show file tree
Hide file tree
Showing 31 changed files with 2,636 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/javadocTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
run: mvn -B -Dmaven.test.skip=True clean install javadoc:javadoc
run: mvn -B clean install javadoc:javadoc
17 changes: 16 additions & 1 deletion dfsclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,20 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.hpccsystems.ws.client.TestResultNotifier</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>${codehaus.template.version}</version>
</plugin>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -83,6 +91,13 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hpccsystems</groupId>
<artifactId>wsclient</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
import org.hpccsystems.dfs.client.HPCCRecord;
import org.hpccsystems.dfs.client.HPCCRecordBuilder;
import org.hpccsystems.dfs.client.HpccRemoteFileReader;
import org.hpccsystems.ws.client.BaseRemoteTest;
import org.hpccsystems.dfs.client.DataPartition;

import org.hpccsystems.commons.ecl.FieldDef;
import org.hpccsystems.commons.errors.HpccFileException;
import org.hpccsystems.ws.client.platform.test.BaseRemoteTest;

import org.json.JSONObject;
import org.json.JSONArray;

Expand Down Expand Up @@ -86,7 +85,7 @@ public void readBenchmarks() throws Exception
{
System.out.println("Starting Raw Read Tests");
System.out.println("-------------------------------------------------------------");

MetricSumTransformer sumTransformer = new MetricSumTransformer();
MetricAverageTransformer aggregateTransformer = new MetricAverageTransformer();
ArrayList<BenchmarkResult> rawReadTests = new ArrayList<BenchmarkResult>();
Expand Down Expand Up @@ -128,7 +127,7 @@ public void readBenchmarks() throws Exception
}
avgdMetrics = aggregateTransformer.transform(avgdMetrics);
result.addMetrics(avgdMetrics);

// Calculate and add bandwidth
IMetric readTimeMetric = result.getMetric(READ_TIME_METRIC);
double avgReadTime = readTimeMetric.getValue() * Units.calculateScaleConversion(readTimeMetric.getUnits().scale,Units.Scale.UNIT);
Expand Down Expand Up @@ -174,7 +173,7 @@ public void readBenchmarks() throws Exception

metrics = sumTransformer.transform(metrics);
metrics.add(new SimpleMetric((double)readTimeNS, READ_TIME_METRIC, new Units(Units.Type.SECONDS, Units.Scale.NANO)));

avgdMetrics.addAll(metrics);
}
catch(Exception e)
Expand Down Expand Up @@ -203,7 +202,7 @@ public void readBenchmarks() throws Exception

// Output plugin results
JSONArray testGroups = new JSONArray();

JSONObject rawReadGroup = new JSONObject();
rawReadGroup.put("name","Raw Read Tests");

Expand All @@ -230,7 +229,7 @@ public void readBenchmarks() throws Exception

JSONObject output = new JSONObject();
output.put("groups",testGroups);

String outputPath = "results.json";
FileWriter fileWriter = new FileWriter(outputPath);
fileWriter.write(output.toString());
Expand Down Expand Up @@ -302,7 +301,7 @@ public void readRawFileData(HPCCFile file, List<IMetric> metrics) throws Excepti
{
bytesToRead = buffer.length;
}
inputStream.read(buffer,0,bytesToRead);
inputStream.read(buffer,0,bytesToRead);

try
{
Expand All @@ -322,7 +321,7 @@ public void readRawFileData(HPCCFile file, List<IMetric> metrics) throws Excepti
hasMoreData = nextByte >= 0;
}
}

metrics.addAll(inputStream.getMetrics());
inputStream.close();
}
Expand Down Expand Up @@ -434,7 +433,7 @@ public int readFileInParallel(HPCCFile file, int numThreads) throws Exception
Integer filePartRecordCount = 0;
FieldDef recordDefinition = originalRD;
public void run()
{
{
HpccRemoteFileReader<HPCCRecord> fileReader = null;
try
{
Expand All @@ -459,14 +458,14 @@ public void run()
{
Assert.fail("Received null record during read");
}

filePartRecordCount++;
}

recordCounts[filePartIndex] = filePartRecordCount;
try
{
fileReader.close();
fileReader.close();
}
catch (Exception e){}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.hpccsystems.commons.ecl.FileFilter;
import org.hpccsystems.commons.errors.HpccFileException;
import org.hpccsystems.dfs.cluster.RemapInfo;
import org.hpccsystems.ws.client.platform.test.BaseRemoteTest;
import org.hpccsystems.ws.client.BaseRemoteTest;
import org.hpccsystems.ws.client.utils.Connection;
import org.junit.AfterClass;
import org.junit.Assert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import java.lang.StringBuilder;
import java.lang.Math;

import org.hpccsystems.ws.client.BaseRemoteTest;
import org.hpccsystems.ws.client.HPCCWsDFUClient;
import org.hpccsystems.ws.client.HPCCWsWorkUnitsClient;
import org.hpccsystems.ws.client.platform.test.BaseRemoteTest;
import org.hpccsystems.ws.client.utils.Connection;
import org.hpccsystems.ws.client.wrappers.wsworkunits.WorkunitWrapper;
import org.hpccsystems.ws.client.wrappers.wsdfu.DFUCreateFileWrapper;
import org.hpccsystems.ws.client.wrappers.wsdfu.DFUFileDetailWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
import org.hpccsystems.commons.ecl.RecordDefinitionTranslator;
import org.hpccsystems.commons.errors.HpccFileException;
import org.hpccsystems.commons.utils.Utils;
import org.hpccsystems.ws.client.BaseRemoteTest;
import org.hpccsystems.ws.client.HPCCWsDFUClient;
import org.hpccsystems.ws.client.HPCCWsWorkUnitsClient;
import org.hpccsystems.ws.client.platform.Version;
import org.hpccsystems.ws.client.wrappers.wsworkunits.WorkunitWrapper;
import org.hpccsystems.ws.client.platform.test.BaseRemoteTest;
import org.hpccsystems.ws.client.wrappers.wsdfu.DFUCreateFileWrapper;
import org.hpccsystems.ws.client.wrappers.wsdfu.DFUFileDetailWrapper;
import org.hpccsystems.ws.client.wrappers.wsdfu.DFUFilePartWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.io.File;

import org.hpccsystems.dfs.client.FileUtility;
import org.hpccsystems.ws.client.platform.test.BaseRemoteTest;
import org.hpccsystems.ws.client.BaseRemoteTest;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@
<exclude>**/WSDLs</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion wsclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,17 @@
</excludes>
</configuration>
</plugin>
<plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.hpccsystems.ws.client.TestResultNotifier</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Loading

0 comments on commit ab1e783

Please sign in to comment.