Skip to content

Commit

Permalink
Enable some previously disabled longer running tests (#974)
Browse files Browse the repository at this point in the history
* Enable integration tests
* jnacl and kalium (only run when corresponding profile is active)
* jnacl encrypt and decrypt
* Remove CoreIT, enable jersey server ITs, undo grpc-related exclusions
  • Loading branch information
chris-j-h authored and melowe committed Jan 20, 2020
1 parent a5d9c51 commit 8dea70b
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 128 deletions.
17 changes: 14 additions & 3 deletions config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<groupId>com.jpmorgan.quorum</groupId>
<artifactId>encryption-jnacl</artifactId>
</dependency>

<dependency>
<groupId>com.jpmorgan.quorum</groupId>
<artifactId>encryption-ec</artifactId>
Expand Down Expand Up @@ -97,10 +97,21 @@
</manifest>
</archive>
</configuration>

</plugin>

</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
//package com.quorum.tessera.keyenc;
//
//import Argon2;
//import Key;
//import NaclFacade;
//import NaclFacadeFactory;
//import org.assertj.core.api.Assertions;
//import org.junit.Before;
//import org.junit.Test;
//
//import javax.json.JsonObject;
//import java.util.Base64;
//
//public class KeyEncryptorIT {
//
// private static final String pkeyBase64 = "kwMSmHpIhCFFoOCyGkHkJyfLVxsa9Mj3Y23sFYRLwLM=";
//
// private static final String password = "PASS_WORD";
//
// private KeyEncryptor keyEncryptor;
//
// private Key privateKey;
//
// @Before
// public void init() {
//
// final NaclFacade nacl = NaclFacadeFactory.newFactory().create();
// final Argon2 argon2 = Argon2.create();
//
// this.privateKey = new Key(Base64.getDecoder().decode(pkeyBase64));
//
// this.keyEncryptor = new KeyEncryptorImpl(argon2, nacl);
// }
//
// @Test
// public void encryptAndDecryptOnKeyIsSuccessful() {
//
// final JsonObject jsonObject = keyEncryptor.encryptPrivateKey(privateKey, password);
//
// final Key decryptedKey = keyEncryptor.decryptPrivateKey(jsonObject, password);
//
// Assertions.assertThat(decryptedKey).isEqualTo(privateKey);
//
// }
//
//}
package com.quorum.tessera.config.keys;

import com.quorum.tessera.config.ArgonOptions;
import com.quorum.tessera.config.EncryptorConfig;
import com.quorum.tessera.config.EncryptorType;
import com.quorum.tessera.config.PrivateKeyData;
import com.quorum.tessera.encryption.PrivateKey;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Base64;

import static org.assertj.core.api.Assertions.assertThat;

public class KeyEncryptorIT {

private static final Logger LOGGER = LoggerFactory.getLogger(KeyEncryptorIT.class);

private static final String pkeyBase64 = "kwMSmHpIhCFFoOCyGkHkJyfLVxsa9Mj3Y23sFYRLwLM=";

private static final String password = "PASS_WORD";

private KeyEncryptor keyEncryptor;

private PrivateKey privateKey;

@Before
public void init() {
this.privateKey = PrivateKey.from(Base64.getDecoder().decode(pkeyBase64));

this.keyEncryptor =
KeyEncryptorFactory.newFactory()
.create(
new EncryptorConfig() {
{
setType(EncryptorType.NACL);
}
});
}

@Test
public void encryptAndDecryptOnKeyIsSuccessful() {
ArgonOptions argonOptions = new ArgonOptions("i", 10, 1048576, 4);

final PrivateKeyData privateKeyData = keyEncryptor.encryptPrivateKey(privateKey, password, argonOptions);
final PrivateKey decryptedKey = keyEncryptor.decryptPrivateKey(privateKeyData, password);

assertThat(decryptedKey).isEqualTo(privateKey);
}
}
19 changes: 18 additions & 1 deletion encryption/encryption-jnacl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</dependency>

</dependencies>

<profiles>
<profile>
<id>kalium</id>
Expand All @@ -51,4 +51,21 @@
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
17 changes: 17 additions & 0 deletions encryption/encryption-kalium/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,21 @@
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
22 changes: 19 additions & 3 deletions server/jaxrs-client-unixsocket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-unixsocket</artifactId>
Expand Down Expand Up @@ -50,6 +50,22 @@
</dependency>

</dependencies>



<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
55 changes: 18 additions & 37 deletions server/jersey-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<artifactId>server</artifactId>
<version>0.11-SNAPSHOT</version>
</parent>

<artifactId>jersey-server</artifactId>

<name>jersey-server</name>
Expand All @@ -22,14 +22,14 @@
<artifactId>grizzly-http-servlet</artifactId>
<version>2.4.3.1</version>
</dependency>

<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>


</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -58,12 +58,6 @@
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -74,10 +68,6 @@
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
Expand All @@ -94,12 +84,6 @@
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -121,31 +105,15 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -164,6 +132,19 @@
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
38 changes: 0 additions & 38 deletions tessera-core/src/test/java/com/quorum/tessera/core/CoreIT.java

This file was deleted.

0 comments on commit 8dea70b

Please sign in to comment.