Search in sources :

Example 26 with CodeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType in project UVMS-Docker by UnionVMS.

the class FluxMessageReceiverBeanIT method postRequestTypeRequestSuccessTest.

/**
 * Post request type request success test.
 *
 * @throws Exception the exception
 */
@Test
@Ignore
public void postRequestTypeRequestSuccessTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date());
    BridgeConnectorPortType bridgeConnectorPortType = createBridgeConnector();
    RequestType requestType = new RequestType();
    FLUXVesselPositionMessage fLUXVesselPositionMessage = new FLUXVesselPositionMessage();
    VesselTransportMeansType vesselTransportMeansType = new VesselTransportMeansType();
    IDType cfrId = new IDType();
    cfrId.setSchemeID("CFR");
    cfrId.setValue(testAsset.getCfr());
    vesselTransportMeansType.getIDS().add(cfrId);
    IDType ircsId = new IDType();
    ircsId.setSchemeID("IRCS");
    ircsId.setValue(testAsset.getIrcs());
    vesselTransportMeansType.getIDS().add(ircsId);
    // IDType extMarkingId = new IDType();
    // extMarkingId.setSchemeID("EXT_MARKING");
    // extMarkingId.setValue(testAsset.getExternalMarking());
    // vesselTransportMeansType.getIDS().add(extMarkingId);
    VesselCountryType vesselCountry = new VesselCountryType();
    IDType countryId = new IDType();
    countryId.setValue("SWE");
    vesselCountry.setID(countryId);
    vesselTransportMeansType.setRegistrationVesselCountry(vesselCountry);
    VesselPositionEventType vesselPositionEventType = new VesselPositionEventType();
    MeasureType measureType = new MeasureType();
    measureType.setValue(new BigDecimal(282));
    vesselPositionEventType.setCourseValueMeasure(measureType);
    DateTimeType posDateTime = new DateTimeType();
    posDateTime.setDateTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
    vesselPositionEventType.setObtainedOccurrenceDateTime(posDateTime);
    VesselGeographicalCoordinateType cordinates = new VesselGeographicalCoordinateType();
    MeasureType longitude = new MeasureType();
    longitude.setValue(new BigDecimal(21.5740000000));
    cordinates.setLongitudeMeasure(longitude);
    MeasureType latitude = new MeasureType();
    latitude.setValue(new BigDecimal(59.6480000000));
    cordinates.setLatitudeMeasure(latitude);
    vesselPositionEventType.setSpecifiedVesselGeographicalCoordinate(cordinates);
    MeasureType speedValue = new MeasureType();
    speedValue.setValue(new BigDecimal(7.5));
    vesselPositionEventType.setSpeedValueMeasure(speedValue);
    CodeType typeCodeValue = new CodeType();
    typeCodeValue.setValue("POS");
    vesselPositionEventType.setTypeCode(typeCodeValue);
    vesselTransportMeansType.getSpecifiedVesselPositionEvents().add(vesselPositionEventType);
    fLUXVesselPositionMessage.setVesselTransportMeans(vesselTransportMeansType);
    FLUXReportDocumentType fluxReportDocumentType = new FLUXReportDocumentType();
    DateTimeType dateTimeType = new DateTimeType();
    dateTimeType.setDateTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
    fluxReportDocumentType.setCreationDateTime(dateTimeType);
    FLUXPartyType fLUXPartyType = new FLUXPartyType();
    fLUXPartyType.getIDS().add(countryId);
    fluxReportDocumentType.setOwnerFLUXParty(fLUXPartyType);
    TextType textType = new TextType();
    fluxReportDocumentType.setPurpose(textType);
    CodeType purposeCode = new CodeType();
    purposeCode.setValue("9");
    fluxReportDocumentType.setPurposeCode(purposeCode);
    IDType idType = new IDType();
    fluxReportDocumentType.setReferencedID(idType);
    CodeType typeCode = new CodeType();
    fluxReportDocumentType.setTypeCode(typeCode);
    fLUXVesselPositionMessage.setFLUXReportDocument(fluxReportDocumentType);
    requestType.setAny(createAnyElement(fLUXVesselPositionMessage));
    requestType.setAD("SWE");
    requestType.setAR(true);
    requestType.setDF("df");
    requestType.setON("on");
    requestType.setTO(1234);
    requestType.setTODT(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
    ResponseType responseType = bridgeConnectorPortType.post(requestType);
    assertNotNull(responseType);
    assertEquals("OK", responseType.getStatus());
    Thread.sleep(7500);
    List<String> connectIds = new ArrayList<>();
    connectIds.add(testAsset.getEventHistory().getEventId());
    final HttpResponse response = Request.Post(getBaseUrl() + "movement/rest/movement/latest").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(connectIds).getBytes()).execute().returnResponse();
    List dataList = checkSuccessResponseReturnType(response, List.class);
    assertEquals("Expect one position in movement db", 1, dataList.size());
}
Also used : ArrayList(java.util.ArrayList) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._18.MeasureType) FLUXReportDocumentType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.FLUXReportDocumentType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._18.IDType) BridgeConnectorPortType(xeu.bridge_connector.wsdl.v1.BridgeConnectorPortType) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) ArrayList(java.util.ArrayList) List(java.util.List) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) VesselCountryType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.VesselCountryType) FLUXVesselPositionMessage(un.unece.uncefact.data.standard.fluxvesselpositionmessage._4.FLUXVesselPositionMessage) VesselGeographicalCoordinateType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.VesselGeographicalCoordinateType) GregorianCalendar(java.util.GregorianCalendar) VesselPositionEventType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.VesselPositionEventType) HttpResponse(org.apache.http.HttpResponse) VesselTransportMeansType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.VesselTransportMeansType) FLUXPartyType(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._18.FLUXPartyType) Date(java.util.Date) BigDecimal(java.math.BigDecimal) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._18.TextType) ResponseType(xeu.bridge_connector.v1.ResponseType) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._18.DateTimeType) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._18.CodeType) RequestType(xeu.bridge_connector.v1.RequestType) Ignore(org.junit.Ignore) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 27 with CodeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType in project ddf by codice.

