Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showcase vlingo-schemata integration #1

Merged
merged 12 commits into from
Dec 21, 2019
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ before_install:
- git clone --depth=50 --branch=master https://github.com/vlingo/vlingo-actors.git
- cd vlingo-actors && mvn install -DskipTests=true
- cd ${TRAVIS_BUILD_DIR}/..
- git clone --depth=50 --branch=master https://github.com/vlingo/vlingo-build-plugins.git
- git clone --depth=50 --branch=master https://github.com/vlingo/vlingo-lattice.git
- cd vlingo-lattice && mvn install -DskipTests=true
- cd ${TRAVIS_BUILD_DIR}/..
- git clone --depth=50 --branch=master https://github.com/vlingo/vlingo-schemata.git
- cd vlingo-schemata && mvn install -DskipTests=true
- cd ${TRAVIS_BUILD_DIR}/..
# TODO: remove feature checkout branch before merging PR
- git clone --depth=50 --branch=feature/1-schemata-pull https://github.com/vlingo/vlingo-build-plugins.git
- cd vlingo-build-plugins && mvn install -DskipTests=true
- cd ${TRAVIS_BUILD_DIR}
script:
Expand Down
81 changes: 75 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<vlingo.build.plugins.version>${project.version}</vlingo.build.plugins.version>
<vlingo.schemata.serviceUrl>http://localhost:9019</vlingo.schemata.serviceUrl>
<vlingo.schemata.organization>Vlingo</vlingo.schemata.organization>
<vlingo.schemata.unit>schemata</vlingo.schemata.unit>
<vlingo.schemata.srcDir>${basedir}/src/main/vlingo/schemata</vlingo.schemata.srcDir>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.vlingo</groupId>
<artifactId>vlingo-build-plugins</artifactId>
<version>0.8.7</version>
<version>${vlingo.build.plugins.version}</version>
<executions>
<execution>
<id>generateProxies</id>
<phase>compile</phase>
<goals>
<goal>actorProxyGen</goal>
Expand Down Expand Up @@ -78,26 +84,89 @@
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
<groupId>io.vlingo</groupId>
<artifactId>vlingo-actors</artifactId>
<version>0.9.3-RC4</version>
</dependency>
<dependency>
<groupId>io.vlingo</groupId>
<artifactId>vlingo-actors</artifactId>
<artifactId>vlingo-lattice</artifactId>
<version>0.9.3-RC4</version>
</dependency>
<dependency>
<groupId>io.vlingo</groupId>
<artifactId>vlingo-build-plugins</artifactId>
<version>0.9.3-RC4</version>
</dependency>
<dependency> <!-- required to have access to schemata base classes -->
<groupId>io.vlingo</groupId>
<artifactId>vlingo-schemata</artifactId>
<version>0.9.3-RC4</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>schemata</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.vlingo</groupId>
<artifactId>vlingo-build-plugins</artifactId>
<version>${vlingo.build.plugins.version}</version>
<executions>

<execution>
<id>pushSchemata</id>
<goals>
<goal>push-schemata</goal>
</goals>
<configuration>
<srcDirectory>${vlingo.schemata.srcDir}</srcDirectory>
<schemataService>
<url>${vlingo.schemata.serviceUrl}</url>
<clientOrganization>${vlingo.schemata.organization}</clientOrganization>
<clientUnit>${vlingo.schemata.unit}</clientUnit>
</schemataService>
<schemata>
<schema>
<ref>Vlingo:schemata:io.vlingo.schemata:SchemaDefined:0.0.1</ref>
<src>SchemaDefined.vss</src>
<previousVersion>0.0.0</previousVersion>
</schema>
<schema>
<ref>Vlingo:schemata:io.vlingo.schemata:SchemaPublished:0.0.1</ref>
</schema>
</schemata>
</configuration>
</execution>
</executions>
<configuration>
<actorProtocols>
<param>io.vlingo.maven.actortest.Test1Protocol</param>
<param>io.vlingo.maven.actortest.Test2Protocol</param>
</actorProtocols>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
5 changes: 5 additions & 0 deletions src/main/vlingo/schemata/SchemaDefined.vss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
event SchemaDefined {
type eventType
timestamp occurredOn
version eventVersion
}
4 changes: 4 additions & 0 deletions src/main/vlingo/schemata/SchemaPublished.vss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
event SchemaPublished {
timestamp publishedOn
version publishedVersion
}
34 changes: 34 additions & 0 deletions src/test/java/io/vlingo/schemata/SchemataIntegrationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright © 2012-2018 Vaughn Vernon. All rights reserved.
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain
// one at https://mozilla.org/MPL/2.0/.

package io.vlingo.schemata;

import org.junit.Ignore;
import org.junit.Test;

import static junit.framework.TestCase.fail;

@Ignore("Ignored by default as tests in here require a schemata server to be running at the address defined in the pom.")
public class SchemataIntegrationTest {

@Test
public void pulledSchemaIsCompiled() {
String consumedSchemaClass = "schemata.event.SchemaDefined";

try {
// we don't instantiate directly, so the test can compile w/o a schemata server
Class schemaClass = this.getClass().getClassLoader().loadClass(consumedSchemaClass);
schemaClass.newInstance();

} catch (ClassNotFoundException e) {
fail("Class " + consumedSchemaClass + " could not be found. Either the schemata reference is missing in the pom or it has not been pulled.");
} catch (IllegalAccessException | InstantiationException e) {
fail("Class " + consumedSchemaClass + " could not be instantiated. Did schemata deliver broken code?");
}

}
}