Search in sources :

Example 6 with Process

use of org.n52.shetland.inspire.ompr.Process in project arctic-sea by 52North.

the class ProcessDocumentEncoderTest method test_document_encoding.

@Test
public void test_document_encoding() throws XmlException, IOException, EncodingException, DecodingException {
    Process process = createProcessFromFile();
    XmlObject encodeObjectToXml = docEncoder.encode(process);
    assertThat(encodeObjectToXml, is(instanceOf(ProcessDocument.class)));
}
Also used : Process(org.n52.shetland.inspire.ompr.Process) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.Test) AbtractProcessDecodingTest(org.n52.svalbard.decode.AbtractProcessDecodingTest)

Example 7 with Process

use of org.n52.shetland.inspire.ompr.Process in project arctic-sea by 52North.

the class ProcessDocumentEncoderTest method test_type_encoding.

@Test
public void test_type_encoding() throws XmlException, IOException, EncodingException, DecodingException {
    Process process = createProcessFromFile();
    XmlObject encodeObjectToXml = typeEncoder.encode(process);
    assertThat(encodeObjectToXml, is(instanceOf(ProcessType.class)));
}
Also used : Process(org.n52.shetland.inspire.ompr.Process) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.Test) AbtractProcessDecodingTest(org.n52.svalbard.decode.AbtractProcessDecodingTest)

Example 8 with Process

use of org.n52.shetland.inspire.ompr.Process in project arctic-sea by 52North.

the class ProcessDocumentDecoderTest method test_decoding.

@Test
public void test_decoding() throws XmlException, IOException, DecodingException {
    Process process = createProcessFromFile();
    assertThat(process.isSetIdentifier(), is(true));
}
Also used : Process(org.n52.shetland.inspire.ompr.Process) Test(org.junit.Test)

Example 9 with Process

use of org.n52.shetland.inspire.ompr.Process in project arctic-sea by 52North.

the class AbstractStatisticsServiceEventListener method handle.

@Override
public void handle(Event serviceEvent) {
    LOG.debug("Event received: {}", serviceEvent);
    if (!dataHandler.isLoggingEnabled()) {
        return;
    }
    try {
        if (serviceEvent instanceof AbstractFlowEvent) {
            List<AbstractFlowEvent> eventList;
            AbstractFlowEvent evt = (AbstractFlowEvent) serviceEvent;
            // empty the list on the first event of the given group id
            if (serviceEvent instanceof RequestEvent) {
                eventList = new ArrayList<>(EVENTS_ARR_SIZE);
                eventsCache.put(evt.getMessageGroupId(), eventList);
            }
            // fall back
            if (eventsCache.get(evt.getMessageGroupId()) == null) {
                eventList = new ArrayList<>(EVENTS_ARR_SIZE);
                eventsCache.put(evt.getMessageGroupId(), eventList);
            }
            eventsCache.get(evt.getMessageGroupId()).add(evt);
            // received last event process eventsResolvers on a new thread
            if (serviceEvent instanceof OutgoingResponseEvent) {
                BatchResolver resolvers = new BatchResolver(dataHandler);
                eventsCache.get(evt.getMessageGroupId()).stream().forEach(l -> addEventToResolver(resolvers, l));
                executorService.execute(resolvers);
            }
        } else {
            LOG.trace("Unssupported type of event: {}", serviceEvent.getClass());
            BatchResolver singleOp = new BatchResolver(dataHandler);
            addEventToResolver(singleOp, serviceEvent);
            executorService.execute(singleOp);
        }
    } catch (Throwable e) {
        LOG.error("Can't handle event for statistics logging: {}", serviceEvent, e);
    }
}
Also used : RequestEvent(org.n52.iceland.event.events.RequestEvent) AbstractFlowEvent(org.n52.iceland.event.events.AbstractFlowEvent) OutgoingResponseEvent(org.n52.iceland.event.events.OutgoingResponseEvent)

Example 10 with Process

use of org.n52.shetland.inspire.ompr.Process in project arctic-sea by 52North.

the class ProcessPropertyTypeDecoder method decode.

@Override
public Process decode(ProcessPropertyType ppt) throws DecodingException {
    Process process = parseProcessType(ppt.getProcess());
    process.setXml(ppt.xmlText(getXmlOptions()));
    return process;
}
Also used : Process(org.n52.shetland.inspire.ompr.Process)

Aggregations

Process (org.n52.shetland.inspire.ompr.Process)9 XmlObject (org.apache.xmlbeans.XmlObject)6 Test (org.junit.Test)3 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)2 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)2 AbtractProcessDecodingTest (org.n52.svalbard.decode.AbtractProcessDecodingTest)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 IdentifierType (eu.europa.ec.inspire.schemas.base.x33.IdentifierType)1 ProcessDocument (eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument)1 ProcessPropertyType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType)1 ProcessType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessType)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 AbstractComponentType (net.opengis.sensorML.x101.AbstractComponentType)1 AbstractDerivableComponentType (net.opengis.sensorML.x101.AbstractDerivableComponentType)1 AbstractProcessType (net.opengis.sensorML.x101.AbstractProcessType)1 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)1 ComponentType (net.opengis.sensorML.x101.ComponentType)1