use of org.orcid.jaxb.model.record_rc4.OtherName in project ORCID-Source by ORCID.
the class ValidateV2RC2SamplesTest method testUnmarshallOtherNames.
@Test
public void testUnmarshallOtherNames() throws SAXException, URISyntaxException {
OtherNames otherNames = (OtherNames) unmarshallFromPath("/record_2.0_rc2/samples/other-names-2.0_rc2.xml", OtherNames.class, "/record_2.0_rc2/personal-details-2.0_rc2.xsd");
assertNotNull(otherNames);
assertNotNull(otherNames.getOtherNames());
assertEquals(2, otherNames.getOtherNames().size());
for (OtherName otherName : otherNames.getOtherNames()) {
assertThat(otherName.getContent(), anyOf(is("Other Name #1"), is("Other Name #2")));
assertThat(otherName.getPutCode(), anyOf(is(1L), is(2L)));
assertEquals(Visibility.PUBLIC.value(), otherName.getVisibility().value());
assertNotNull(otherName.getCreatedDate());
assertNotNull(otherName.getLastModifiedDate());
assertNotNull(otherName.getSource());
assertEquals("8888-8888-8888-8880", otherName.getSource().retrieveSourcePath());
}
OtherName otherName = (OtherName) unmarshallFromPath("/record_2.0_rc2/samples/other-name-2.0_rc2.xml", OtherName.class);
assertNotNull(otherName);
assertEquals("Other Name #1", otherName.getContent());
assertEquals(Long.valueOf(1), otherName.getPutCode());
assertEquals(Visibility.PUBLIC.value(), otherName.getVisibility().value());
assertNotNull(otherName.getCreatedDate());
assertNotNull(otherName.getLastModifiedDate());
assertNotNull(otherName.getSource());
assertEquals("8888-8888-8888-8880", otherName.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc4.OtherName in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getOtherNamesElement.
private OtherNames getOtherNamesElement(Visibility... vs) {
OtherNames otherNames = new OtherNames();
for (Visibility v : vs) {
OtherName o = new OtherName();
o.setVisibility(v);
if (otherNames.getOtherNames() == null) {
otherNames.setOtherNames(new ArrayList<OtherName>());
}
otherNames.getOtherNames().add(o);
}
return otherNames;
}
use of org.orcid.jaxb.model.record_rc4.OtherName in project robovm by robovm.
the class X509CertSelectorTest method test_getPathToNames.
/**
* java.security.cert.X509CertSelector#getPathToNames()
*/
public void test_getPathToNames() throws Exception {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5", new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "rfc@822.Name");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
sans1.addName(san3);
sans1.addName(san4);
sans1.addName(san6);
sans1.addName(san7);
sans1.addName(san8);
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setPathToNames(null);
assertTrue("Any certificate should match in the case of null " + "subjectAlternativeNames criteria.", selector.match(cert1) && selector.match(cert2));
Collection<List<?>> sans = sans1.getPairsList();
selector.setPathToNames(sans);
selector.getPathToNames();
}
use of org.orcid.jaxb.model.record_rc4.OtherName in project robovm by robovm.
the class X509CertSelectorTest method test_addSubjectAlternativeNameLintLbyte_array2.
/**
* java.security.cert.X509CertSelector#addSubjectAlternativeName(int, byte[])
*/
public void test_addSubjectAlternativeNameLintLbyte_array2() throws Exception {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5", new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "rfc@822.Name");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
X509CertSelector selector = new X509CertSelector();
selector.addSubjectAlternativeName(0, san0.getEncodedName());
selector.addSubjectAlternativeName(1, san1.getEncodedName());
selector.addSubjectAlternativeName(2, san2.getEncodedName());
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
assertTrue(selector.match(cert1));
assertFalse(selector.match(cert2));
selector.setSubjectAlternativeNames(null);
GeneralName name = new GeneralName(new Name("O=Android"));
try {
selector.addSubjectAlternativeName(0, name.getEncodedName());
} catch (IOException e) {
// ok
}
}
use of org.orcid.jaxb.model.record_rc4.OtherName in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getOtherNameMapperFacade.
public MapperFacade getOtherNameMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<OtherName, OtherNameEntity> otherNameClassMap = mapperFactory.classMap(OtherName.class, OtherNameEntity.class);
addV2DateFields(otherNameClassMap);
registerSourceConverters(mapperFactory, otherNameClassMap);
otherNameClassMap.field("putCode", "id");
otherNameClassMap.field("content", "displayName");
otherNameClassMap.field("path", "profile.orcid");
otherNameClassMap.fieldBToA("displayIndex", "displayIndex");
otherNameClassMap.byDefault();
otherNameClassMap.register();
return mapperFactory.getMapperFacade();
}
Aggregations