use of com.adobe.target.delivery.v1.model.Address in project summary-care-record-api by NHSDigital.
the class AgentOrganisationMapper method mapOrganization.
private Organization mapOrganization(Node agentOrganisation) {
Organization org;
Optional<Node> orgNode = xmlUtils.detachOptionalNodeByXPath(agentOrganisation, ORG_XPATH);
if (orgNode.isPresent()) {
org = organisationMapper.mapOrganization(orgNode.get());
} else {
org = new Organization();
org.setId(randomUUID());
}
org.setTelecom(mapContactPoints(agentOrganisation));
xmlUtils.getOptionalValueByXPath(agentOrganisation, ADDRESS_XPATH).ifPresent(val -> org.addAddress(new Address().setText(val)));
return org;
}
use of com.adobe.target.delivery.v1.model.Address in project elexis-server by elexis.
the class OrganizationTest method getOrganizationProperties.
/**
* Test all properties set by
* {@link TestDatabaseInitializer#initializeOrganization()}.
*/
@Test
public void getOrganizationProperties() {
Organization readOrganization = client.read().resource(Organization.class).withId(TestDatabaseInitializer.getOrganization().getId()).execute();
assertNotNull(readOrganization);
assertEquals("Test Organization", readOrganization.getName());
List<ContactPoint> telcoms = readOrganization.getTelecom();
assertNotNull(telcoms);
assertEquals(2, telcoms.size());
assertEquals(1, telcoms.get(0).getRank());
assertEquals("+01555345", telcoms.get(0).getValue());
assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
assertEquals("+01444345", telcoms.get(1).getValue());
List<Address> addresses = readOrganization.getAddress();
assertNotNull(addresses);
assertEquals(1, addresses.size());
assertEquals("City", addresses.get(0).getCity());
assertEquals("123", addresses.get(0).getPostalCode());
assertEquals("Street 10", addresses.get(0).getLine().get(0).asStringValue());
}
use of com.adobe.target.delivery.v1.model.Address in project elexis-server by elexis.
the class PatientTest method createDeletePatient.
@Test
public void createDeletePatient() {
Patient patient = new Patient();
HumanName hn = new HumanName();
hn.setUse(NameUse.OFFICIAL);
hn.setFamily("familyName");
patient.setName(Collections.singletonList(hn));
patient.setBirthDate(new Date());
Address address = new Address();
address.setCity("City");
address.setCountry("CH");
patient.setAddress(Collections.singletonList(address));
// create
MethodOutcome execute = client.create().resource(patient).execute();
assertTrue(execute.getCreated());
assertNotNull(execute.getId());
assertEquals("Patient", execute.getId().getResourceType());
IIdType id = execute.getId();
Patient created = client.read().resource(Patient.class).withId(id).execute();
assertEquals(hn.getFamily(), created.getName().get(0).getFamily());
// delete
client.delete().resource(created).execute();
Optional<IPatient> load = AllTests.getModelService().load(id.getIdPart(), IPatient.class, true);
assertTrue(load.isPresent());
assertTrue(load.get().isDeleted());
}
use of com.adobe.target.delivery.v1.model.Address in project integration-adaptor-111 by nhsconnect.
the class AddressMapperTest method shouldMapAddress.
@Test
public void shouldMapAddress() {
Address address = addressMapper.mapAddress(itkAddress);
assertThat(address.getUse()).isEqualTo(AddressUse.HOME);
assertThat(address.getLine().get(0).getValue()).isEqualTo(ADDRESS_LINE);
assertThat(address.getCity()).isEqualTo(CITY);
assertThat(address.getPostalCode()).isEqualTo(POSTAL_CODE);
assertThat(address.getCountry()).isEqualTo(COUNTRY);
assertThat(address.getText()).isEqualTo(DESCRIPTION);
assertThat(address.getState()).isEqualTo(STATE);
assertThat(address.getDistrict()).isEqualTo(DISTRICT);
assertThat(address.getPeriod()).isEqualTo(period);
}
use of com.adobe.target.delivery.v1.model.Address in project target-java-sdk by adobe.
the class PageParamsCollatorTest method testCollator.
@Test
public void testCollator() {
VisitorProvider.init("testOrgId");
String url = "http://WWW.TARGET.ADOBE.COM/ABOUT/?foo=bar&name=JimmyG#Part1";
RequestDetails pageLoad = new RequestDetails();
TargetDeliveryRequest request = TargetDeliveryRequest.builder().execute(new ExecuteRequest().pageLoad(pageLoad)).context(new Context().address(new Address().url(url))).build();
PageParamsCollator collator = new PageParamsCollator();
Map<String, Object> result = collator.collateParams(request, pageLoad);
assertEquals(url, result.get(PageParamsCollator.PAGE_URL));
assertEquals(url.toLowerCase(), result.get(PageParamsCollator.PAGE_URL_LOWER));
assertEquals("/ABOUT/", result.get(PageParamsCollator.PAGE_PATH));
assertEquals("/about/", result.get(PageParamsCollator.PAGE_PATH_LOWER));
assertEquals("WWW.TARGET.ADOBE.COM", result.get(PageParamsCollator.PAGE_DOMAIN));
assertEquals("www.target.adobe.com", result.get(PageParamsCollator.PAGE_DOMAIN_LOWER));
assertEquals("TARGET", result.get(PageParamsCollator.PAGE_SUBDOMAIN));
assertEquals("target", result.get(PageParamsCollator.PAGE_SUBDOMAIN_LOWER));
assertEquals("COM", result.get(PageParamsCollator.PAGE_TOP_LEVEL_DOMAIN));
assertEquals("com", result.get(PageParamsCollator.PAGE_TOP_LEVEL_DOMAIN_LOWER));
assertEquals("foo=bar&name=JimmyG", result.get(PageParamsCollator.PAGE_QUERY));
assertEquals("foo=bar&name=jimmyg", result.get(PageParamsCollator.PAGE_QUERY_LOWER));
assertEquals("Part1", result.get(PageParamsCollator.PAGE_FRAGMENT));
assertEquals("part1", result.get(PageParamsCollator.PAGE_FRAGMENT_LOWER));
}
Aggregations