Search in sources :

Example 61 with FreqMap

use of uk.gov.gchq.gaffer.types.FreqMap in project Gaffer by gchq.

the class FreqMapConverterTest method testConverter.

@Test
public void testConverter() throws ConversionException {
    final FreqMap freqMap = new FreqMap();
    freqMap.put("x", 10L);
    freqMap.put("y", 5L);
    freqMap.put("z", 20L);
    final scala.collection.mutable.Map<String, Long> expectedResult = scala.collection.mutable.Map$.MODULE$.empty();
    expectedResult.put("x", 10L);
    expectedResult.put("y", 5L);
    expectedResult.put("z", 20L);
    assertEquals(expectedResult, FREQ_MAP_CONVERTER.convert(freqMap));
    final FreqMap emptyFreqMap = new FreqMap();
    expectedResult.clear();
    assertEquals(expectedResult, FREQ_MAP_CONVERTER.convert(emptyFreqMap));
}
Also used : FreqMap(uk.gov.gchq.gaffer.types.FreqMap) Test(org.junit.jupiter.api.Test)

Example 62 with FreqMap

use of uk.gov.gchq.gaffer.types.FreqMap in project Gaffer by gchq.

the class FreqMapKryoSerializerTest method getTestObject.

@Override
protected FreqMap getTestObject() {
    final FreqMap freqMap = new FreqMap();
    freqMap.upsert("test", 3L);
    return freqMap;
}
Also used : FreqMap(uk.gov.gchq.gaffer.types.FreqMap)

Aggregations

FreqMap (uk.gov.gchq.gaffer.types.FreqMap)62 Test (org.junit.jupiter.api.Test)29 ArrayList (java.util.ArrayList)9 Edge (uk.gov.gchq.gaffer.data.element.Edge)9 Entity (uk.gov.gchq.gaffer.data.element.Entity)9 Date (java.util.Date)6 Schema (uk.gov.gchq.gaffer.store.schema.Schema)6 FunctionTest (uk.gov.gchq.koryphe.function.FunctionTest)6 Configuration (org.apache.hadoop.conf.Configuration)5 FileSystem (org.apache.hadoop.fs.FileSystem)5 Path (org.apache.hadoop.fs.Path)5 Row (org.apache.spark.sql.Row)5 SparkSession (org.apache.spark.sql.SparkSession)5 WrappedArray (scala.collection.mutable.WrappedArray)5 Element (uk.gov.gchq.gaffer.data.element.Element)5 HashMap (java.util.HashMap)4 Key (org.apache.accumulo.core.data.Key)4 Test (org.junit.Test)4 EdgeId (uk.gov.gchq.gaffer.data.element.id.EdgeId)4 ElementId (uk.gov.gchq.gaffer.data.element.id.ElementId)4