Skip to content

Commit

Permalink
Merge pull request #2586 from markheger/develop
Browse files Browse the repository at this point in the history
mvn release test
  • Loading branch information
markheger committed Sep 29, 2020
2 parents 975cfb1 + 2dbcd26 commit c2393f2
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,8 @@ test/spl/testtk/testjava/MyPipe/MyPipe.xml
test/spl/testtk/testjava/NoOpJavaPrimitive/NoOpJavaPrimitive.xml
test/test.out
test/java/classes
test/release/java_topo_mvn/extlib
test/release/java_topo_mvn/classes

# Ignore IntelliJ files.
.idea/
Expand Down
10 changes: 10 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ cd test/release
ant
```

### Perform Java Topology quick test with release from Maven Central

To perform a quick test (download topology.jar from Maven and build bundle from Java Topology app), run the following and set the `TOPOLOGY_VERSION` to the version to be downloaded from Maven central:

```
export TOPOLOGY_VERSION=<tested version, for example 1.16.3>
cd test/release
ant mvntest
```

## Full test set for a release

Full set of tests assumes setup is correct for running distributed and Streaming Analytics
Expand Down
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<ant dir="toolkit" target="clean"/>
<ant dir="test/java" target="clean"/>
<ant dir="test/python/rest/toolkits" target="clean"/>
<ant dir="test/release" target="clean"/>
<delete dir="${tk.doc}/javadoc"/>
<delete dir="${tk.doc}/spldoc"/>
<delete dir="${tk.doc}/scaladoc"/>
Expand Down
16 changes: 16 additions & 0 deletions test/release/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
>
<description>
Build a release and test against it (DISTRIBUTED, local STREAMS required).
Target mvntest: Downloads the topology jar from Maven central and builds a Java topology (BUNDLE, local STREAMS required).
</description>

<property environment="env"/>
Expand All @@ -12,6 +13,9 @@
<property name="streamsx.topology"
location="${basedir}/../.."/>

<property name="java_topo_mvn"
location="${basedir}/java_topo_mvn"/>

<property name="rel.dir"
location="${streamsx.topology}/release-streamsx.topology"/>
<property name="unpack.dir"
Expand Down Expand Up @@ -46,4 +50,16 @@
</exec>
</target>

<target name="clean">
<exec executable="make" failonerror="false" dir="${java_topo_mvn}">
<arg value="clean"/>
</exec>
</target>

<target name="mvntest">
<exec executable="make" failonerror="true" dir="${java_topo_mvn}">
<arg value="all"/>
</exec>
</target>

</project>
53 changes: 53 additions & 0 deletions test/release/java_topo_mvn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.PHONY: all clean

TOPOLOGY_VERSION?=1.16.0
LIB_DIR=extlib
BIN_LOC=classes
DOWNLOAD_DIR=download
JSI = $(STREAMS_INSTALL)


all: runtopo

javacompile: $(BIN_LOC)
javac -g -classpath $(LIB_DIR)/streamsx.topology-$(TOPOLOGY_VERSION).jar:$(LIB_DIR)/gson-2.3.1.jar:$(JSI)/lib/com.ibm.streams.operator.samples.jar -d $(BIN_LOC) src/topo1/App.java
${STREAMS_INSTALL}/bin/spl-make-toolkit -i .

$(BIN_LOC):
mkdir -p $(BIN_LOC)

mvndownload: $(LIB_DIR)
export TOPOLOGY_VERSION=$(TOPOLOGY_VERSION); mvn -f pom.xml --batch-mode dependency:copy-dependencies -DoutputDirectory=$(LIB_DIR)

$(LIB_DIR):
mkdir -p $(LIB_DIR)

downloadlatest: $(DOWNLOAD_DIR)
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -Dartifact=com.ibm.streams:streamsx.topology:LATEST:jar
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -Dartifact=com.ibm.streams:streamsx.topology:LATEST:jar:sources
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -Dartifact=com.ibm.streams:streamsx.topology:LATEST:jar:javadoc
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -Dartifact=com.ibm.streams:streamsx.topology:LATEST:tgz:toolkit

downloadstaging: $(DOWNLOAD_DIR)
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -DrepoUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -Dartifact=com.ibm.streams:streamsx.topology:$(TOPOLOGY_VERSION):jar
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -DrepoUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -Dartifact=com.ibm.streams:streamsx.topology:$(TOPOLOGY_VERSION):jar:sources
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -DrepoUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -Dartifact=com.ibm.streams:streamsx.topology:$(TOPOLOGY_VERSION):jar:javadoc
mvn --batch-mode dependency:copy -DoutputDirectory=$(DOWNLOAD_DIR) -DrepoUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -Dartifact=com.ibm.streams:streamsx.topology:$(TOPOLOGY_VERSION):tgz:toolkit

$(DOWNLOAD_DIR):
mkdir -p $(DOWNLOAD_DIR)

runtopo: mvndownload javacompile
java -classpath $(BIN_LOC):$(LIB_DIR)/streamsx.topology-$(TOPOLOGY_VERSION).jar:$(LIB_DIR)/gson-2.3.1.jar:$(JSI)/lib/com.ibm.streams.operator.samples.jar topo1.App

run: runtopo
java -jar topo1.temperatureSensor.sab

clean:
rm -rf $(BIN_LOC)
rm -rf $(LIB_DIR)
rm -rf $(DOWNLOAD_DIR)
rm -f topo1*.sab
rm -f topo1*.json
rm -rf output
rm -rf toolkit.xml
11 changes: 11 additions & 0 deletions test/release/java_topo_mvn/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<info:toolkitInfoModel xmlns:common="http://www.ibm.com/xmlns/prod/streams/spl/common"
xmlns:info="http://www.ibm.com/xmlns/prod/streams/spl/toolkitInfo">
<info:identity>
<info:name>Sample Java Topology App</info:name>
<info:description>Sample demonstrating how to build a JAVA Topology Application</info:description>
<info:version>1.0.0</info:version>
<info:requiredProductVersion>4.3.0</info:requiredProductVersion>
</info:identity>
<info:dependencies/>
</info:toolkitInfoModel>
28 changes: 28 additions & 0 deletions test/release/java_topo_mvn/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>streamsx.java.topo.sample</groupId>
<artifactId>streamsx.java.topo.sample</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<name>streamsx.java.topo.sample</name>
<repositories>
<repository>
<id>maven</id>
<url>http://download.java.net/maven/2/</url>
</repository>
<!--repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository-->
</repositories>
<dependencies>
<dependency>
<groupId>com.ibm.streams</groupId>
<artifactId>streamsx.topology</artifactId>
<version>${env.TOPOLOGY_VERSION}</version>
</dependency>
</dependencies>
<build>
</build>
</project>
28 changes: 28 additions & 0 deletions test/release/java_topo_mvn/src/topo1/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package topo1;

import java.util.Random;
import com.ibm.streamsx.topology.TStream;
import com.ibm.streamsx.topology.Topology;
import com.ibm.streamsx.topology.context.StreamsContextFactory;
import com.ibm.streamsx.topology.function.Supplier;

public class App {
public static void main(String[] args) throws Exception{

Topology topology = new Topology("temperatureSensor");
Random random = new Random();

TStream<Double> readings = topology.endlessSource(new Supplier<Double>(){
@Override
public Double get() {
return random.nextGaussian();
}
});

readings.print();

//StreamsContextFactory.getEmbedded().submit(topology);
StreamsContextFactory.getStreamsContext("BUNDLE").submit(topology);

}
}

0 comments on commit c2393f2

Please sign in to comment.