the class CswEndpoint method buildServiceIdentification.

/**
     * Creates the ServiceIdentification portion of the GetCapabilities response TODO: Add more
     * DDF-specific information if desired (Fees, Keywords, and AccessConstraints are all currently
     * empty, and the abstract is very basic)
     *
     * @return The constructed ServiceIdentification object
     */
private ServiceIdentification buildServiceIdentification() {
    ServiceIdentification si = new ServiceIdentification();
    si.setTitle(SERVICE_TITLE);
    si.setServiceTypeVersion(SERVICE_TYPE_VERSION);
    CodeType type = new CodeType();
    type.setValue(CswConstants.CSW);
    si.setServiceType(type);
    si.setAbstract(SERVICE_ABSTRACT);
    return si;
}
Also used : CodeType(net.opengis.ows.v_1_0_0.CodeType) ServiceIdentification(net.opengis.ows.v_1_0_0.ServiceIdentification)

Example 28 with CodeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType in project sldeditor by robward-scisys.

the class CustomProcessFunctionTest method createProcessDescriptionEnum.

/**
 * Test the process description enumeration values.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void createProcessDescriptionEnum() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    AllowedValuesType allowedValues = Ows11FactoryImpl.init().createAllowedValuesType();
    EList allowedValueList = allowedValues.getValue();
    ValueType item1 = Ows11FactoryImpl.init().createValueType();
    item1.setValue("item 1");
    allowedValueList.add(item1);
    ValueType item2 = Ows11FactoryImpl.init().createValueType();
    item2.setValue("item 2");
    allowedValueList.add(item2);
    ValueType item3 = Ows11FactoryImpl.init().createValueType();
    item1.setValue("item 3");
    allowedValueList.add(item3);
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    literal.setAllowedValues(allowedValues);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) ValueType(net.opengis.ows11.ValueType) AllowedValuesType(net.opengis.ows11.AllowedValuesType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType) Test(org.junit.Test)

Example 29 with CodeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType in project sldeditor by robward-scisys.

the class CustomProcessFunctionTest method createProcessDescriptionBBox.

/**
 * Test the process description boundaing box values.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void createProcessDescriptionBBox() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    SupportedCRSsType crs = Wps10FactoryImpl.init().createSupportedCRSsType();
    inputDescription.setBoundingBoxData(crs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
    assertTrue(value.dataType.compareTo("BBOX") == 0);
    SupportedComplexDataInputType complex = Wps10FactoryImpl.init().createSupportedComplexDataInputType();
    inputDescription.setComplexData(complex);
    inputDescription.setBoundingBoxData(null);
    valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
    assertTrue(value.dataType.compareTo("Geometry") == 0);
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) SupportedCRSsType(net.opengis.wps10.SupportedCRSsType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) SupportedComplexDataInputType(net.opengis.wps10.SupportedComplexDataInputType) Test(org.junit.Test)

Example 30 with CodeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType in project sldeditor by robward-scisys.

the class CustomProcessFunctionTest method createProcessDescription.

/**
 * Creates the process description.
 *
 * @param type the type
 * @param defaultValue the default value
 * @param minOccurs the min occurs
 * @param maxOccurs the max occurs
 * @return the process function parameter value
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private ProcessFunctionParameterValue createProcessDescription(String type, String defaultValue, int minOccurs, int maxOccurs) {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(minOccurs));
    inputDescription.setMaxOccurs(BigInteger.valueOf(maxOccurs));
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    DomainMetadataType domainType = Ows11FactoryImpl.init().createDomainMetadataType();
    domainType.setValue(type);
    literal.setDefaultValue(defaultValue);
    literal.setDataType(domainType);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(type, 1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(type, minOccurs, value.minOccurences);
    assertEquals(type, maxOccurs, value.maxOccurences);
    return value;
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType)

Aggregations

CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)45 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)14 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)10 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)9 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)6 ArrayList (java.util.ArrayList)5 HashSet (java.util.HashSet)5 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)5 FLUXParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty)5 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)5 CodeType (net.opengis.ows11.CodeType)4 DataInputsType (net.opengis.wps10.DataInputsType)4 InputDescriptionType (net.opengis.wps10.InputDescriptionType)4 ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)4 Test (org.junit.Test)4 FLUXCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic)4 SizeDistribution (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SizeDistribution)4 CustomProcessFunction (com.sldeditor.rendertransformation.CustomProcessFunction)3 ProcessFunctionParameterValue (com.sldeditor.rendertransformation.ProcessFunctionParameterValue)3 LiteralInputType (net.opengis.wps10.LiteralInputType)3