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"));
}
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());
}
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());
}
Aggregations