Search in sources :

Example 1 with S3Updater

use of org.orcid.listener.s3.S3Updater in project ORCID-Source by ORCID.

the class S3UpdaterTest method getBucketChecksumTest.

@Test
public void getBucketChecksumTest() throws JAXBException {
    S3Updater s3 = new S3Updater("bucket-qa");
    assertEquals("all", s3.getBucketCheckSum("0000-0000-0000-0000"));
    s3 = new S3Updater("bucket-sandbox");
    assertEquals("all", s3.getBucketCheckSum("0000-0000-0000-0000"));
    s3 = new S3Updater("bucket-production");
    assertEquals("0", s3.getBucketCheckSum("0000-0000-0000-0000"));
    assertEquals("1", s3.getBucketCheckSum("0000-0000-0000-0001"));
    assertEquals("x", s3.getBucketCheckSum("0000-0000-0000-000X"));
}
Also used : S3Updater(org.orcid.listener.s3.S3Updater) Test(org.junit.Test)

Example 2 with S3Updater

use of org.orcid.listener.s3.S3Updater in project ORCID-Source by ORCID.

the class S3UpdaterTest method updateS3_OrcidProfileTest.

@Test
public void updateS3_OrcidProfileTest() throws JAXBException, JsonProcessingException, AmazonClientException {
    String bucketPrefix = "bucket-production";
    String orcid = "0000-0000-0000-000X";
    OrcidMessage om = new OrcidMessage();
    OrcidProfile op = new OrcidProfile();
    op.setOrcidIdentifier(orcid);
    om.setOrcidProfile(op);
    S3Updater s3 = new S3Updater(bucketPrefix);
    s3.setS3MessagingService(s3MessagingService);
    s3.updateS3(orcid, om);
    verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-json-x"), Matchers.eq(orcid + ".json"), Matchers.anyString());
    verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
    verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-json-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
    verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) S3Updater(org.orcid.listener.s3.S3Updater) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) Test(org.junit.Test)

Example 3 with S3Updater

use of org.orcid.listener.s3.S3Updater in project ORCID-Source by ORCID.

the class S3UpdaterTest method updateS3_RecordTest.

@Test
public void updateS3_RecordTest() throws JAXBException, JsonProcessingException, AmazonClientException {
    String bucketPrefix = "bucket-production";
    String orcid = "0000-0000-0000-000X";
    Record record = new Record();
    record.setOrcidIdentifier(new OrcidIdentifier(orcid));
    S3Updater s3 = new S3Updater(bucketPrefix);
    s3.setS3MessagingService(s3MessagingService);
    s3.updateS3(orcid, record);
    verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-1-2-json-x"), Matchers.eq(orcid + ".json"), Matchers.anyString());
    verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-1-2-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
    verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-2-0-json-x"), Matchers.eq(orcid + ".json"), Matchers.anyString());
    verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-2-0-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
}
Also used : S3Updater(org.orcid.listener.s3.S3Updater) OrcidIdentifier(org.orcid.jaxb.model.common_v2.OrcidIdentifier) Record(org.orcid.jaxb.model.record_v2.Record) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 S3Updater (org.orcid.listener.s3.S3Updater)3 OrcidIdentifier (org.orcid.jaxb.model.common_v2.OrcidIdentifier)1 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 Record (org.orcid.jaxb.model.record_v2.Record)1