Skip to content

Commit

Permalink
[#12] Setup basic Travis CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
apldev3 committed Sep 25, 2018
1 parent 9731a78 commit cb849a5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 16 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
os:
- linux

sudo: true

language: java

jdk:
- oraclejdk8
- openjdk8

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq protobuf-compiler trousers libtspi-dev

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

script:
- ./gradlew check
- make -C tpm_module/
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.nio.file.Paths;
import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;

import org.bouncycastle.util.encoders.Base64;

import static org.testng.Assert.fail;
Expand Down Expand Up @@ -187,11 +189,12 @@ public final void parseValidPlatformCertificate3() throws IOException, URISyntax

PlatformCredential credential = new PlatformCredential(certPath);
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 2, 23, 18, 34, 33);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(2017, 2, 23, 22, 34, 33);
calendar.set(Calendar.MILLISECOND, 0);
Assert.assertEquals(credential.getBeginValidity(), calendar.getTime());
calendar.set(2030, 11, 31, 18, 59, 59);
Assert.assertEquals(credential.getEndValidity(), calendar.getTime());
Assert.assertEquals(credential.getBeginValidity().getTime(), calendar.getTime().getTime());
calendar.set(2030, 11, 31, 23, 59, 59);
Assert.assertEquals(credential.getEndValidity().getTime(), calendar.getTime().getTime());

Assert.assertNotNull(credential.getAttributeCertificate());
byte[] sig = credential.getAttributeCertificate().getSignatureValue().getBytes();
Expand Down Expand Up @@ -235,11 +238,12 @@ public final void parseValidPlatformCertificate4() throws IOException, URISyntax

PlatformCredential credential = new PlatformCredential(certPath);
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 2, 23, 18, 34, 33);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(2017, 2, 23, 22, 34, 33);
calendar.set(Calendar.MILLISECOND, 0);
Assert.assertEquals(credential.getBeginValidity(), calendar.getTime());
calendar.set(2030, 11, 31, 18, 59, 59);
Assert.assertEquals(credential.getEndValidity(), calendar.getTime());
Assert.assertEquals(credential.getBeginValidity().getTime(), calendar.getTime().getTime());
calendar.set(2030, 11, 31, 23, 59, 59);
Assert.assertEquals(credential.getEndValidity().getTime(), calendar.getTime().getTime());

Assert.assertNotNull(credential.getAttributeCertificate());
byte[] sig = credential.getAttributeCertificate().getSignatureValue().getBytes();
Expand Down Expand Up @@ -283,11 +287,12 @@ public final void parseValidPlatformCertificate5() throws IOException, URISyntax
PlatformCredential credential = new PlatformCredential(certPath);

Calendar calendar = Calendar.getInstance();
calendar.set(2017, 3, 21, 13, 5, 29);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(2017, 3, 21, 17, 5, 29);
calendar.set(Calendar.MILLISECOND, 0);
Assert.assertEquals(credential.getBeginValidity(), calendar.getTime());
calendar.set(2030, 11, 31, 18, 59, 59);
Assert.assertEquals(credential.getEndValidity(), calendar.getTime());
Assert.assertEquals(credential.getBeginValidity().getTime(), calendar.getTime().getTime());
calendar.set(2030, 11, 31, 23, 59, 59);
Assert.assertEquals(credential.getEndValidity().getTime(), calendar.getTime().getTime());

Assert.assertNotNull(credential.getAttributeCertificate());
byte[] sig = credential.getAttributeCertificate().getSignatureValue().getBytes();
Expand Down Expand Up @@ -327,11 +332,12 @@ public final void parseValidPlatformCertificate6() throws IOException, URISyntax
PlatformCredential credential = new PlatformCredential(certPath);

Calendar calendar = Calendar.getInstance();
calendar.set(2017, 3, 21, 13, 5, 30);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(2017, 3, 21, 17, 5, 30);
calendar.set(Calendar.MILLISECOND, 0);
Assert.assertEquals(credential.getBeginValidity(), calendar.getTime());
calendar.set(2030, 11, 31, 18, 59, 59);
Assert.assertEquals(credential.getEndValidity(), calendar.getTime());
Assert.assertEquals(credential.getBeginValidity().getTime(), calendar.getTime().getTime());
calendar.set(2030, 11, 31, 23, 59, 59);
Assert.assertEquals(credential.getEndValidity().getTime(), calendar.getTime().getTime());

Assert.assertNotNull(credential.getAttributeCertificate());
byte[] sig = credential.getAttributeCertificate().getSignatureValue().getBytes();
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ subprojects {
mavenCentral()
}

test {
testLogging {
exceptionFormat = 'full'
}
}

tasks.withType(Test) {
useTestNG() {
includeGroups = project.ext.includeGroups.split()
Expand Down

0 comments on commit cb849a5

Please sign in to comment.