use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_offerings_from_sml.
@Test
public void should_decode_offerings_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
Capabilities xbCapabilities = xbSystem.addNewCapabilities();
xbCapabilities.setName(SensorMLConstants.ELEMENT_NAME_OFFERINGS);
SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.addNewAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_1, TEST_NAME_1);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_2, TEST_NAME_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
// assertThat(absProcess.getOfferings().size(), is(2));
assertThat(absProcess.getCapabilities().size(), is(1));
// List<SosOffering> sosOfferings = new ArrayList<SosOffering>(absProcess.getOfferings());
// Collections.sort(sosOfferings);
// assertThat(sosOfferings.get(0).getIdentifier(), is(TEST_ID_1));
// assertThat(sosOfferings.get(0).getOfferingName(), is(TEST_NAME_1));
// assertThat(sosOfferings.get(1).getIdentifier(), is(TEST_ID_2));
// assertThat(sosOfferings.get(1).getOfferingName(), is(TEST_NAME_2));
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_set_identifier_by_identifier_name.
@Test
public void should_set_identifier_by_identifier_name() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, OGCConstants.URN_UNIQUE_IDENTIFIER_END, null, TEST_ID_1);
addIdentifier(xbIdentifierList, "any name", null, TEST_ID_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
assertThat(absProcess.getIdentifications().size(), is(2));
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_child_procedure_from_sml.
@Test
public void should_decode_child_procedure_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
ComponentList xbComponentList = xbSystem.addNewComponents().addNewComponentList();
addChildProcedure(xbComponentList, TEST_ID_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
// assertThat(absProcess.getChildProcedures().size(), is(1));
// SosProcedureDescription childProcedure = absProcess.getChildProcedures().iterator().next();
// assertThat(childProcedure, instanceOf(System.class));
// assertThat(childProcedure.getIdentifier(), is(TEST_ID_2));
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_io_from_sml.
@Test
public void should_decode_io_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
InputList xbInputList = xbSystem.addNewInputs().addNewInputList();
OutputList xbOutputList = xbSystem.addNewOutputs().addNewOutputList();
IoComponentPropertyType input1 = xbInputList.addNewInput();
input1.setName("input1");
input1.addNewBoolean();
IoComponentPropertyType input2 = xbInputList.addNewInput();
input2.setName("input2");
input2.addNewCount();
IoComponentPropertyType output1 = xbOutputList.addNewOutput();
output1.setName("output1");
output1.addNewQuantity();
IoComponentPropertyType output2 = xbOutputList.addNewOutput();
output2.setName("output2");
DataArrayType dataArray = getDataArray();
output2.setAbstractDataArray1(dataArray);
XmlHelper.substituteElement(output2.getAbstractDataArray1(), dataArray);
IoComponentPropertyType output3 = xbOutputList.addNewOutput();
output3.setName("output3");
DataRecordType dataRecord = DataRecordType.Factory.newInstance();
output3.setAbstractDataRecord(dataRecord);
XmlHelper.substituteElement(output3.getAbstractDataRecord(), dataRecord);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getInputs().get(0).getIoValue().getDataComponentType(), is(SweDataComponentType.Boolean));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getInputs().get(0).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Boolean));
assertThat(absProcess.getInputs().get(1).getIoValue().getDataComponentType(), is(SweDataComponentType.Count));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getInputs().get(1).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Count));
assertThat(absProcess.getOutputs().get(0).getIoValue().getDataComponentType(), is(SweDataComponentType.Quantity));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getOutputs().get(0).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Quantity));
assertThat(absProcess.getOutputs().get(1).getIoValue().getDataComponentType(), is(SweDataComponentType.DataArray));
assertThat(absProcess.getOutputs().get(2).getIoValue().getDataComponentType(), is(SweDataComponentType.DataRecord));
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_contact_from_sml.
@Test
public void should_decode_contact_from_sml() throws DecodingException {
String role1 = "role1";
String role2 = "role2";
String orgName = "orgName";
String individualName = "individualName";
String posName = "posName";
String contactInstructions = "contactInstructions";
String hoursOfService = "hoursOfService";
String adminArea = "adminArea";
String city = "city";
String country = "country";
String email = "email";
String postalCode = "postalCode";
String deliveryPoint1 = "deliveryPoint1";
String deliveryPoint2 = "deliveryPoint2";
String onlineResource1 = "onlineResource1";
String onlineResource2 = "onlineResource2";
String phoneVoice1 = "phoneVoice1";
String phoneVoice2 = "phoneVoice2";
String phoneFax1 = "phoneFax1";
String phoneFax2 = "phoneFax2";
String affiliation = "affiliation";
String name = "name";
String phoneNumber = "phoneNumber";
String surname = "surname";
String userID = "userID";
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
Contact xbContact = xbSystem.addNewContact();
ContactList xbContactList = xbContact.addNewContactList();
// responsible party
ContactList.Member xbMember1 = xbContactList.addNewMember();
xbMember1.setRole(role1);
ResponsibleParty xbRespPart = xbMember1.addNewResponsibleParty();
xbRespPart.setOrganizationName(orgName);
xbRespPart.setIndividualName(individualName);
xbRespPart.setPositionName(posName);
ContactInfo xbContactInfo = xbRespPart.addNewContactInfo();
xbContactInfo.setContactInstructions(contactInstructions);
xbContactInfo.setHoursOfService(hoursOfService);
ContactInfo.Address xbAddress = xbContactInfo.addNewAddress();
xbAddress.setAdministrativeArea(adminArea);
xbAddress.setCity(city);
xbAddress.setCountry(country);
xbAddress.setElectronicMailAddress(email);
xbAddress.setPostalCode(postalCode);
xbAddress.addDeliveryPoint(deliveryPoint1);
xbAddress.addDeliveryPoint(deliveryPoint2);
xbContactInfo.addNewOnlineResource().setHref(onlineResource1);
xbContactInfo.addNewOnlineResource().setHref(onlineResource2);
ContactInfo.Phone phone = xbContactInfo.addNewPhone();
phone.addVoice(phoneVoice1);
phone.addVoice(phoneVoice2);
phone.addFacsimile(phoneFax1);
phone.addFacsimile(phoneFax2);
// person
ContactList.Member xbMember2 = xbContactList.addNewMember();
xbMember2.setRole(role2);
Person xbPerson = xbMember2.addNewPerson();
xbPerson.setAffiliation(affiliation);
xbPerson.setEmail(email);
xbPerson.setName(name);
xbPerson.setPhoneNumber(phoneNumber);
xbPerson.setSurname(surname);
xbPerson.setUserID(userID);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getContact(), notNullValue());
assertThat(absProcess.getContact().size(), is(1));
assertThat(absProcess.getContact().get(0), instanceOf(SmlContactList.class));
SmlContactList smlContactList = (SmlContactList) absProcess.getContact().get(0);
assertThat(smlContactList.getMembers(), notNullValue());
assertThat(smlContactList.getMembers().size(), is(2));
assertThat(smlContactList.getMembers().get(0).getRole(), is(role1));
assertThat(smlContactList.getMembers().get(0), instanceOf(SmlResponsibleParty.class));
SmlResponsibleParty smlRespParty = (SmlResponsibleParty) smlContactList.getMembers().get(0);
assertThat(smlRespParty.getAdministrativeArea(), is(adminArea));
assertThat(smlRespParty.getCity(), is(city));
assertThat(smlRespParty.getContactInstructions(), is(contactInstructions));
assertThat(smlRespParty.getCountry(), is(country));
assertThat(smlRespParty.getDeliveryPoint().size(), is(2));
assertThat(smlRespParty.getDeliveryPoint().get(0), is(deliveryPoint1));
assertThat(smlRespParty.getDeliveryPoint().get(1), is(deliveryPoint2));
assertThat(smlRespParty.getEmail(), is(email));
assertThat(smlRespParty.getHoursOfService(), is(hoursOfService));
assertThat(smlRespParty.getIndividualName(), is(individualName));
assertThat(smlRespParty.getOnlineResources().size(), is(2));
assertThat(smlRespParty.getOnlineResources().get(0), is(onlineResource1));
assertThat(smlRespParty.getOnlineResources().get(1), is(onlineResource2));
assertThat(smlRespParty.getOrganizationName(), is(orgName));
assertThat(smlRespParty.getPhoneFax().size(), is(2));
assertThat(smlRespParty.getPhoneFax().get(0), is(phoneFax1));
assertThat(smlRespParty.getPhoneFax().get(1), is(phoneFax2));
assertThat(smlRespParty.getPhoneVoice().size(), is(2));
assertThat(smlRespParty.getPhoneVoice().get(0), is(phoneVoice1));
assertThat(smlRespParty.getPhoneVoice().get(1), is(phoneVoice2));
assertThat(smlRespParty.getPositionName(), is(posName));
assertThat(smlRespParty.getPostalCode(), is(postalCode));
assertThat(smlContactList.getMembers().get(1).getRole(), is(role2));
assertThat(smlContactList.getMembers().get(1), instanceOf(SmlPerson.class));
SmlPerson smlPerson = (SmlPerson) smlContactList.getMembers().get(1);
assertThat(smlPerson.getAffiliation(), is(affiliation));
assertThat(smlPerson.getEmail(), is(email));
assertThat(smlPerson.getName(), is(name));
assertThat(smlPerson.getPhoneNumber(), is(phoneNumber));
assertThat(smlPerson.getSurname(), is(surname));
assertThat(smlPerson.getUserID(), is(userID));
}
Aggregations