Java Code Examples for org.apache.olingo.odata2.api.ep.EntityProvider#writeMetadata()

The following examples show how to use org.apache.olingo.odata2.api.ep.EntityProvider#writeMetadata() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlMetadataConsumerTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testRefScenario() throws Exception {
  EdmProvider testProvider = new EdmTestProvider();
  ODataResponse response = EntityProvider.writeMetadata(testProvider.getSchemas(), null);

  String stream = StringHelper.inputStreamToString((InputStream) response.getEntity());
  XmlMetadataConsumer parser = new XmlMetadataConsumer();
  DataServices result = parser.readMetadata(createStreamReader(stream), true);

  ODataResponse response2 = EntityProvider.writeMetadata(result.getSchemas(), null);
  String streamAfterParse = StringHelper.inputStreamToString((InputStream) response2.getEntity());
  assertEquals(stream, streamAfterParse);
}
 
Example 2
Source File: XmlMetadataConsumerTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void edmxReferences() throws Exception {
  DataServices serviceMetadata = new DataServices();
  List<AnnotationElement> annoElements = new ArrayList<AnnotationElement>();
  annoElements.add(createElementWithoutInclude());
  annoElements.add(createElementWithInclude());
  serviceMetadata.setAnnotationElements(annoElements);
  serviceMetadata.setDataServiceVersion(ODataServiceVersion.V20);
  ODataResponse response = EntityProvider.writeMetadata(serviceMetadata, null);

  EntityProvider.readMetadata(response.getEntityAsStream(), false);
}
 
Example 3
Source File: EdmxProviderTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
private Edm createEdm() throws Exception {
  EdmProvider testProvider = new EdmTestProvider();
  ODataResponse response = EntityProvider.writeMetadata(testProvider.getSchemas(), null);
  InputStream in = (InputStream) response.getEntity();
  return EntityProvider.readMetadata(in, true);

}
 
Example 4
Source File: XmlMetadataDeserializerTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testRefScenario() throws Exception {
  EdmProvider testProvider = new EdmTestProvider();
  ODataResponse response = EntityProvider.writeMetadata(testProvider.getSchemas(), null);

  String stream = StringHelper.inputStreamToString((InputStream) response.getEntity());
  XmlMetadataDeserializer parser = new XmlMetadataDeserializer();
  EdmDataServices result = parser.readMetadata(createStreamReader(stream), true);
 
  assertNotNull(result);
}