X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Faaf%2Fmarshal%2Ftest%2FJU_CertMarshal.java;h=96061aa84bbe009980a3ea0cd571d0f7839fe4e4;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=560014d10917b5d7c10b69679d64f1974feec7c2;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/test/JU_CertMarshal.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/test/JU_CertMarshal.java index 560014d1..96061aa8 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/test/JU_CertMarshal.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/test/JU_CertMarshal.java @@ -42,58 +42,58 @@ import aaf.v2_0.Certs.Cert; public class JU_CertMarshal { - private static final String fingerprint = "fingerprint"; - private static final String id = "id"; - private static final String x500 = "x500"; - - private String fingerprintAsString; - - private XMLGregorianCalendar expires; - - private ByteArrayOutputStream outStream; - - @Before - public void setup() { - expires = Chrono.timeStamp(); - outStream = new ByteArrayOutputStream(); - StringBuilder sb = new StringBuilder(); - DataWriter.HEX_BINARY.write(fingerprint.getBytes(), sb); - fingerprintAsString = sb.toString(); - } - - @Test - public void test() throws ParseException, IOException { - Cert cert = setupCert(); - CertMarshal cm = new CertMarshal(); - OutRaw raw = new OutRaw(); - - raw.extract(cert, new PrintStream(outStream), cm); - - String[] output = outStream.toString().split("\n"); - - String[] expected = new String[] { - "{ - ", - ", - fingerprint : \"" + fingerprintAsString + "\"", - ", - id : \"" + id + "\"", - ", - x500 : \"" + x500 + "\"", - ", - expires : \"" + Chrono.dateTime(expires) + "\"", - "} - ", - }; - - assertThat(output.length, is(expected.length)); - - for (int i = 0; i < output.length; i++) { - assertThat(output[i], is(expected[i])); - } - } - - private Cert setupCert() { - Cert cert = new Cert(); - cert.setId(id); - cert.setX500(x500); - cert.setExpires(expires); - cert.setFingerprint(fingerprint.getBytes()); - return cert; - } + private static final String fingerprint = "fingerprint"; + private static final String id = "id"; + private static final String x500 = "x500"; + + private String fingerprintAsString; + + private XMLGregorianCalendar expires; + + private ByteArrayOutputStream outStream; + + @Before + public void setup() { + expires = Chrono.timeStamp(); + outStream = new ByteArrayOutputStream(); + StringBuilder sb = new StringBuilder(); + DataWriter.HEX_BINARY.write(fingerprint.getBytes(), sb); + fingerprintAsString = sb.toString(); + } + + @Test + public void test() throws ParseException, IOException { + Cert cert = setupCert(); + CertMarshal cm = new CertMarshal(); + OutRaw raw = new OutRaw(); + + raw.extract(cert, new PrintStream(outStream), cm); + + String[] output = outStream.toString().split("\n"); + + String[] expected = new String[] { + "{ - ", + ", - fingerprint : \"" + fingerprintAsString + "\"", + ", - id : \"" + id + "\"", + ", - x500 : \"" + x500 + "\"", + ", - expires : \"" + Chrono.dateTime(expires) + "\"", + "} - ", + }; + + assertThat(output.length, is(expected.length)); + + for (int i = 0; i < output.length; i++) { + assertThat(output[i], is(expected[i])); + } + } + + private Cert setupCert() { + Cert cert = new Cert(); + cert.setId(id); + cert.setX500(x500); + cert.setExpires(expires); + cert.setFingerprint(fingerprint.getBytes()); + return cert; + } }