Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'v2-alpha' into gh-1005-accumulo-2-update
Browse files Browse the repository at this point in the history
  • Loading branch information
t92549 committed Jul 12, 2022
2 parents f8d6289 + 6d07478 commit fce578b
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 78 deletions.
2 changes: 1 addition & 1 deletion NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gaffer tools is built using maven. This process will automatically pull in depen
projects below.


Gaffer (uk.gov.gchq.gaffer:gaffer2:2.0.0-alpha-0.2):
Gaffer (uk.gov.gchq.gaffer:gaffer2:2.0.0-alpha-0.3):

- Apache License, Version 2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

package uk.gov.gchq.gaffer.miniaccumulocluster;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;

public class MiniAccumuloClusterControllerTest {
@Test
Expand Down Expand Up @@ -58,9 +56,9 @@ public void shouldStartAndStopCluster() throws Exception {
Thread.sleep(5000);

// Then
assertNull(null != accumuloException[0] ? accumuloException[0].getMessage() : "", accumuloException[0]);
assertTrue("store.properties was not generated", new File(miniAccumuloClusterName + "/store.properties").exists());
assertEquals(1024, runner[0].getHeapSize());
assertThat(accumuloException[0]).withFailMessage(null != accumuloException[0] ? accumuloException[0].getMessage() : "").isNull();
assertThat(new File(miniAccumuloClusterName + "/store.properties").exists()).withFailMessage("store.properties was not generated").isTrue();
assertThat(1024).isEqualTo(runner[0].getHeapSize());
} finally {
if (null != runner[0]) {
runner[0].stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
package uk.gov.gchq.gaffer.accumulostore.performancetesting.ingest;

import org.apache.hadoop.conf.Configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import uk.gov.gchq.gaffer.accumulostore.AccumuloProperties;
import uk.gov.gchq.gaffer.accumulostore.AccumuloStore;
import uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore;
import uk.gov.gchq.gaffer.commonutil.CommonTestConstants;
import uk.gov.gchq.gaffer.commonutil.StreamUtil;
import uk.gov.gchq.gaffer.graph.Graph;
import uk.gov.gchq.gaffer.graph.GraphConfig;
Expand All @@ -33,12 +31,13 @@
import uk.gov.gchq.gaffer.store.StoreException;
import uk.gov.gchq.gaffer.store.schema.Schema;

import java.io.File;
import java.io.IOException;

public class TestAccumuloStoreRandomElementIngestTest {

@Rule
public TemporaryFolder tempFolder = new TemporaryFolder(CommonTestConstants.TMP_DIRECTORY);
@TempDir
public File tempFolder;

@Test
public void testAccumuloStoreRandomElementIngestTestRuns() throws StoreException, OperationException, IOException {
Expand All @@ -49,7 +48,7 @@ public void testAccumuloStoreRandomElementIngestTestRuns() throws StoreException
testProperties.setElementSupplierClass(RmatElementSupplier.class.getName());
testProperties.setRmatProbabilities(Constants.RMAT_PROBABILITIES);
testProperties.setRmatMaxNodeId(100L);
testProperties.setTempDirectory(tempFolder.newFolder().getCanonicalPath());
testProperties.setTempDirectory(tempFolder.getCanonicalPath());

final Schema schema = Schema.fromJson(StreamUtil.schemas(Constants.class));
final AccumuloProperties storeProperties = AccumuloProperties.loadStoreProperties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
package uk.gov.gchq.gaffer.performancetesting.ingest;

import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import uk.gov.gchq.gaffer.accumulostore.AccumuloProperties;
import uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore;
import uk.gov.gchq.gaffer.commonutil.CommonTestConstants;
import uk.gov.gchq.gaffer.commonutil.StreamUtil;
import uk.gov.gchq.gaffer.graph.Graph;
import uk.gov.gchq.gaffer.graph.GraphConfig;
Expand All @@ -34,12 +32,12 @@
import java.io.IOException;
import java.util.List;

import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;

public class TestElementIngestTest {

@Rule
public TemporaryFolder folder = new TemporaryFolder(CommonTestConstants.TMP_DIRECTORY);
@TempDir
public File folder;

@Test
public void testElementIngestTestRuns() {
Expand All @@ -65,7 +63,7 @@ public void testElementIngestTestRuns() {
final double result = test.run();

// Then
assertTrue(result > 0.0D);
assertThat(result > 0.0D).isTrue();
}

@Test
Expand All @@ -78,7 +76,7 @@ public void testElementIngestTestOutputsToListener() throws IOException {
testProperties.setRmatProbabilities(Constants.RMAT_PROBABILITIES);
testProperties.setRmatMaxNodeId(100L);
testProperties.setMetricsListenerClass(FileWriterMetricsListener.class.getName());
final File metricsResults = folder.newFile();
final File metricsResults = new File(folder, "metricsResults.txt");
final String metricsResultsFilename = metricsResults.getPath();
testProperties.setProperty(FileWriterMetricsListener.FILENAME, metricsResultsFilename);
final AccumuloProperties storeProperties = AccumuloProperties.loadStoreProperties(
Expand All @@ -97,15 +95,15 @@ public void testElementIngestTestOutputsToListener() throws IOException {
final List<String> lines = FileUtils.readLines(new File(metricsResultsFilename));

// Then
assertTrue(lines.size() > 0);
assertThat(lines.size() > 0).isTrue();
final int offsetBatch = IngestMetrics.ELEMENTS_PER_SECOND_BATCH.length() + 1;
final int offsetOverall = IngestMetrics.ELEMENTS_PER_SECOND_OVERALL.length() + 1;
for (int i = 0; i < lines.size() - 2; i++) {
final String[] tokens = lines.get(i).split(",");
assertTrue(tokens[0].replaceAll(" ", "").startsWith(IngestMetrics.ELEMENTS_PER_SECOND_BATCH + ":"));
assertTrue(nullOrPositive(tokens[0].substring(offsetBatch)));
assertTrue(tokens[1].replaceAll(" ", "").startsWith(IngestMetrics.ELEMENTS_PER_SECOND_OVERALL + ":"));
assertTrue(nullOrPositive(tokens[1].substring(offsetOverall)));
assertThat(tokens[0].replaceAll(" ", "").startsWith(IngestMetrics.ELEMENTS_PER_SECOND_BATCH + ":")).isTrue();
assertThat(nullOrPositive(tokens[0].substring(offsetBatch))).isTrue();
assertThat(tokens[1].replaceAll(" ", "").startsWith(IngestMetrics.ELEMENTS_PER_SECOND_OVERALL + ":")).isTrue();
assertThat(nullOrPositive(tokens[1].substring(offsetOverall))).isTrue();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
package uk.gov.gchq.gaffer.performancetesting.ingest;

import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import uk.gov.gchq.gaffer.accumulostore.AccumuloProperties;
import uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore;
import uk.gov.gchq.gaffer.commonutil.CommonTestConstants;
import uk.gov.gchq.gaffer.commonutil.StreamUtil;
import uk.gov.gchq.gaffer.graph.Graph;
import uk.gov.gchq.gaffer.graph.GraphConfig;
Expand All @@ -43,12 +41,12 @@
import java.util.List;
import java.util.stream.Stream;

import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;

public class TestQueryTest {

@Rule
public TemporaryFolder folder = new TemporaryFolder(CommonTestConstants.TMP_DIRECTORY);
@TempDir
public File folder;

@Test
public void testQueryTestRuns() throws OperationException {
Expand Down Expand Up @@ -79,7 +77,7 @@ public void testQueryTestRuns() throws OperationException {
final double result = test.run();

// Then
assertTrue(result > 0.0D);
assertThat(result > 0.0D).isTrue();
}

@Test
Expand All @@ -92,7 +90,7 @@ public void testQueryTestOutputsToListener() throws IOException, OperationExcept
testProperties.setRmatProbabilities(Constants.RMAT_PROBABILITIES);
testProperties.setRmatMaxNodeId(100L);
testProperties.setMetricsListenerClass(FileWriterMetricsListener.class.getName());
final File metricsResults = folder.newFile();
final File metricsResults = new File(folder, "metricsResults.txt");
final String metricsResultsFilename = metricsResults.getPath();
testProperties.setProperty(FileWriterMetricsListener.FILENAME, metricsResultsFilename);
final AccumuloProperties storeProperties = AccumuloProperties.loadStoreProperties(
Expand All @@ -116,13 +114,13 @@ public void testQueryTestOutputsToListener() throws IOException, OperationExcept
final List<String> lines = FileUtils.readLines(new File(metricsResultsFilename));

// Then
assertTrue(lines.size() > 0);
assertThat(lines.size() > 0).isTrue();
lines.forEach(line -> {
final String[] fields = line.split(", ");
assertTrue(fields[0].startsWith(QueryMetrics.RESULTS_PER_SECOND));
assertTrue(Double.parseDouble(fields[0].split(":")[1]) > 0.0D);
assertTrue(fields[1].startsWith(QueryMetrics.SEEDS_PER_SECOND));
assertTrue(Double.parseDouble(fields[1].split(":")[1]) > 0.0D);
assertThat(fields[0].startsWith(QueryMetrics.RESULTS_PER_SECOND)).isTrue();
assertThat(Double.parseDouble(fields[0].split(":")[1]) > 0.0D).isTrue();
assertThat(fields[1].startsWith(QueryMetrics.SEEDS_PER_SECOND)).isTrue();
assertThat(Double.parseDouble(fields[1].split(":")[1]) > 0.0D).isTrue();
});
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>uk.gov.gchq.gaffer</groupId>
<artifactId>gaffer2</artifactId>
<version>2.0.0-alpha-0.2</version>
<version>2.0.0-alpha-0.3</version>
</parent>

<artifactId>gaffer-tools</artifactId>
Expand All @@ -36,7 +36,7 @@
</modules>

<properties>
<gaffer.version>2.0.0-alpha-0.2</gaffer.version>
<gaffer.version>2.0.0-alpha-0.3</gaffer.version>
<scm.url>
https://github.com/gchq/gaffer-tools
</scm.url>
Expand Down
2 changes: 1 addition & 1 deletion python-shell/src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.0.0-alpha-0.2"
__version__ = "2.0.0-alpha-0.3"

__title__ = "gafferpy"
__description__ = "Gaffer Python Shell"
Expand Down
2 changes: 1 addition & 1 deletion python-shell/src/gafferpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.0.0-alpha-0.2"
__version__ = "2.0.0-alpha-0.3"

__title__ = "gafferpy"
__description__ = "Gaffer Python Shell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package uk.gov.gchq.gaffer.randomelementgeneration.cache;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -25,8 +25,7 @@
import java.util.Set;
import java.util.stream.IntStream;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;

public class TestPreferentialAttachmentCache {

Expand All @@ -43,7 +42,7 @@ public void testGetReturnsOneOfTheElementsAdded() {
IntStream.range(0, 100).forEach(i -> results.add(cache.get()));

// Then
results.forEach(i -> assertTrue(data.contains(i)));
results.forEach(i -> assertThat(data.contains(i)).isTrue());
}

@Test
Expand All @@ -56,7 +55,7 @@ public void testMaxSizeIsRespected() {
final long numberOfElements = cache.getNumberOfElements();

// Then
assertEquals(10, numberOfElements);
assertThat(numberOfElements).isEqualTo(10);
}

/**
Expand All @@ -83,6 +82,6 @@ public void testPowerLaw() {
final long minFrequency = itemToCount.values().stream().mapToLong(Long::longValue).min().getAsLong();

// Then
assertTrue(maxFrequency / minFrequency > 5);
assertThat(maxFrequency / minFrequency > 5).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/
package uk.gov.gchq.gaffer.randomelementgeneration.cache;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.IntStream;

import static junit.framework.TestCase.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;

public class TestProbabilityGenerator {

Expand All @@ -46,7 +46,7 @@ public void testWhenUniform() {

// Then
final double ratio = ((double) counts.get("A")) / counts.get("B");
assertTrue(0.99D < ratio && ratio < 1.01D);
assertThat(0.99D < ratio && ratio < 1.01D).isTrue();
}

@Test
Expand All @@ -68,6 +68,6 @@ public void testWhenUnbalanced() {

// Then
final double ratio = ((double) counts.get("A")) / counts.get("B");
assertTrue(ratio > 100.0D);
assertThat(ratio > 100.0D).isTrue();
}
}
Loading

0 comments on commit fce578b

Please sign in to comment.