Skip to content

Commit

Permalink
Merge pull request OPCFoundation#41 from nilsga/move-jdk6-requirement…
Browse files Browse the repository at this point in the history
…-into-profile

Move jdk6 toolchain requirement into profile
  • Loading branch information
bjakke committed May 23, 2016
2 parents 2e4a45c + f04d31a commit 15ad0d7
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Maven needs to know where your JDK 6 installation is. To setup this create a fil
</toolchain>
</toolchains>
```
If you have no need to have a Java 6 supported build artifact, then you can remove the maven-toolchains-plugin from the pom.xml before building the project.
If you have no need to have a Java 6 supported build artifact, then you can run the build with the `jdk6` profile disabled.

#### Compiling ####

Expand Down
88 changes: 55 additions & 33 deletions pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,27 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<id>prepare-unit-tests</id>
<goals>
<goal>prepare-agent</goal>
<execution>
<id>prepare-unit-tests</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<excludes>
<exclude>org.opcfoundation.ua.core.Identifiers</exclude>
</excludes>
</configuration>
</configuration>
</execution>
<execution>
<id>prepare-integration-tests</id>
<goals>
<goal>prepare-agent-integration</goal>
<execution>
<id>prepare-integration-tests</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<excludes>
<exclude>org.opcfoundation.ua.core.Identifiers</exclude>
</excludes>
</configuration>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -140,29 +140,6 @@
</executions>
</plugin>
<!-- This plugin ensures we are actually building on JDK 6 -->
<!-- You need to create toolchains.xml in your .m2 folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>check-toolchain</id>
<phase>validate</phase>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.6</version>
<vendor>sun</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -247,4 +224,49 @@
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>jdk6</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<useJdk6Toolchain>true</useJdk6Toolchain>
</systemPropertyVariables>
</configuration>
</plugin>
<!-- This plugin ensures we are actually building on JDK 6 -->
<!-- You need to create toolchains.xml in your .m2 folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>check-toolchain</id>
<phase>validate</phase>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.6</version>
<vendor>sun</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
8 changes: 8 additions & 0 deletions src/test/java/org/opcfoundation/ua/BuildHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.opcfoundation.ua;

public class BuildHelper {

public static boolean isJdk6Toolchain() {
return "true".equalsIgnoreCase(System.getProperty("useJdk6Toolchain"));
}
}
27 changes: 22 additions & 5 deletions src/test/java/org/opcfoundation/ua/unittests/TestStack.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
* ======================================================================*/

package org.opcfoundation.ua.unittests;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.opcfoundation.ua.BuildHelper;
import org.opcfoundation.ua.application.Client;
import org.opcfoundation.ua.application.Server;
import org.opcfoundation.ua.application.TestStackService;
Expand All @@ -43,7 +48,6 @@
import org.opcfoundation.ua.core.TestStackRequest;
import org.opcfoundation.ua.core.TestStackResponse;
import org.opcfoundation.ua.transport.AsyncResult;
import org.opcfoundation.ua.transport.Endpoint;
import org.opcfoundation.ua.transport.SecureChannel;
import org.opcfoundation.ua.transport.security.BcCryptoProvider;
import org.opcfoundation.ua.transport.security.HttpsSecurityPolicy;
Expand All @@ -52,21 +56,18 @@
import org.opcfoundation.ua.utils.CryptoUtil;
import org.opcfoundation.ua.utils.StackUtils;

import junit.framework.TestCase;

/**
* Stress test & performance test using a loop-back server.
*
*/
public class TestStack extends TestCase {
public class TestStack {

/** Timeout for a single test (Seconds) */
final static int ITERATION_TIMEOUT = 300;

String uri;
int keySize;
Server server;
Endpoint endpoint;
SecureChannel secureChannel;

// Fill array with debug data
Expand All @@ -78,6 +79,8 @@ public void fill(byte[] data)
data[i] = (byte) (r.nextInt(256) - 128);
}

@Test
@Ignore
public void ignoreTestHttps_TLS_1_2() throws Exception {
try {
_setupTest("https://localhost:6125/TestServer", HttpsSecurityPolicy.TLS_1_2, 4096);
Expand All @@ -87,7 +90,9 @@ public void ignoreTestHttps_TLS_1_2() throws Exception {
}
}

@Test
public void testHttps_TLS_1_0() throws Exception {
Assume.assumeTrue(BuildHelper.isJdk6Toolchain());
try {
_setupTest("https://localhost:6125/TestServer", HttpsSecurityPolicy.TLS_1_0, 2048);
executeTest();
Expand All @@ -96,6 +101,7 @@ public void testHttps_TLS_1_0() throws Exception {
}
}

@Test
public void testHttps_TLS_1_1() throws Exception {
try {
_setupTest("https://localhost:6125/TestServer", HttpsSecurityPolicy.TLS_1_1, 2048);
Expand All @@ -105,6 +111,7 @@ public void testHttps_TLS_1_1() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC128RSA15_SIGN_BC() throws Exception {
try {
CryptoUtil.setCryptoProvider(new BcCryptoProvider());
Expand All @@ -115,6 +122,7 @@ public void testOPC_TCP_BASIC128RSA15_SIGN_BC() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC128RSA15_SIGN_ENCRYPT_BC() throws Exception {
try {
CryptoUtil.setCryptoProvider(new BcCryptoProvider());
Expand All @@ -125,6 +133,7 @@ public void testOPC_TCP_BASIC128RSA15_SIGN_ENCRYPT_BC() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC128RSA15_SIGN_ENCRYPT_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC128RSA15_SIGN_ENCRYPT, 2048);
Expand All @@ -134,6 +143,7 @@ public void testOPC_TCP_BASIC128RSA15_SIGN_ENCRYPT_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC128RSA15_SIGN_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC128RSA15_SIGN, 2048);
Expand All @@ -143,6 +153,7 @@ public void testOPC_TCP_BASIC128RSA15_SIGN_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256_SIGN_ENCRYPT_BC() throws Exception {
try {
CryptoUtil.setCryptoProvider(new BcCryptoProvider());
Expand All @@ -154,6 +165,7 @@ public void testOPC_TCP_BASIC256_SIGN_ENCRYPT_BC() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256_SIGN_ENCRYPT_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC256_SIGN_ENCRYPT, 2048);
Expand All @@ -163,6 +175,7 @@ public void testOPC_TCP_BASIC256_SIGN_ENCRYPT_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256_SIGN_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC256_SIGN, 2048);
Expand All @@ -172,6 +185,7 @@ public void testOPC_TCP_BASIC256_SIGN_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256SHA256_SIGN_ENCRYPT_BC() throws Exception {
try {
CryptoUtil.setCryptoProvider(new BcCryptoProvider());
Expand All @@ -183,6 +197,7 @@ public void testOPC_TCP_BASIC256SHA256_SIGN_ENCRYPT_BC() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256SHA256_SIGN_ENCRYPT_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC256SHA256_SIGN_ENCRYPT, 4096);
Expand All @@ -192,6 +207,7 @@ public void testOPC_TCP_BASIC256SHA256_SIGN_ENCRYPT_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_BASIC256SHA256_SIGN_JCE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.BASIC256SHA256_SIGN, 4096);
Expand All @@ -201,6 +217,7 @@ public void testOPC_TCP_BASIC256SHA256_SIGN_JCE() throws Exception {
}
}

@Test
public void testOPC_TCP_NONE() throws Exception {
try {
_setupTest("opc.tcp://localhost:6125/TestServer", SecurityMode.NONE, 2048);
Expand Down

0 comments on commit 15ad0d7

Please sign in to comment.