package be.iminds.ilabt.jfed.lowlevel;

import org.testng.annotations.Test;

import static org.testng.Assert.*;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

public class GidTest {
    @Test
    public void testGid() {
        Gid g = new Gid(testUuidFull);
        assertThat(g.getSubjectUrn(), is("urn:publicid:IDN+wall2.ilabt.iminds.be:fed4fire+slice+toUe9qGlhvx8Jt"));
        assertThat(g.getSubjectUuid(), is("361f9e6f-820a-11e5-9d53-001517becdc1"));
    }
    @Test
    public void testGid2() {
        Gid g = new Gid(testUuid);
        assertThat(g.getSubjectUrn(), is("urn:publicid:IDN+wall2.ilabt.iminds.be:fed4fire+slice+toUe9qGlhvx8Jt"));
        assertThat(g.getSubjectUuid(), is("361f9e6f-820a-11e5-9d53-001517becdc1"));
    }

    private final String testUuid =
            "MIIDlTCCAv6gAwIBAgIDAkm1MA0GCSqGSIb3DQEBBAUAMIG1MQswCQYDVQQGEwJC\n" +
            "RTELMAkGA1UECBMCT1YxDjAMBgNVBAcTBUdoZW50MRgwFgYDVQQKEw9pTWluZHMg\n" +
            "LSBpbGFiLnQxHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhvcml0eTEjMCEGA1UE\n" +
            "AxMaYm9zcy53YWxsMi5pbGFidC5pbWluZHMuYmUxKjAoBgkqhkiG9w0BCQEWG3Z3\n" +
            "YWxsLW9wc0BhdGxhbnRpcy51Z2VudC5iZTAeFw0xNTExMDMwODA2NDdaFw0yMTA0\n" +
            "MjUwOTA2NDhaMIG1MQswCQYDVQQGEwJCRTELMAkGA1UECBMCT1YxGDAWBgNVBAoT\n" +
            "D2lNaW5kcyAtIGlsYWIudDEkMCIGA1UECxMbaW1pbmRzLXdhbGwyLnRvVWU5cUds\n" +
            "aHZ4OEp0MS0wKwYDVQQDEyQzNjFmOWU2Zi04MjBhLTExZTUtOWQ1My0wMDE1MTdi\n" +
            "ZWNkYzExKjAoBgkqhkiG9w0BCQEWG3dpbS52YW5kZW1lZXJzc2NoZUB1Z2VudC5i\n" +
            "ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAy7nqgd2BhH+xyq33O+omgMUW\n" +
            "43klUOA8J4JRonu6IcpezNrw+A0qPYMcz96aKQPxNWSjBaWkUJzCTNVvVvDEKSwI\n" +
            "uBQMzDGOHfSj9bXmfKo0/aWjX+u46OJkHLwbJ/B28y0f6RiV1i2jTTjI/0lK3wLW\n" +
            "0lkPb76r2Jg3d62dyosCAwEAAaOBsDCBrTAdBgNVHQ4EFgQU0KBZWHwguvx9/5Tt\n" +
            "bNyHTE+gOrAwfgYDVR0RBHcwdYZEdXJuOnB1YmxpY2lkOklETit3YWxsMi5pbGFi\n" +
            "dC5pbWluZHMuYmU6ZmVkNGZpcmUrc2xpY2UrdG9VZTlxR2xodng4SnSGLXVybjp1\n" +
            "dWlkOjM2MWY5ZTZmLTgyMGEtMTFlNS05ZDUzLTAwMTUxN2JlY2RjMTAMBgNVHRMB\n" +
            "Af8EAjAAMA0GCSqGSIb3DQEBBAUAA4GBAEv1D2hLX4LxjqwoOnX24LGYEhkWP0wZ\n" +
            "dL7eP1X94CaGAZReADpRJzYogIJG7ZAFh4bn7qIB5k5ooRt8VdOhbjFnwU9PvU1x\n" +
            "LwoknVJ+uqtmW16aLzR8MKVXjft/Q2c2SosN55s9bzCx0N064ESPWrmGrUtuTaVx\n" +
            "LYSV/EC2gZjD\n";
    private final String testUuidFull =
            "-----BEGIN CERTIFICATE-----\n" +
            testUuid +
            "-----END CERTIFICATE-----\n";
}
