use of no.difi.meldingsutveksling.noarkexchange.p360.schema in project policies-ui-backend by RedHatInsights.
the class OapiTest method validateOpenApi.
@Test
void validateOpenApi() throws Exception {
OpenApi3 model = new OpenApi3Parser().parse(url, true);
System.out.printf("OpenAPI Model at %s\n", url);
if (!model.isValid()) {
for (ValidationResults.ValidationItem item : model.getValidationItems()) {
System.err.println(item);
}
fail("OpenAPI spec is not valid");
}
//
// Now that basic validation is done, we can add some of our own
//
Map<String, Path> paths = model.getPaths();
Map<String, Schema> schemas = model.getSchemas();
// The base path filler. See also OASModifier.mangleName
assertTrue(paths.containsKey("/"));
// User config is private, so don't show it
assertFalse(paths.containsKey("/user-config"));
assertFalse(schemas.containsKey("SettingsValues"));
// Check that openapi does not (again) collapse parameters
assertEquals(9, paths.get("/policies").getOperation("get").getParameters().size());
// Check that all properties are present ( https://github.com/smallrye/smallrye-open-api/issues/437 )
Map<String, Schema> policyProperties = schemas.get("Policy").getProperties();
assertEquals(9, policyProperties.size());
assertTrue(policyProperties.containsKey("ctime"));
assertTrue(policyProperties.containsKey("mtime"));
// Now that the OpenAPI file has been validated, save a copy to the filesystem
// This file is going to be uploaded in a regular CI build to know the API state
// for a given build.
InputStream in = url.openStream();
Files.copy(in, Paths.get(TARGET_OPENAPI), StandardCopyOption.REPLACE_EXISTING);
}
use of no.difi.meldingsutveksling.noarkexchange.p360.schema in project efm-integrasjonspunkt by felleslosninger.
the class P360Client method sendEduMelding.
@Override
public PutMessageResponseType sendEduMelding(PutMessageRequestType request) {
JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType> p360request = new PutMessageRequestMapper().mapFrom(request);
final WebServiceTemplate template = templateFactory.createTemplate("no.difi.meldingsutveksling.noarkexchange.p360.schema", PutMessageMarker.markerFrom(new PutMessageRequestWrapper(request)));
JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType> response = (JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType>) template.marshalSendAndReceive(settings.getEndpointUrl(), p360request, new SoapActionCallback(SOAP_ACTION));
PutMessageResponseType theResponse = new PutMessageResponseType();
ModelMapper modelMapper = new ModelMapper();
modelMapper.map(response.getValue(), theResponse);
setUnmappedValues(response, theResponse);
if (!isValid(theResponse)) {
theResponse = new PutMessageResponseType();
final no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType appReceiptType = new no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType();
theResponse.setResult(appReceiptType);
appReceiptType.setType("OK");
}
return theResponse;
}
use of no.difi.meldingsutveksling.noarkexchange.p360.schema in project efm-integrasjonspunkt by felleslosninger.
the class P360PutMessageRequestMapperTest method mapFromEphortePutMessageToP360PutMessage.
@Disabled("Work in progress")
@Test
public void mapFromEphortePutMessageToP360PutMessage() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType p360Request = mapper.mapFrom(putMessageRequestType).getValue();
assertFalse(PayloadUtil.isEmpty(p360Request.getPayload()));
// assertTrue(p360Request.getPayload().contains("Melding"));
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), writer);
String xml = writer.toString();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
// System.out.println(xml);
no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType p360result = unmarshaller.unmarshal(new StringSource(xml), no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class).getValue();
System.out.println(p360result.getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.p360.schema in project efm-integrasjonspunkt by felleslosninger.
the class P360PutMessageRequestMapperTest method emptyPayloadEphorteBug.
@Test
public void emptyPayloadEphorteBug() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/EmptyPayload.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
final JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType> p360PutMessage = mapper.mapFrom(putMessageRequestType);
Assertions.assertNotNull(p360PutMessage.getValue().getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.p360.schema in project geotoolkit by Geomatys.
the class JAXBFeatureTypeWriter method write.
/**
* Write an XML representation of the specified featureType into the Writer.
*
* @param feature The featureType to marshall.
*/
public void write(FeatureType feature, Writer writer) throws JAXBException {
final Schema schema = getSchemaFromFeatureType(feature);
final Marshaller marshaller = POOL.acquireMarshaller();
marshaller.marshal(schema, writer);
POOL.recycle(marshaller);
}
Aggregations