You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/20 15:33:38 UTC
[16/59] [abbrv] Cleanup of core
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
index ec12dc8..eebc63f 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -50,7 +50,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readIntegerProperty() throws Exception {
String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -61,7 +62,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readIntegerPropertyAsLong() throws Exception {
String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
Map<String, Object> typeMappings = createTypeMappings("Age", Long.class);
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
@@ -73,7 +75,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readIntegerPropertyWithNullMapping() throws Exception {
String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
Map<String, Object> typeMappings = null;
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
@@ -85,7 +88,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readIntegerPropertyWithEmptyMapping() throws Exception {
String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
Map<String, Object> typeMappings = new HashMap<String, Object>();
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
@@ -97,7 +101,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readStringProperty() throws Exception {
String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -108,7 +113,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void readStringPropertyEmpty() throws Exception {
final String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -121,7 +127,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
final String xml = "<EntryDate xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -134,7 +141,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
final String xml = "<EntryDate xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"false\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">1970-01-02T00:00:00</EntryDate>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -145,7 +153,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void invalidSimplePropertyName() throws Exception {
final String xml = "<Invalid xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Invalid>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -155,7 +164,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"wrong\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -165,7 +175,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
+ EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
EdmFacets facets = mock(EdmFacets.class);
when(facets.isNullable()).thenReturn(false);
when(property.getFacets()).thenReturn(facets);
@@ -186,7 +197,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -213,7 +225,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</Location>" +
"\n \n ";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -236,7 +249,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
try {
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false,
@@ -262,7 +276,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- EdmProperty locationComplexProperty = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ EdmProperty locationComplexProperty =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
EdmProperty cityProperty = (EdmProperty) ((EdmComplexType) locationComplexProperty.getType()).getProperty("City");
EdmProperty postalCodeProperty = (EdmProperty) ((EdmComplexType) cityProperty.getType()).getProperty("PostalCode");
// Change the type of the PostalCode property to one that allows different Java types.
@@ -273,7 +288,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
createTypeMappings("Location",
createTypeMappings("City",
createTypeMappings("CityName", String.class, "PostalCode", Long.class)));
- Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, locationComplexProperty, false, typeMappings);
+ Map<String, Object> resultMap =
+ new XmlPropertyConsumer().readProperty(reader, locationComplexProperty, false, typeMappings);
// verify
Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
@@ -297,7 +313,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
" </d:City>" +
"</d:Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
Object prop = new XmlPropertyConsumer().readProperty(reader, property, false);
Map<String, Object> resultMap = (Map<String, Object>) prop;
@@ -321,7 +338,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -338,7 +356,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -355,7 +374,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Invalid>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -372,7 +392,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -390,7 +411,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
"</City>" +
"</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -406,7 +428,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
@@ -419,7 +442,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
EdmFacets facets = mock(EdmFacets.class);
when(facets.isNullable()).thenReturn(false);
when(property.getFacets()).thenReturn(facets);
@@ -434,7 +458,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
+ "<City><PostalCode/><CityName/></City><Country>Germany</Country>"
+ "</Location>";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
new XmlPropertyConsumer().readProperty(reader, property, false);
}
@@ -443,7 +468,8 @@ public class XmlPropertyConsumerTest extends AbstractConsumerTest {
public void complexPropertyEmpty() throws Exception {
final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\" />";
XMLStreamReader reader = createReaderForTest(xml, true);
- final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
+ final EdmProperty property =
+ (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
index efcab4f..b6e1f8f 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;
@@ -74,14 +74,15 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void noneSyndicationKeepInContentFalseMustNotShowInProperties() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.FALSE);
when(employeeCustomPropertyMapping.getFcNsPrefix()).thenReturn("customPre");
when(employeeCustomPropertyMapping.getFcNsUri()).thenReturn("http://customUri.com");
EdmTyped employeeEntryDateProperty = employeesSet.getEntityType().getProperty("EmployeeName");
- when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -101,14 +102,15 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void noneSyndicationKeepInContentTrueMustShowInProperties() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.TRUE);
when(employeeCustomPropertyMapping.getFcNsPrefix()).thenReturn("customPre");
when(employeeCustomPropertyMapping.getFcNsUri()).thenReturn("http://customUri.com");
EdmTyped employeeEntryDateProperty = employeesSet.getEntityType().getProperty("EmployeeName");
- when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -128,13 +130,14 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void noneSyndicationWithNullPrefix() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.TRUE);
when(employeeCustomPropertyMapping.getFcNsUri()).thenReturn("http://customUri.com");
EdmTyped employeeEntryDateProperty = employeesSet.getEntityType().getProperty("EmployeeName");
- when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -159,13 +162,14 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void noneSyndicationWithNullUri() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.TRUE);
when(employeeCustomPropertyMapping.getFcNsPrefix()).thenReturn("customPre");
EdmTyped employeeEntryDateProperty = employeesSet.getEntityType().getProperty("EmployeeName");
- when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -190,12 +194,13 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void noneSyndicationWithNullUriAndNullPrefix() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.TRUE);
EdmTyped employeeEntryDateProperty = employeesSet.getEntityType().getProperty("EmployeeName");
- when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -220,14 +225,15 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void syndicationWithComplexProperty() throws Exception {
- //prepare Mock
+ // prepare Mock
EdmEntitySet employeesSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
EdmCustomizableFeedMappings employeeCustomPropertyMapping = mock(EdmCustomizableFeedMappings.class);
when(employeeCustomPropertyMapping.isFcKeepInContent()).thenReturn(Boolean.TRUE);
when(employeeCustomPropertyMapping.getFcNsPrefix()).thenReturn("customPre");
when(employeeCustomPropertyMapping.getFcNsUri()).thenReturn("http://customUri.com");
EdmTyped employeeLocationProperty = employeesSet.getEntityType().getProperty("Location");
- when(((EdmProperty) employeeLocationProperty).getCustomizableFeedMappings()).thenReturn(employeeCustomPropertyMapping);
+ when(((EdmProperty) employeeLocationProperty).getCustomizableFeedMappings()).thenReturn(
+ employeeCustomPropertyMapping);
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("a", Edm.NAMESPACE_ATOM_2005);
@@ -269,9 +275,12 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeAtomMediaResource() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomMediaResource() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -308,10 +317,14 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeAtomMediaResourceWithMimeType() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomMediaResourceWithMimeType() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, properties);
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ properties);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -324,15 +337,19 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
/**
- * Test serialization of empty syndication title property. EmployeeName is set to NULL after the update (which is allowed because EmployeeName has default Nullable behavior which is true).
- * Write of an empty atom title tag is allowed within RFC4287 (http://tools.ietf.org/html/rfc4287#section-4.2.14).
+ * Test serialization of empty syndication title property. EmployeeName is set to NULL after the update (which is
+ * allowed because EmployeeName has default Nullable behavior which is true).
+ * Write of an empty atom title tag is allowed within RFC4287 (http://tools.ietf.org/html/rfc4287#section-4.2.14).
*/
@Test
- public void serializeEmployeeWithNullSyndicationTitleProperty() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeEmployeeWithNullSyndicationTitleProperty() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
employeeData.put("EmployeeName", null);
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, properties);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ properties);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry/a:title", xmlString);
@@ -347,10 +364,14 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeEmployeeAndCheckOrderOfTags() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeEmployeeAndCheckOrderOfTags() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, properties);
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ properties);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -377,14 +398,16 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeEmployeeAndCheckOrderOfPropertyTags() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeEmployeeAndCheckOrderOfPropertyTags() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
EdmEntitySet employeeEntitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
ODataResponse response = ser.writeEntry(employeeEntitySet, employeeData, properties);
String xmlString = verifyResponse(response);
- // log.debug(xmlString);
+ // log.debug(xmlString);
assertXpathExists("/a:entry", xmlString);
assertXpathExists("/a:entry/a:content", xmlString);
@@ -398,9 +421,11 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeEmployeeAndCheckKeepInContentFalse() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeEmployeeAndCheckKeepInContentFalse() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("abc").build();
EdmEntitySet employeeEntitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
// set "keepInContent" to false for EntryDate
@@ -422,30 +447,36 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
assertXpathNotExists("/a:entry/m:properties/d:EntryDate", xmlString);
// verify order of tags
- List<String> expectedPropertyNamesFromEdm = new ArrayList<String>(employeeEntitySet.getEntityType().getPropertyNames());
+ List<String> expectedPropertyNamesFromEdm =
+ new ArrayList<String>(employeeEntitySet.getEntityType().getPropertyNames());
expectedPropertyNamesFromEdm.remove(String.valueOf("EntryDate"));
verifyTagOrdering(xmlString, expectedPropertyNamesFromEdm.toArray(new String[0]));
}
@Test(expected = EntityProviderException.class)
- public void serializeAtomEntryWithNullData() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomEntryWithNullData() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
AtomEntityProvider ser = createAtomEntityProvider();
ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), null, properties);
}
@Test(expected = EntityProviderException.class)
- public void serializeAtomEntryWithEmptyHashMap() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomEntryWithEmptyHashMap() throws IOException, XpathException, SAXException,
+ XMLStreamException, FactoryConfigurationError, ODataException {
final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
AtomEntityProvider ser = createAtomEntityProvider();
- ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), new HashMap<String, Object>(), properties);
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+ new HashMap<String, Object>(), properties);
}
@Test
- public void serializeAtomEntry() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomEntry() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), roomData, properties);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), roomData, properties);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -458,9 +489,12 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeEntryId() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeEntryId() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -472,7 +506,9 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void serializeEntryTitle() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry/a:title", xmlString);
@@ -483,7 +519,9 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
@Test
public void serializeEntryUpdated() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry/a:updated", xmlString);
@@ -491,21 +529,28 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeIds() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeIds() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
assertXpathEvaluatesTo(BASE_URI.toASCIIString(), "/a:entry/@xml:base", xmlString);
assertXpathExists("/a:entry/a:id", xmlString);
- assertXpathEvaluatesTo(BASE_URI.toASCIIString() + "Container2.Photos(Id=1,Type='image%2Fpng')", "/a:entry/a:id/text()", xmlString);
+ assertXpathEvaluatesTo(BASE_URI.toASCIIString() + "Container2.Photos(Id=1,Type='image%2Fpng')",
+ "/a:entry/a:id/text()", xmlString);
}
@Test
- public void serializeProperties() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeProperties() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry/m:properties", xmlString);
@@ -514,24 +559,31 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeWithValueEncoding() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeWithValueEncoding() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
photoData.put("Type", "< Ö >");
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
assertXpathEvaluatesTo(BASE_URI.toASCIIString(), "/a:entry/@xml:base", xmlString);
assertXpathExists("/a:entry/a:id", xmlString);
- assertXpathEvaluatesTo(BASE_URI.toASCIIString() + "Container2.Photos(Id=1,Type='%3C%20%C3%96%20%3E')", "/a:entry/a:id/text()", xmlString);
+ assertXpathEvaluatesTo(BASE_URI.toASCIIString() + "Container2.Photos(Id=1,Type='%3C%20%C3%96%20%3E')",
+ "/a:entry/a:id/text()", xmlString);
assertXpathEvaluatesTo("Container2.Photos(Id=1,Type='%3C%20%C3%96%20%3E')", "/a:entry/a:link/@href", xmlString);
}
@Test
- public void serializeCategory() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeCategory() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry/a:category", xmlString);
@@ -542,9 +594,12 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeETag() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeETag() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -554,7 +609,8 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeETagEncoding() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeETagEncoding() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
Edm edm = MockFacade.getMockEdm();
EdmTyped roomIdProperty = edm.getEntityType("RefScenario", "Room").getProperty("Id");
EdmFacets facets = mock(EdmFacets.class);
@@ -564,7 +620,8 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
roomData.put("Id", "<\">");
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(edm.getDefaultEntityContainer().getEntitySet("Rooms"), roomData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(edm.getDefaultEntityContainer().getEntitySet("Rooms"), roomData, DEFAULT_PROPERTIES);
assertNotNull(response);
assertNotNull(response.getEntity());
@@ -579,9 +636,12 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeCustomMapping() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeCustomMapping() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos"), photoData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
assertXpathExists("/a:entry", xmlString);
@@ -625,9 +685,12 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
}
@Test
- public void serializeAtomMediaResourceLinks() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException {
+ public void serializeAtomMediaResourceLinks() throws IOException, XpathException, SAXException, XMLStreamException,
+ FactoryConfigurationError, ODataException {
AtomEntityProvider ser = createAtomEntityProvider();
- ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData, DEFAULT_PROPERTIES);
+ ODataResponse response =
+ ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
+ DEFAULT_PROPERTIES);
String xmlString = verifyResponse(response);
String rel = Edm.NAMESPACE_REL_2007_08 + "ne_Manager";
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomFeedProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomFeedProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomFeedProducerTest.java
index 7d1d957..61efdf2 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomFeedProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomFeedProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;
@@ -67,8 +67,8 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
@Test
public void testFeedNamespaces() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- //EntityProviderProperties properties = EntityProviderProperties.baseUri(BASE_URI).mediaResourceMimeType("mediatype").inlineCountType(view.getInlineCount()).build();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
@@ -79,7 +79,8 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
@Test
public void testSelfLink() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
@@ -92,7 +93,9 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
public void testCustomSelfLink() throws Exception {
String customLink = "Test";
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").selfLink(new URI(customLink)).build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").selfLink(
+ new URI(customLink)).build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
@@ -104,7 +107,8 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
@Test
public void testFeedMandatoryParts() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
@@ -149,7 +153,8 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
when(view.getInlineCount()).thenReturn(InlineCount.NONE);
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
@@ -175,7 +180,9 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
@Test(expected = EntityProviderException.class)
public void testInlineCountInvalid() throws Exception {
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").inlineCountType(InlineCount.ALLPAGES).build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").inlineCountType(
+ InlineCount.ALLPAGES).build();
ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
}
@@ -184,7 +191,8 @@ public class AtomFeedProducerTest extends AbstractProviderTest {
initializeRoomData(103);
AtomEntityProvider ser = createAtomEntityProvider();
- EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
+ EntityProviderWriteProperties properties =
+ EntityProviderWriteProperties.serviceRoot(BASE_URI).mediaResourceMimeType("mediatype").build();
ODataResponse response = ser.writeFeed(view.getTargetEntitySet(), roomsData, properties);
String xmlString = verifyResponse(response);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducerTest.java
index 4fcef66..a98110c 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;
@@ -82,7 +82,8 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
@Test
public void writeEmptyServiceDocumentOverRuntimeDelegate() throws Exception {
- ODataResponse response = EntityProvider.writeServiceDocument(HttpContentType.APPLICATION_ATOM_XML, edm, "http://localhost");
+ ODataResponse response =
+ EntityProvider.writeServiceDocument(HttpContentType.APPLICATION_ATOM_XML, edm, "http://localhost");
String xmlString = verifyResponse(response);
assertXpathExists("/a:service", xmlString);
@@ -108,7 +109,8 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
entitySets.add(new EntitySet().setName("Employees"));
List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
- entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets));
+ entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
+ entitySets));
schemas.add(new Schema().setEntityContainers(entityContainers));
@@ -125,8 +127,10 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
entitySets.add(new EntitySet().setName("Employees"));
List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
- entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets));
- entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets));
+ entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
+ entitySets));
+ entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(
+ entitySets));
schemas.add(new Schema().setEntityContainers(entityContainers));
@@ -138,7 +142,8 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString);
- assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container2.Employees']/atom:title", xmlString);
+ assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container2.Employees']/atom:title",
+ xmlString);
}
@Test
@@ -147,12 +152,16 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
entitySets.add(new EntitySet().setName("Employees"));
List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
- entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets));
- entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets));
+ entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
+ entitySets));
+ entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(
+ entitySets));
List<EntityContainer> entityContainers2 = new ArrayList<EntityContainer>();
- entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container3").setEntitySets(entitySets));
- entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container4").setEntitySets(entitySets));
+ entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container3").setEntitySets(
+ entitySets));
+ entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container4").setEntitySets(
+ entitySets));
schemas.add(new Schema().setEntityContainers(entityContainers));
schemas.add(new Schema().setEntityContainers(entityContainers2));
@@ -165,15 +174,18 @@ public class AtomServiceDocumentProducerTest extends AbstractXmlProducerTestHelp
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString);
- assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container2.Employees']/atom:title", xmlString);
+ assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container2.Employees']/atom:title",
+ xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString);
- assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container3.Employees']/atom:title", xmlString);
+ assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container3.Employees']/atom:title",
+ xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString);
assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString);
- assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container4.Employees']/atom:title", xmlString);
+ assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container4.Employees']/atom:title",
+ xmlString);
}
private String verifyResponse(final ODataResponse response) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
index a39dcd2..b10c68e 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;
@@ -196,7 +196,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class EntryCallback implements OnWriteEntryContent {
@Override
- public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context) throws ODataApplicationException {
+ public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
+ throws ODataApplicationException {
WriteEntryCallbackResult result = new WriteEntryCallbackResult();
result.setEntryData(null);
result.setInlineProperties(DEFAULT_PROPERTIES);
@@ -207,14 +208,17 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nr_Building", callback);
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, roomData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ final ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, roomData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
- Map<String, Object> roomEntry = new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
- //remove d wrapper
+ Map<String, Object> roomEntry =
+ new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
+ // remove d wrapper
roomEntry = (Map<String, Object>) roomEntry.get("d");
assertEquals(2, roomEntry.size());
assertTrue(roomEntry.containsKey("nr_Building"));
@@ -237,7 +241,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class EntryCallback implements OnWriteEntryContent {
@Override
- public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context) throws ODataApplicationException {
+ public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
+ throws ODataApplicationException {
WriteEntryCallbackResult result = new WriteEntryCallbackResult();
result.setEntryData(new HashMap<String, Object>());
result.setInlineProperties(DEFAULT_PROPERTIES);
@@ -248,14 +253,17 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nr_Building", callback);
- ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, roomData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, roomData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
- Map<String, Object> roomEntry = new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
- //remove d wrapper
+ Map<String, Object> roomEntry =
+ new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
+ // remove d wrapper
roomEntry = (Map<String, Object>) roomEntry.get("d");
assertEquals(2, roomEntry.size());
assertTrue(roomEntry.containsKey("nr_Building"));
@@ -277,7 +285,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class EntryCallback implements OnWriteEntryContent {
@Override
- public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context) throws ODataApplicationException {
+ public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
+ throws ODataApplicationException {
Map<String, Object> buildingData = new HashMap<String, Object>();
buildingData.put("Id", "1");
WriteEntryCallbackResult result = new WriteEntryCallbackResult();
@@ -290,8 +299,10 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nr_Building", callback);
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, roomData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ final ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, roomData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
@@ -351,7 +362,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
callbacks.put("nr_Building", null);
new JsonEntityProvider().writeEntry(entitySet, roomData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks)
+ .build());
}
@@ -369,7 +381,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class FeedCallback implements OnWriteFeedContent {
@Override
- public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context) throws ODataApplicationException {
+ public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
+ throws ODataApplicationException {
Map<String, Object> roomData = new HashMap<String, Object>();
roomData.put("Id", "1");
roomData.put("Version", 1);
@@ -385,8 +398,10 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nb_Rooms", callback);
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ final ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, buildingData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
@@ -418,7 +433,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class FeedCallback implements OnWriteFeedContent {
@Override
- public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context) throws ODataApplicationException {
+ public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
+ throws ODataApplicationException {
WriteFeedCallbackResult result = new WriteFeedCallbackResult();
result.setFeedData(null);
result.setInlineProperties(DEFAULT_PROPERTIES);
@@ -429,14 +445,17 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nb_Rooms", callback);
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ final ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, buildingData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
- Map<String, Object> buildingEntry = new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
- //remove d wrapper
+ Map<String, Object> buildingEntry =
+ new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
+ // remove d wrapper
buildingEntry = (Map<String, Object>) buildingEntry.get("d");
assertEquals(2, buildingEntry.size());
assertTrue(buildingEntry.containsKey("nb_Rooms"));
@@ -461,7 +480,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
class FeedCallback implements OnWriteFeedContent {
@Override
- public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context) throws ODataApplicationException {
+ public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
+ throws ODataApplicationException {
WriteFeedCallbackResult result = new WriteFeedCallbackResult();
result.setFeedData(new ArrayList<Map<String, Object>>());
result.setInlineProperties(DEFAULT_PROPERTIES);
@@ -472,14 +492,17 @@ public class JsonEntryEntityProducerTest extends BaseTest {
Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
callbacks.put("nb_Rooms", callback);
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ final ODataResponse response =
+ new JsonEntityProvider().writeEntry(entitySet, buildingData,
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
+ .callbacks(callbacks).build());
assertNotNull(response);
assertNotNull(response.getEntity());
assertNull("EntitypProvider must not set content header", response.getContentHeader());
- Map<String, Object> buildingEntry = new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
- //remove d wrapper
+ Map<String, Object> buildingEntry =
+ new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
+ // remove d wrapper
buildingEntry = (Map<String, Object>) buildingEntry.get("d");
assertEquals(2, buildingEntry.size());
assertTrue(buildingEntry.containsKey("nb_Rooms"));
@@ -531,7 +554,8 @@ public class JsonEntryEntityProducerTest extends BaseTest {
callbacks.put("nb_Rooms", null);
new JsonEntityProvider().writeEntry(entitySet, buildingData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks).build());
+ EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks)
+ .build());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonErrorProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonErrorProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonErrorProducerTest.java
index e641762..29f1e95 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonErrorProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonErrorProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;
@@ -68,9 +68,12 @@ public class JsonErrorProducerTest {
assertNull("EntitypProvider must not set content header", response.getContentHeader());
assertEquals(ODataServiceVersion.V10, response.getHeader(ODataHttpHeaders.DATASERVICEVERSION));
final String jsonErrorMessage = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertEquals("{\"error\":{\"code\":" + (errorCode == null ? "null" : "\"" + errorCode + "\"") + ","
+ assertEquals("{\"error\":{\"code\":"
+ + (errorCode == null ? "null" : "\"" + errorCode + "\"")
+ + ","
+ "\"message\":{\"lang\":"
- + (locale == null ? "null" : ("\"" + locale.getLanguage() + (locale.getCountry().isEmpty() ? "" : ("-" + locale.getCountry())) + "\""))
+ + (locale == null ? "null" : ("\"" + locale.getLanguage()
+ + (locale.getCountry().isEmpty() ? "" : ("-" + locale.getCountry())) + "\""))
+ ",\"value\":" + (message == null ? "null" : "\"" + message + "\"") + "}}}",
jsonErrorMessage);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducerTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducerTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducerTest.java
index 13a8f64..a2195ae 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducerTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducerTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.producer;