Skip to content

Commit 8027a77

Browse files
heremaps-botheremaps-bot
heremaps-bot
authored and
heremaps-bot
committed
HERE Data SDK for Java & Scala Release 2.19.0
1 parent dbb8f10 commit 8027a77

File tree

121 files changed

+196
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+196
-84
lines changed

data-archive/java/avro-example/README.md

+4

data-archive/java/avro-example/pom.xml

+33-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.data.archive</groupId>
55
<artifactId>data-archive-avro-example</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<!-- Meta information section start -->
@@ -23,13 +23,14 @@
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424
<java.version>1.8</java.version>
2525

26-
<sdk-bom.version>2.18.5</sdk-bom.version>
26+
<sdk-bom.version>2.19.10</sdk-bom.version>
2727
<scala.compat.version>2.11</scala.compat.version>
2828

2929
<avro.version>1.10.0</avro.version>
3030
<commons-logging.version>1.2</commons-logging.version>
3131

3232
<junit.version>4.12</junit.version>
33+
<mockito-all.version>1.10.19</mockito-all.version>
3334
</properties>
3435

3536
<dependencyManagement>
@@ -45,6 +46,20 @@
4546
</dependencies>
4647
</dependencyManagement>
4748
<dependencies>
49+
<!-- Apache Flink dependencies -->
50+
<!-- These dependencies are provided, because they should not be packaged into the JAR file. -->
51+
<!-- Versions for these dependencies come from environment-stream pom -->
52+
<dependency>
53+
<groupId>org.apache.flink</groupId>
54+
<artifactId>flink-core</artifactId>
55+
<scope>provided</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.apache.flink</groupId>
59+
<artifactId>flink-metrics-core</artifactId>
60+
<scope>provided</scope>
61+
</dependency>
62+
4863
<!-- External Dependencies from sdk-dep-common-2.0.0 pom -->
4964
<dependency>
5065
<groupId>org.apache.avro</groupId>
@@ -92,6 +107,12 @@
92107
<version>${junit.version}</version>
93108
<scope>test</scope>
94109
</dependency>
110+
<dependency>
111+
<groupId>org.mockito</groupId>
112+
<artifactId>mockito-all</artifactId>
113+
<version>${mockito-all.version}</version>
114+
<scope>test</scope>
115+
</dependency>
95116
</dependencies>
96117

97118
<build>
@@ -172,11 +193,21 @@
172193
</property>
173194
</activation>
174195
<dependencies>
196+
<dependency>
197+
<groupId>org.apache.flink</groupId>
198+
<artifactId>flink-core</artifactId>
199+
<scope>compile</scope>
200+
</dependency>
175201
<dependency>
176202
<groupId>org.apache.flink</groupId>
177203
<artifactId>flink-java</artifactId>
178204
<scope>compile</scope>
179205
</dependency>
206+
<dependency>
207+
<groupId>org.apache.flink</groupId>
208+
<artifactId>flink-metrics-core</artifactId>
209+
<scope>compile</scope>
210+
</dependency>
180211
<dependency>
181212
<groupId>org.apache.flink</groupId>
182213
<artifactId>flink-streaming-java_${scala.compat.version}</artifactId>

data-archive/java/avro-example/src/main/java/com/here/platform/data/archive/example/AvroSimpleKeyExample.java

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import java.util.Spliterators;
3535
import java.util.TreeSet;
3636
import java.util.stream.StreamSupport;
37+
import org.apache.flink.api.common.functions.RuntimeContext;
38+
import org.apache.flink.configuration.Configuration;
39+
import org.apache.flink.metrics.Counter;
3740
import org.slf4j.Logger;
3841
import org.slf4j.LoggerFactory;
3942

