use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project cxf by apache.
the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroup.
@Test
public void testChoiceWithSubstitutionGroup() throws Exception {
if (!shouldRunTest("ChoiceWithSubstitutionGroup")) {
return;
}
SgBaseTypeA baseA = new SgBaseTypeA();
baseA.setVarInt(BigInteger.ONE);
ObjectFactory objectFactory = new ObjectFactory();
JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
SgDerivedTypeB derivedB = new SgDerivedTypeB();
derivedB.setVarInt(new BigInteger("32"));
derivedB.setVarString("SgDerivedTypeB");
JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
ChoiceWithSubstitutionGroup x = new ChoiceWithSubstitutionGroup();
x.setSg01BaseElementA(elementA);
ChoiceWithSubstitutionGroup yOrig = new ChoiceWithSubstitutionGroup();
yOrig.setSg01BaseElementA(elementB);
Holder<ChoiceWithSubstitutionGroup> y = new Holder<>(yOrig);
Holder<ChoiceWithSubstitutionGroup> z = new Holder<>();
assertTrue("yoo: ", equals(y.value, y.value));
ChoiceWithSubstitutionGroup ret;
if (testDocLiteral) {
ret = docClient.testChoiceWithSubstitutionGroup(x, y, z);
} else if (testXMLBinding) {
ret = xmlClient.testChoiceWithSubstitutionGroup(x, y, z);
} else {
ret = rpcClient.testChoiceWithSubstitutionGroup(x, y, z);
}
if (!perfTestOnly) {
assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
assertTrue("testChoiceWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project cxf by apache.
the class AbstractTypeTestClient2 method testStructWithSubstitutionGroup.
@Test
public void testStructWithSubstitutionGroup() throws Exception {
if (!shouldRunTest("StructWithSubstitutionGroup")) {
return;
}
SgBaseTypeA baseA = new SgBaseTypeA();
baseA.setVarInt(BigInteger.ONE);
SgDerivedTypeB derivedB = new SgDerivedTypeB();
derivedB.setVarInt(new BigInteger("32"));
derivedB.setVarString("foo");
ObjectFactory objectFactory = new ObjectFactory();
StructWithSubstitutionGroup x = new StructWithSubstitutionGroup();
JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
x.setSg01BaseElementA(elementA);
StructWithSubstitutionGroup yOrig = new StructWithSubstitutionGroup();
JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
yOrig.setSg01BaseElementA(elementB);
Holder<StructWithSubstitutionGroup> y = new Holder<>(yOrig);
Holder<StructWithSubstitutionGroup> z = new Holder<>();
StructWithSubstitutionGroup ret;
if (testDocLiteral) {
ret = docClient.testStructWithSubstitutionGroup(x, y, z);
} else if (testXMLBinding) {
ret = xmlClient.testStructWithSubstitutionGroup(x, y, z);
} else {
ret = rpcClient.testStructWithSubstitutionGroup(x, y, z);
}
if (!perfTestOnly) {
assertTrue("testStructWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
assertTrue("testStructWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
assertTrue("testStructWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project ddf by codice.
the class CswEndpoint method queryCsw.
private CswRecordCollection queryCsw(GetRecordsType request) throws CswException {
if (LOGGER.isDebugEnabled()) {
try {
Writer writer = new StringWriter();
try {
Marshaller marshaller = CswQueryFactory.getJaxBContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
JAXBElement<GetRecordsType> jaxbElement = new ObjectFactory().createGetRecords(request);
marshaller.marshal(jaxbElement, writer);
} catch (JAXBException e) {
LOGGER.debug("Unable to marshall {} to XML", GetRecordsType.class, e);
}
LOGGER.debug(writer.toString());
} catch (Exception e) {
LOGGER.debug("Unable to create debug message for getRecordsType", e);
}
}
QueryType query = (QueryType) request.getAbstractQuery().getValue();
CswRecordCollection response = new CswRecordCollection();
response.setRequest(request);
response.setOutputSchema(request.getOutputSchema());
response.setMimeType(request.getOutputFormat());
response.setElementName(query.getElementName());
response.setElementSetType((query.getElementSetName() != null) ? query.getElementSetName().getValue() : null);
response.setResultType((ResultType) ObjectUtils.defaultIfNull(request.getResultType(), ResultType.HITS));
if (ResultType.HITS.equals(request.getResultType()) || ResultType.RESULTS.equals(request.getResultType())) {
QueryRequest queryRequest = queryFactory.getQuery(request);
try {
queryRequest = queryFactory.updateQueryRequestTags(queryRequest, request.getOutputSchema());
LOGGER.debug("Attempting to execute paged query: {}", queryRequest);
AtomicLong hitCount = new AtomicLong(0);
QueryFunction qf = qr -> {
SourceResponse sr = framework.query(qr);
hitCount.compareAndSet(0, sr.getHits());
return sr;
};
ResultIterable results = ResultIterable.resultIterable(qf, queryRequest, request.getMaxRecords().intValue());
List<Result> resultList = results.stream().collect(Collectors.toList());
// The hitCount Atomic is used here instead of just defaulting
// to the size of the resultList because the size of the resultList
// can be limited to request.getMaxRecords().intValue() which would
// lead to an incorrect response for hits.
// hitCount is set within the QueryFunction and will correspond to
// all responses.
long totalHits = hitCount.get();
totalHits = totalHits != 0 ? totalHits : resultList.size();
QueryResponse queryResponse = new QueryResponseImpl(queryRequest, resultList, totalHits);
response.setSourceResponse(queryResponse);
} catch (UnsupportedQueryException | CatalogQueryException e) {
LOGGER.debug("Unable to query", e);
throw new CswException(e);
}
}
return response;
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project ddf by codice.
the class CswQueryFactoryTest method setUp.
@org.junit.Before
public void setUp() throws URISyntaxException, SourceUnavailableException, UnsupportedQueryException, FederationException, ParseException, IngestException {
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterAdapter filterAdapter = new GeotoolsFilterAdapterImpl();
CswRecordMap cswRecordMap = new MetacardCswRecordMap();
queryFactory = new CswQueryFactory(cswRecordMap, filterBuilder, filterAdapter, new PermissionsImpl());
AttributeRegistryImpl attributeRegistry = new AttributeRegistryImpl();
attributeRegistry.registerMetacardType(getCswMetacardType());
queryFactory.setAttributeRegistry(attributeRegistry);
polygon = new WKTReader().read(POLYGON_STR);
gmlObjectFactory = new net.opengis.gml.v_3_1_1.ObjectFactory();
filterObjectFactory = new ObjectFactory();
queryFilterTransformerProvider = mock(QueryFilterTransformerProvider.class);
QueryFilterTransformer cswQueryFilter = new CswQueryFilterTransformer(new MetacardCswRecordMap(), attributeRegistry);
when(queryFilterTransformerProvider.getTransformer(new QName(CswConstants.CSW_OUTPUT_SCHEMA, "Record"))).thenReturn(Optional.of(cswQueryFilter));
when(queryFilterTransformerProvider.getTransformer(anyString())).thenReturn(Optional.of(cswQueryFilter));
queryFactory.setQueryFilterTransformerProvider(queryFilterTransformerProvider);
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project ddf by codice.
the class SendEventTest method setUp.
@Before
public void setUp() throws Exception {
System.setProperty("ddf.home", ".");
callbackURI = new URL("https://localhost:12345/services/csw/subscription/event");
ObjectFactory objectFactory = new ObjectFactory();
request = new GetRecordsType();
request.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
request.setResultType(ResultType.RESULTS);
request.getResponseHandler().add(callbackURI.toString());
queryType = new QueryType();
elementSetNameType = new ElementSetNameType();
elementSetNameType.setValue(ElementSetType.BRIEF);
queryType.setElementSetName(elementSetNameType);
request.setAbstractQuery(objectFactory.createAbstractQuery(queryType));
transformerManager = mock(TransformerManager.class);
transformer = mock(QueryResponseTransformer.class);
binaryContent = mock(BinaryContent.class);
when(transformerManager.getTransformerBySchema(ArgumentMatchers.contains(CswConstants.CSW_OUTPUT_SCHEMA))).thenReturn(transformer);
when(transformer.transform(any(SourceResponse.class), anyMap())).thenReturn(binaryContent);
when(binaryContent.getByteArray()).thenReturn("byte array with message contents".getBytes());
query = mock(QueryRequest.class);
metacard = mock(Metacard.class);
webclient = mock(WebClient.class);
mockCxfClientFactory = mock(SecureCxfClientFactory.class);
response = mock(Response.class);
subject = mock(Subject.class);
mockSecurity = mock(Security.class);
headers.put(Subject.class.toString(), Arrays.asList(new Subject[] { subject }));
AccessPlugin accessPlugin = mock(AccessPlugin.class);
accessPlugins.add(accessPlugin);
when(mockCxfClientFactory.getWebClient()).thenReturn(webclient);
when(webclient.invoke(anyString(), isNull())).thenReturn(response);
when(response.getHeaders()).thenReturn(headers);
when(accessPlugin.processPostQuery(any(QueryResponse.class))).thenAnswer(invocationOnMock -> invocationOnMock.getArguments()[0]);
sendEvent = new SendEventExtension(request, query, mockCxfClientFactory);
sendEvent.setSubject(subject);
}
Aggregations