use of ddf.catalog.data.impl.types.ContactAttributes in project alliance by codice.
the class DAGConverterTest method setUp.
@Before
public void setUp() throws Exception {
this.orb = ORB.init();
int year = 2016;
int month = 01;
int dayOfMonth = 29;
int hourOfDay = 17;
int minute = 05;
int second = 10;
cal = new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute, second);
dagConverter = new DAGConverter(mockResourceReader);
List<MetacardType> types = new ArrayList<>();
types.add(new AssociationsAttributes());
types.add(new ContactAttributes());
types.add(new DateTimeAttributes());
types.add(new LocationAttributes());
types.add(new IsrAttributes());
types.add(new SecurityAttributes());
MetacardTypeImpl metacardTypeImpl = new MetacardTypeImpl("NsiliMetacardType", types);
dagConverter.setNsiliMetacardType(metacardTypeImpl);
setupMocks();
}
use of ddf.catalog.data.impl.types.ContactAttributes in project ddf by codice.
the class GetRecordsMessageBodyReaderTest method testFullThreadCswRecordCollection.
@Test
public void testFullThreadCswRecordCollection() throws Exception {
Metacard metacard = createMetacard();
List<Metacard> inputMetacards = Collections.singletonList(metacard);
CswRecordCollection collection = new CswRecordCollection();
collection.setCswRecords(inputMetacards);
MetacardType cswMetacardType = new MetacardTypeImpl(CswConstants.CSW_METACARD_TYPE_NAME, Arrays.asList(new ContactAttributes(), new LocationAttributes(), new MediaAttributes(), new TopicAttributes(), new AssociationsAttributes()));
CswRecordConverter recordConverter = new CswRecordConverter(cswMetacardType);
TransformerManager mockInputManager = mock(TransformerManager.class);
when(mockInputManager.getTransformerByProperty(anyString(), anyString())).thenReturn(recordConverter);
CswTransformProvider metacardProvider = new CswTransformProvider(null, mockInputManager);
GetRecordsResponseConverter provider = new GetRecordsResponseConverter(metacardProvider);
CswSourceConfiguration config = createConfig();
GetRecordsMessageBodyReader reader = new GetRecordsMessageBodyReader(provider, config);
CswRecordCollection cswRecords = null;
try (InputStream is = GetRecordsMessageBodyReaderTest.class.getResourceAsStream("/getRecordsResponse.xml")) {
MultivaluedMap<String, String> httpHeaders = new MultivaluedHashMap<>();
cswRecords = reader.readFrom(CswRecordCollection.class, null, null, null, httpHeaders, is);
}
List<Metacard> metacards = cswRecords.getCswRecords();
assertThat(metacards, hasSize(3));
assertThat(metacards.get(0).getMetacardType().getName(), is("csw:Record"));
assertThat(metacards.get(0).getTitle(), containsString("title"));
}
use of ddf.catalog.data.impl.types.ContactAttributes in project ddf by codice.
the class GetRecordsMessageBodyReaderTest method testFullThreadCswRecordCollectionAltPrefixes.
@Test
public void testFullThreadCswRecordCollectionAltPrefixes() throws Exception {
Metacard metacard = createMetacard();
List<Metacard> inputMetacards = Collections.singletonList(metacard);
CswRecordCollection collection = new CswRecordCollection();
collection.setCswRecords(inputMetacards);
MetacardType cswMetacardType = new MetacardTypeImpl(CswConstants.CSW_METACARD_TYPE_NAME, Arrays.asList(new ContactAttributes(), new LocationAttributes(), new MediaAttributes(), new TopicAttributes(), new AssociationsAttributes()));
CswRecordConverter recordConverter = new CswRecordConverter(cswMetacardType);
TransformerManager mockInputManager = mock(TransformerManager.class);
when(mockInputManager.getTransformerByProperty(anyString(), anyString())).thenReturn(recordConverter);
CswTransformProvider metacardProvider = new CswTransformProvider(null, mockInputManager);
GetRecordsResponseConverter provider = new GetRecordsResponseConverter(metacardProvider);
CswSourceConfiguration config = createConfig();
GetRecordsMessageBodyReader reader = new GetRecordsMessageBodyReader(provider, config);
CswRecordCollection cswRecords = null;
try (InputStream is = GetRecordsMessageBodyReaderTest.class.getResourceAsStream("/getRecordsResponse-alt-prefixes.xml")) {
MultivaluedMap<String, String> httpHeaders = new MultivaluedHashMap<>();
cswRecords = reader.readFrom(CswRecordCollection.class, null, null, null, httpHeaders, is);
}
List<Metacard> metacards = cswRecords.getCswRecords();
assertThat(metacards.size(), is(3));
assertThat(metacards.get(0).getMetacardType().getName(), is("csw:Record"));
assertThat(metacards.get(0).getTitle(), containsString("title"));
}
use of ddf.catalog.data.impl.types.ContactAttributes in project ddf by codice.
the class TransactionMessageBodyReaderTest method setup.
@Before
public void setup() {
cswRecordConverter = new CswRecordConverter(CswQueryFactoryTest.getCswMetacardType());
new CoreAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
new ContactAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
new LocationAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
new MediaAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
new TopicAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
new AssociationsAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
}
use of ddf.catalog.data.impl.types.ContactAttributes in project ddf by codice.
the class TestTransactionRequestConverter method setup.
@Before
public void setup() {
cswRecordConverter = mock(Converter.class);
when(cswRecordConverter.canConvert(any())).thenReturn(true);
new CoreAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new ContactAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new LocationAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new MediaAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new TopicAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new AssociationsAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
xStream = new XStream(new Xpp3Driver());
xStream.registerConverter(new TransactionRequestConverter(cswRecordConverter, mockRegistry));
xStream.alias(CswConstants.CSW_TRANSACTION, CswTransactionRequest.class);
}
Aggregations