@@ -45,9 +48,18 @@ public class AvroSimpleKeyExample implements SimpleUDF {
4548
static final String INGESTION_TIME = "ingestionTime";
4649
static final String EVENT_TYPE = "eventType";
4750
static final int ZOOM_LEVEL = 8;
51+
private Counter getKeysDuration;
52+
private Counter aggregateDuration;
53+
54+
@Override
55+
public void open(Configuration parameters, RuntimeContext runtimeContext) {
56+
getKeysDuration = runtimeContext.getMetricGroup().counter("getKeysDuration");
57+
aggregateDuration = runtimeContext.getMetricGroup().counter("aggregateDuration");
58+
}
4859

4960
@Override
5061
public Map<String, Object> getKeys(Map<MetadataName, String> metadata, byte[] payload) {
62+
long startTime = System.currentTimeMillis();
5163
SdiiMessage.Message sdiiMessage;
5264
try {
5365
sdiiMessage = SdiiMessage.Message.parseFrom(payload);
@@ -93,11 +105,13 @@ public Map<String, Object> getKeys(Map<MetadataName, String> metadata, byte[] pa
93105
result.put(EVENT_TYPE, event);
94106
}
95107

108+
getKeysDuration.inc(System.currentTimeMillis() - startTime);
96109
return result;
97110
}
98111

99112
@Override
100113
public byte[] aggregate(Map<String, Object> keys, Iterator<byte[]> messages) {
114+
long startTime = System.currentTimeMillis();
101115
try {
102116
Iterator<SdiiMessage.Message> sdiiMessages =
103117
StreamSupport.stream(
@@ -114,6 +128,8 @@ public byte[] aggregate(Map<String, Object> keys, Iterator<byte[]> messages) {
114128
return AvroHelper.aggregateProtobufMessagesAsAvro(sdiiMessages, SdiiMessage.Message.class);
115129
} catch (Exception e) {
116130
LOG.error("Aggregation errors....", e);
131+
} finally {
132+
aggregateDuration.inc(System.currentTimeMillis() - startTime);
117133
}
118134
return null;
119135
}

data-archive/java/avro-example/src/test/java/com/here/platform/data/archive/example/AvroSimpleKeyExampleTest.java

+46-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
package com.here.platform.data.archive.example;
2121

2222
import static org.junit.Assert.assertEquals;
23+
import static org.junit.Assert.assertTrue;
24+
import static org.mockito.Matchers.eq;
25+
import static org.mockito.Mockito.times;
26+
import static org.mockito.Mockito.verify;
27+
import static org.mockito.Mockito.when;
2328

2429
import com.here.olp.util.quad.factory.HereQuadFactory;
2530
import com.here.platform.dal.custom.MetadataName;
@@ -37,11 +42,44 @@
3742
import java.util.Map;
3843
import java.util.TimeZone;
3944
import org.apache.commons.io.FileUtils;
45+
import org.apache.flink.api.common.functions.RuntimeContext;
46+
import org.apache.flink.configuration.Configuration;
47+
import org.apache.flink.metrics.Counter;
48+
import org.apache.flink.metrics.MetricGroup;
49+
import org.apache.flink.metrics.SimpleCounter;
50+
import org.junit.Before;
4051
import org.junit.Test;
52+
import org.junit.runner.RunWith;
53+
import org.mockito.Mock;
54+
import org.mockito.runners.MockitoJUnitRunner;
4155

56+
@RunWith(MockitoJUnitRunner.class)
4257
public class AvroSimpleKeyExampleTest {
4358

44-
private AvroSimpleKeyExample example = new AvroSimpleKeyExample();
59+
@Mock Configuration parameters;
60+
@Mock RuntimeContext runtimeContext;
61+
@Mock MetricGroup metricGroup;
62+
63+
private AvroSimpleKeyExample example;
64+
private Counter getKeysDuration = new SimpleCounter();
65+
private Counter aggregateDuration = new SimpleCounter();
66+
67+
@Before
68+
public void init() {
69+
when(runtimeContext.getMetricGroup()).thenReturn(metricGroup);
70+
when(metricGroup.counter("getKeysDuration")).thenReturn(getKeysDuration);
71+
when(metricGroup.counter("aggregateDuration")).thenReturn(aggregateDuration);
72+
example = new AvroSimpleKeyExample();
73+
}
74+
75+
@Test
76+
public void testRegisterMetrics() {
77+
example.open(parameters, runtimeContext);
78+
79+
verify(runtimeContext, times(2)).getMetricGroup();
80+
verify(metricGroup, times(1)).counter(eq("getKeysDuration"));
81+
verify(metricGroup, times(1)).counter(eq("aggregateDuration"));
82+
}
4583

4684
@Test
4785
public void testGetKeys() throws IOException {
@@ -51,10 +89,12 @@ public void testGetKeys() throws IOException {
5189
double latitude = 10d;
5290
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
5391
cal.setTimeInMillis(timestamp);
92+
example.open(parameters, runtimeContext);
5493

5594
SdiiMessage.Message sdiiMessage = prepareSDIIMessage(timestamp, true, longitude, latitude);
5695
Map<MetadataName, String> metadata = new HashMap<>();
5796
metadata.put(MetadataName.INGESTION_TIME, String.valueOf(timestamp));
97+
assertEquals(0, getKeysDuration.getCount());
5898
Map<String, Object> keys = example.getKeys(metadata, sdiiMessage.toByteArray());
5999
assertEquals(
60100
HereQuadFactory.INSTANCE
@@ -65,6 +105,7 @@ public void testGetKeys() throws IOException {
65105
assertEquals(
66106
SdiiCommon.SignRecognition.getDescriptor().getName(),
67107
keys.get(AvroSimpleKeyExample.EVENT_TYPE));
108+
assertTrue(getKeysDuration.getCount() > 0);
68109
}
69110

70111
@Test
@@ -74,7 +115,9 @@ public void testAggregate() throws IOException {
74115
SdiiMessage.Message message3 = prepareSDIIMessage(System.currentTimeMillis(), true, 10d, 10d);
75116
List<byte[]> messagesList =
76117
Arrays.asList(message1.toByteArray(), message2.toByteArray(), message3.toByteArray());
118+
example.open(parameters, runtimeContext);
77119

120+
assertEquals(0, aggregateDuration.getCount());
78121
File tmpFile = File.createTempFile("test", ".avro");
79122
tmpFile.deleteOnExit();
80123
FileUtils.writeByteArrayToFile(
@@ -85,6 +128,7 @@ public void testAggregate() throws IOException {
85128
assertSDIIMessagesAreEqual(message1, list.get(0));
86129
assertSDIIMessagesAreEqual(message2, list.get(1));
87130
assertSDIIMessagesAreEqual(message3, list.get(2));
131+
assertTrue(aggregateDuration.getCount() > 0);
88132
}
89133

90134
@Test
@@ -93,6 +137,7 @@ public void testMerge() throws IOException {
93137
SdiiMessage.Message message2 = prepareSDIIMessage(System.currentTimeMillis(), true, 10d, 10d);
94138
SdiiMessage.Message message3 = prepareSDIIMessage(System.currentTimeMillis(), true, 10d, 10d);
95139
SdiiMessage.Message message4 = prepareSDIIMessage(System.currentTimeMillis(), true, 10d, 10d);
140+
example.open(parameters, runtimeContext);
96141
byte[] archiveBytesMessage1 =
97142
example.aggregate(
98143
null, Arrays.asList(message1.toByteArray(), message2.toByteArray()).iterator());
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

data-archive/java/parquet-example/README.md

+4

data-archive/java/parquet-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.data.archive</groupId>
55
<artifactId>data-archive-parquet-example</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<!-- Meta information section start -->
@@ -23,7 +23,7 @@
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424
<java.version>1.8</java.version>
2525

26-
<sdk-bom.version>2.18.5</sdk-bom.version>
26+
<sdk-bom.version>2.19.10</sdk-bom.version>
2727
<scala.compat.version>2.11</scala.compat.version>
2828

2929
<hadoop-client.version>2.7.3</hadoop-client.version>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

data-archive/java/protobuf-example/README.md

+4

data-archive/java/protobuf-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.data.archive</groupId>
55
<artifactId>data-archive-protobuf-example</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<!-- Meta information section start -->
@@ -23,7 +23,7 @@
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424
<java.version>1.8</java.version>
2525

26-
<sdk-bom.version>2.18.5</sdk-bom.version>
26+
<sdk-bom.version>2.19.10</sdk-bom.version>
2727
<scala.compat.version>2.11</scala.compat.version>
2828

2929
<commons-logging.version>1.2</commons-logging.version>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

data-archive/java/sensoris-parquet-example/README.md

+4

data-archive/java/sensoris-parquet-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.examples</groupId>
55
<artifactId>data-archive-sensoris-parquet-example</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<!-- Meta information section -->
@@ -23,7 +23,7 @@
2323
<java.version>1.8</java.version>
2424
<artifact.wagon.version>1.6.0</artifact.wagon.version>
2525

26-
<sdk-bom.version>2.18.5</sdk-bom.version>
26+
<sdk-bom.version>2.19.10</sdk-bom.version>
2727
<scala.compat.version>2.11</scala.compat.version>
2828
<hadoop-client.version>2.7.3</hadoop-client.version>
2929
<parquet-protobuf.version>1.11.0</parquet-protobuf.version>

data-archive/java/sensoris-protobuf-example/README.md

+4

data-archive/java/sensoris-protobuf-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.examples</groupId>
55
<artifactId>data-archive-sensoris-protobuf-example</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<!-- Meta information section -->
@@ -25,7 +25,7 @@
2525
<java.version>1.8</java.version>
2626
<artifact.wagon.version>1.6.0</artifact.wagon.version>
2727

28-
<sdk-bom.version>2.18.5</sdk-bom.version>
28+
<sdk-bom.version>2.19.10</sdk-bom.version>
2929
<scala.compat.version>2.11</scala.compat.version>
3030

3131
<parquet-protobuf.version>1.10.1</parquet-protobuf.version>

data-processing/java/geometry-lifter/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.here.platform.data.processing.example.java.geometry.lifter</groupId>
55
<artifactId>geometry-lifter</artifactId>
6-
<version>0.0.548</version>
6+
<version>0.0.565</version>
77
<packaging>jar</packaging>
88

99
<name>Batch Processor compiler for Geometry Lifter in Java</name>
@@ -22,7 +22,7 @@
2222
<java.version>1.8</java.version>
2323
<maven.compiler.source>${java.version}</maven.compiler.source>
2424
<maven.compiler.target>${java.version}</maven.compiler.target>
25-
<sdk-bom.version>2.18.5</sdk-bom.version>
25+
<sdk-bom.version>2.19.10</sdk-bom.version>
2626
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
2727
<maven-shade-plugin.version>3.0.0</maven-shade-plugin.version>
2828
<scala-maven-plugin.version>3.3.1</scala-maven-plugin.version>

0 commit comments

Comments
 (0)