[
https://issues.apache.org/jira/browse/BEAM-10221?focusedWorklogId=444981&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-444981
]
ASF GitHub Bot logged work on BEAM-10221:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Jun/20 15:52
Start Date: 12/Jun/20 15:52
Worklog Time Spent: 10m
Work Description: harshithdwivedi commented on a change in pull request
#12000:
URL: https://github.com/apache/beam/pull/12000#discussion_r439500849
##########
File path:
examples/kotlin/src/test/java/org/apache/beam/examples/kotlin/cookbook/JoinExamplesTest.kt
##########
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.examples.kotlin.cookbook
+
+import com.google.api.services.bigquery.model.TableRow
+import
org.apache.beam.examples.kotlin.cookbook.JoinExamples.ExtractCountryInfoFn
+import org.apache.beam.examples.kotlin.cookbook.JoinExamples.ExtractEventDataFn
+import org.apache.beam.sdk.testing.PAssert
+import org.apache.beam.sdk.testing.TestPipeline
+import org.apache.beam.sdk.testing.ValidatesRunner
+import org.apache.beam.sdk.transforms.Create
+import org.apache.beam.sdk.transforms.ParDo
+import org.apache.beam.sdk.values.KV
+import org.apache.beam.sdk.values.PCollection
+import org.junit.Rule
+import org.junit.Test
+import org.junit.experimental.categories.Category
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Unit tests for [JoinExamples]. */
+@RunWith(JUnit4::class)
+class JoinExamplesTest {
+
+ companion object {
+ private val row1 = TableRow()
+ .set("ActionGeo_CountryCode", "VM")
+ .set("SQLDATE", "20141212")
+ .set("Actor1Name", "BANGKOK")
+ .set("SOURCEURL", "http://cnn.com")
+ private val row2 = TableRow()
+ .set("ActionGeo_CountryCode", "VM")
+ .set("SQLDATE", "20141212")
+ .set("Actor1Name", "LAOS")
+ .set("SOURCEURL", "http://www.chicagotribune.com")
+ private val row3 = TableRow()
+ .set("ActionGeo_CountryCode", "BE")
+ .set("SQLDATE", "20141213")
+ .set("Actor1Name", "AFGHANISTAN")
+ .set("SOURCEURL", "http://cnn.com")
+ private val EVENTS = arrayOf(row1, row2, row3)
+ val EVENT_ARRAY: List<TableRow> = listOf(*EVENTS)
+ private val PARSED_EVENTS = listOf(
+ KV.of("VM", "Date: 20141212, Actor1: LAOS, url:
http://www.chicagotribune.com"),
+ KV.of("BE", "Date: 20141213, Actor1: AFGHANISTAN, url:
http://cnn.com"),
+ KV.of("VM", "Date: 20141212, Actor1: BANGKOK, url:
http://cnn.com"))
+ private val PARSED_COUNTRY_CODES = listOf(KV.of("BE", "Belgium"),
KV.of("VM", "Vietnam"))
+ private val cc1 = TableRow().set("FIPSCC", "VM").set("HumanName",
"Vietnam")
+ private val cc2 = TableRow().set("FIPSCC", "BE").set("HumanName",
"Belgium")
+ private val CCS = arrayOf(cc1, cc2)
+ val CC_ARRAY = listOf(*CCS)
+ val JOINED_EVENTS = arrayOf("Country code: VM, Country name: Vietnam,
Event info: Date: 20141212, Actor1: LAOS, "
+ + "url: http://www.chicagotribune.com", "Country code: VM,
Country name: Vietnam, Event info: Date: 20141212, Actor1: BANGKOK, "
Review comment:
Can we get rid of this rogue `"`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 444981)
Time Spent: 0.5h (was: 20m)
> Add example tests for Kotlin Examples
> -------------------------------------
>
> Key: BEAM-10221
> URL: https://issues.apache.org/jira/browse/BEAM-10221
> Project: Beam
> Issue Type: Improvement
> Components: examples-java
> Reporter: Stuart Perks
> Assignee: Stuart Perks
> Priority: P3
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> As a developer I want to see example tests for Kotlin.
> In the examples folder there are code examples using
> [Kotlin|https://github.com/apache/beam/tree/master/examples/kotlin] but there
> are no test examples.
> Add across some of the tests provided by Java examples based on the Kotlin
> examples already migrated across. Such as the [Join Example
> Test|https://github.com/apache/beam/blob/master/examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesTest.java]
> Scope for this JIRA
> * [Filter Examples
> Test|https://github.com/perkss/beam/blob/master/examples/java/src/test/java/org/apache/beam/examples/cookbook/FilterExamplesTest.java]
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)