use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory in project cxf by apache.
the class AbstractSequenceTest method testIdentifierEquals.
@Test
public void testIdentifierEquals() {
Identifier id1 = null;
Identifier id2 = null;
assertTrue(AbstractSequence.identifierEquals(id1, id2));
ObjectFactory factory = new ObjectFactory();
id1 = factory.createIdentifier();
id1.setValue("seq1");
assertTrue(!AbstractSequence.identifierEquals(id1, id2));
id2 = factory.createIdentifier();
id2.setValue("seq2");
assertTrue(!AbstractSequence.identifierEquals(id1, id2));
id2.setValue("seq1");
assertTrue(AbstractSequence.identifierEquals(id1, id2));
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory in project webcert by sklintyg.
the class SendMessageToRecipientTypeConverter method toXml.
public static String toXml(SendMessageToRecipientType request) throws JAXBException {
StringWriter stringWriter = new StringWriter();
JAXBElement<SendMessageToRecipientType> requestElement = new ObjectFactory().createSendMessageToRecipient(request);
JAXBContext.newInstance(SendMessageToRecipientType.class).createMarshaller().marshal(requestElement, stringWriter);
return stringWriter.toString();
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory in project webcert by sklintyg.
the class FKAnswerConverterTest method jaxbToXml.
private String jaxbToXml(AnswerToFkType object) throws JAXBException {
ObjectFactory objectFactory = new ObjectFactory();
Writer writer = new StringWriter();
// Init JAXB context
JAXBContext jaxbContext = JAXBContext.newInstance(AnswerToFkType.class);
Marshaller marshaller = jaxbContext.createMarshaller();
// Create a string representation from JAXB element
marshaller.marshal(objectFactory.createAnswer(object), writer);
return writer.toString();
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory in project webcert by sklintyg.
the class FKQuestionConverterTest method jaxbToXml.
private String jaxbToXml(QuestionToFkType object) throws JAXBException {
ObjectFactory objectFactory = new ObjectFactory();
Writer writer = new StringWriter();
// Init JAXB context
JAXBContext jaxbContext = JAXBContext.newInstance(QuestionToFkType.class);
Marshaller marshaller = jaxbContext.createMarshaller();
// Create a string representation from JAXB element
marshaller.marshal(objectFactory.createQuestion(object), writer);
return writer.toString();
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory in project mapstruct by mapstruct.
the class JaxbBasedMapperTest method shouldMapJaxb.
@Test
public void shouldMapJaxb() throws ParseException, JAXBException {
SourceTargetMapper mapper = SourceTargetMapper.INSTANCE;
OrderDto source1 = new OrderDto();
source1.setOrderDetails(new OrderDetailsDto());
source1.setOrderNumber(11L);
source1.setOrderDate(createDate("31-08-1982 10:20:56"));
source1.setShippingAddress(new ShippingAddressDto());
source1.getShippingAddress().setCity("SmallTown");
source1.getShippingAddress().setHouseNumber("11a");
source1.getShippingAddress().setStreet("Awesome rd");
source1.getShippingAddress().setCountry("USA");
source1.getOrderDetails().setDescription(new ArrayList<String>());
source1.getOrderDetails().setName("Shopping list for a Mapper");
source1.getOrderDetails().getDescription().add("1 MapStruct");
source1.getOrderDetails().getDescription().add("3 Lines of Code");
source1.getOrderDetails().getDescription().add("1 Dose of Luck");
source1.getOrderDetails().setStatus(OrderStatusDto.ORDERED);
// map to JAXB
OrderType target = mapper.targetToSource(source1);
// do a pretty print
ObjectFactory of = new ObjectFactory();
System.out.println(toXml(of.createOrder(target)));
// map back from JAXB
OrderDto source2 = mapper.sourceToTarget(target);
// verify that source1 and source 2 are equal
assertThat(source2.getOrderNumber()).isEqualTo(source1.getOrderNumber());
assertThat(source2.getOrderDate()).isEqualTo(source1.getOrderDate());
assertThat(source2.getOrderDetails().getDescription().size()).isEqualTo(source1.getOrderDetails().getDescription().size());
assertThat(source2.getOrderDetails().getDescription().get(0)).isEqualTo(source1.getOrderDetails().getDescription().get(0));
assertThat(source2.getOrderDetails().getDescription().get(1)).isEqualTo(source1.getOrderDetails().getDescription().get(1));
assertThat(source2.getOrderDetails().getDescription().get(2)).isEqualTo(source1.getOrderDetails().getDescription().get(2));
assertThat(source2.getOrderDetails().getName()).isEqualTo(source1.getOrderDetails().getName());
assertThat(source2.getOrderDetails().getStatus()).isEqualTo(source1.getOrderDetails().getStatus());
}
Aggregations