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:34:03 UTC
[41/59] [abbrv] cleanup of odata fit tests
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProvider.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProvider.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProvider.java
index b2ee1e3..cd46253 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProvider.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProvider.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.fit.mapping;
@@ -84,9 +84,15 @@ public class MapProvider extends EdmProvider {
key = new Key();
key.setKeys(Arrays.asList(propertyRef));
- property1 = new SimpleProperty().setName(mapping[P1][EDM]).setType(EdmSimpleTypeKind.String).setMapping(new Mapping().setObject(mapping[P1][BACKEND]));
- property2 = new SimpleProperty().setName(mapping[P2][EDM]).setType(EdmSimpleTypeKind.String).setMapping(new Mapping().setObject(mapping[P2][BACKEND]));
- property3 = new SimpleProperty().setName(mapping[P3][EDM]).setType(EdmSimpleTypeKind.String).setMapping(new Mapping().setObject(mapping[P3][BACKEND]));
+ property1 =
+ new SimpleProperty().setName(mapping[P1][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
+ new Mapping().setObject(mapping[P1][BACKEND]));
+ property2 =
+ new SimpleProperty().setName(mapping[P2][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
+ new Mapping().setObject(mapping[P2][BACKEND]));
+ property3 =
+ new SimpleProperty().setName(mapping[P3][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
+ new Mapping().setObject(mapping[P3][BACKEND]));
entityType = new EntityType();
entityType.setName(mapping[ENTITYTYPE][EDM]);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MappingTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MappingTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MappingTest.java
index e701efd..e668a9d 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MappingTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MappingTest.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.fit.mapping;
@@ -30,11 +30,6 @@ import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
-import org.custommonkey.xmlunit.SimpleNamespaceContext;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.Before;
-import org.junit.Test;
-
import org.apache.olingo.odata2.api.ODataService;
import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.apache.olingo.odata2.api.edm.Edm;
@@ -42,6 +37,10 @@ import org.apache.olingo.odata2.api.exception.ODataException;
import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
import org.apache.olingo.odata2.testutil.helper.StringHelper;
import org.apache.olingo.odata2.testutil.server.TestServer;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Before;
+import org.junit.Test;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefJsonTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefJsonTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefJsonTest.java
index cd22356..72ce71b 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefJsonTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefJsonTest.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.fit.ref;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
index 0e09fdc..e802b06 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.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.fit.ref;
@@ -50,7 +50,7 @@ import org.apache.olingo.odata2.testutil.helper.StringHelper;
/**
* Abstract base class for tests employing the reference scenario.
- *
+ *
*/
public class AbstractRefTest extends AbstractFitTest {
@@ -125,11 +125,13 @@ public class AbstractRefTest extends AbstractFitTest {
return response;
}
- protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue, final HttpStatusCodes expectedStatusCode) throws Exception {
+ protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, expectedStatusCode);
}
- protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue) throws Exception {
+ protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue)
+ throws Exception {
return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, HttpStatusCodes.OK);
}
@@ -155,7 +157,8 @@ public class AbstractRefTest extends AbstractFitTest {
assertNotNull(getBody(response));
}
- protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode) throws Exception, AssertionError {
+ protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
+ throws Exception, AssertionError {
final HttpResponse response = callUri(ODataHttpMethod.DELETE, uri, null, null, null, null, expectedStatusCode);
if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
response.getEntity().getContent().close();
@@ -166,18 +169,23 @@ public class AbstractRefTest extends AbstractFitTest {
deleteUri(uri, HttpStatusCodes.NO_CONTENT);
}
- protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType, final HttpStatusCodes expectedStatusCode) throws Exception {
+ protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
return callUri(ODataHttpMethod.POST, uri, null, null, requestBody, requestContentType, expectedStatusCode);
}
- protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType, final String additionalHeader, final String additionalHeaderValue, final HttpStatusCodes expectedStatusCode) throws Exception {
- return callUri(ODataHttpMethod.POST, uri, additionalHeader, additionalHeaderValue, requestBody, requestContentType, expectedStatusCode);
+ protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+ final String additionalHeader, final String additionalHeaderValue, final HttpStatusCodes expectedStatusCode)
+ throws Exception {
+ return callUri(ODataHttpMethod.POST, uri, additionalHeader, additionalHeaderValue, requestBody, requestContentType,
+ expectedStatusCode);
}
protected void putUri(final String uri,
final String requestBody, final String requestContentType,
final HttpStatusCodes expectedStatusCode) throws Exception {
- final HttpResponse response = callUri(ODataHttpMethod.PUT, uri, null, null, requestBody, requestContentType, expectedStatusCode);
+ final HttpResponse response =
+ callUri(ODataHttpMethod.PUT, uri, null, null, requestBody, requestContentType, expectedStatusCode);
if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
response.getEntity().getContent().close();
}
@@ -186,8 +194,10 @@ public class AbstractRefTest extends AbstractFitTest {
protected void putUri(final String uri, final String acceptHeader,
final String requestBody, final String requestContentType,
final HttpStatusCodes expectedStatusCode) throws Exception {
- final HttpResponse response = callUri(ODataHttpMethod.PUT, uri,
- org.apache.olingo.odata2.api.commons.HttpHeaders.ACCEPT, acceptHeader, requestBody, requestContentType, expectedStatusCode);
+ final HttpResponse response =
+ callUri(ODataHttpMethod.PUT, uri,
+ org.apache.olingo.odata2.api.commons.HttpHeaders.ACCEPT, acceptHeader, requestBody, requestContentType,
+ expectedStatusCode);
if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
response.getEntity().getContent().close();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefXmlTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefXmlTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefXmlTest.java
index 48ba3f0..8a88084 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefXmlTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefXmlTest.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.fit.ref;
@@ -26,18 +26,17 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
import org.custommonkey.xmlunit.SimpleNamespaceContext;
import org.custommonkey.xmlunit.XMLUnit;
import org.custommonkey.xmlunit.exceptions.XpathException;
import org.junit.Before;
import org.xml.sax.SAXException;
-import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
-import org.apache.olingo.odata2.api.edm.Edm;
-
/**
* Abstract base class for tests employing the reference scenario reading or writing XML.
- *
+ *
*/
public class AbstractRefXmlTest extends AbstractRefTest {
@Before
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/BatchTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/BatchTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/BatchTest.java
index 6bcb8c5..c2fcad0 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/BatchTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/BatchTest.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.fit.ref;
@@ -46,7 +46,8 @@ public class BatchTest extends AbstractRefTest {
@Test
public void testSimpleBatch() throws Exception {
String responseBody = execute("/simple.batch");
- assertFalse(responseBody.contains("<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">"));
+ assertFalse(responseBody
+ .contains("<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">"));
assertTrue(responseBody.contains("<edmx:Edmx Version=\"1.0\""));
}
@@ -82,25 +83,24 @@ public class BatchTest extends AbstractRefTest {
HttpResponse response = execute("/batchWithContentIdPart2.batch", "batch_cf90-46e5-1246");
String responseBody = StringHelper.inputStreamToString(response.getEntity().getContent(), true);
- assertContentContainValues(responseBody,
- "{\"d\":{\"EmployeeName\":\"Frederic Fall\"}}",
- "HTTP/1.1 201 Created",
- "Content-Id: employee",
- "Content-Type: application/json;odata=verbose",
- "\"EmployeeId\":\"7\",\"EmployeeName\":\"Employee 7\",",
- "HTTP/1.1 204 No Content",
- "Content-Id: AAA",
- "{\"d\":{\"EmployeeName\":\"Robert Fall\"}}"
- );
-
+ assertContentContainValues(responseBody,
+ "{\"d\":{\"EmployeeName\":\"Frederic Fall\"}}",
+ "HTTP/1.1 201 Created",
+ "Content-Id: employee",
+ "Content-Type: application/json;odata=verbose",
+ "\"EmployeeId\":\"7\",\"EmployeeName\":\"Employee 7\",",
+ "HTTP/1.1 204 No Content",
+ "Content-Id: AAA",
+ "{\"d\":{\"EmployeeName\":\"Robert Fall\"}}");
+
// validate that response for PUT does not contains a Content Type
int indexNoContent = responseBody.indexOf("HTTP/1.1 204 No Content");
int indexBoundary = responseBody.indexOf("--changeset_", indexNoContent);
-
+
int indexContentType = responseBody.indexOf("Content-Type:", indexNoContent);
Assert.assertTrue(indexBoundary < indexContentType);
}
-
+
@Test
public void testErrorBatch() throws Exception {
String responseBody = execute("/error.batch");
@@ -108,12 +108,12 @@ public class BatchTest extends AbstractRefTest {
}
/**
- * Validate that given <code>content</code> contains all <code>values</code> in the given order.
+ * Validate that given <code>content</code> contains all <code>values</code> in the given order.
*
* @param content
* @param containingValues
*/
- private void assertContentContainValues(String content, String ... containingValues) {
+ private void assertContentContainValues(final String content, final String... containingValues) {
int index = -1;
for (String value : containingValues) {
int newIndex = content.indexOf(value, index);
@@ -129,7 +129,8 @@ public class BatchTest extends AbstractRefTest {
return responseBody;
}
- private HttpResponse execute(final String batchResource, String boundary) throws IOException, UnsupportedEncodingException, ClientProtocolException {
+ private HttpResponse execute(final String batchResource, final String boundary) throws IOException,
+ UnsupportedEncodingException, ClientProtocolException {
final HttpPost post = new HttpPost(URI.create(getEndpoint().toString() + "$batch"));
post.setHeader("Content-Type", "multipart/mixed;boundary=" + boundary);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/ContentNegotiationTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/ContentNegotiationTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/ContentNegotiationTest.java
index e590e1b..d8ccbc4 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/ContentNegotiationTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/ContentNegotiationTest.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.fit.ref;
@@ -96,7 +96,8 @@ public class ContentNegotiationTest extends AbstractRefTest {
@Test
public void contentTypeServiceDocumentAtomXmlNotAccept() throws Exception {
- final HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML, HttpStatusCodes.NOT_ACCEPTABLE);
+ final HttpResponse response =
+ callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML, HttpStatusCodes.NOT_ACCEPTABLE);
checkMediaType(response, HttpContentType.APPLICATION_XML);
String body = getBody(response);
assertTrue(body.length() > 100);
@@ -112,7 +113,8 @@ public class ContentNegotiationTest extends AbstractRefTest {
@Test
public void contentTypeServiceDocumentAtomSvcXml() throws Exception {
- final HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_SVC, HttpStatusCodes.OK);
+ final HttpResponse response =
+ callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_SVC, HttpStatusCodes.OK);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
assertTrue(getBody(response).length() > 100);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/DataServiceVersionTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/DataServiceVersionTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/DataServiceVersionTest.java
index 2b3f7a8..6b9be91 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/DataServiceVersionTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/DataServiceVersionTest.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.fit.ref;
@@ -23,11 +23,10 @@ import static org.junit.Assert.assertNotNull;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
-import org.junit.Test;
-
import org.apache.olingo.odata2.api.ODataServiceVersion;
import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.apache.olingo.odata2.api.commons.ODataHttpHeaders;
+import org.junit.Test;
/**
*
@@ -73,7 +72,8 @@ public class DataServiceVersionTest extends AbstractRefTest {
@Test
public void testDataServiceVersionSetOnEntitySetFail() throws Exception {
- HttpResponse response = callUri("Employees", ODataHttpHeaders.DATASERVICEVERSION, "3.0", HttpStatusCodes.BAD_REQUEST);
+ HttpResponse response =
+ callUri("Employees", ODataHttpHeaders.DATASERVICEVERSION, "3.0", HttpStatusCodes.BAD_REQUEST);
checkVersion(response, ODataServiceVersion.V10);
getBody(response);
response = callUri("$metadata", ODataHttpHeaders.DATASERVICEVERSION, "3.0", HttpStatusCodes.BAD_REQUEST);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonChangeTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonChangeTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonChangeTest.java
index 2f9be76..4327491 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonChangeTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonChangeTest.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.fit.ref;
@@ -29,7 +29,7 @@ import org.junit.Test;
/**
* Tests employing the reference scenario changing entities in JSON format.
- *
+ *
*/
public class EntryJsonChangeTest extends AbstractRefTest {
@@ -37,9 +37,11 @@ public class EntryJsonChangeTest extends AbstractRefTest {
public void createEntry() throws Exception {
final String requestBody = "{\"Id\":\"99\",\"Name\":\"Building 4\",\"Image\":\"" + PHOTO_DEFAULT_IMAGE + "\","
+ "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('101')\"}}}";
- final HttpResponse response = postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
- assertEquals("{\"d\":{\"Image\":\"" + PHOTO_DEFAULT_IMAGE + "\"}}", getBody(callUri("Buildings('4')/Image?$format=json")));
+ assertEquals("{\"d\":{\"Image\":\"" + PHOTO_DEFAULT_IMAGE + "\"}}",
+ getBody(callUri("Buildings('4')/Image?$format=json")));
checkUri("Buildings('4')/nb_Rooms('101')?$format=json");
postUri("Buildings()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.BAD_REQUEST);
@@ -48,7 +50,8 @@ public class EntryJsonChangeTest extends AbstractRefTest {
@Test
public void createEntryMinimal() throws Exception {
final String requestBody = "{\"Id\":\"99\"}";
- final HttpResponse response = postUri("Teams()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Teams()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Teams('4')?$format=json");
}
@@ -56,7 +59,8 @@ public class EntryJsonChangeTest extends AbstractRefTest {
@Test
public void createEntryWithNavigation() throws Exception {
final String requestBody = "{\"Id\":\"199\",\"Name\":\"Room 199\"}";
- final HttpResponse response = postUri("Buildings('1')/nb_Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Buildings('1')/nb_Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Rooms('104')?$format=json");
assertEquals("1", getBody(callUri("Rooms('104')/nr_Building/Id/$value")));
@@ -67,7 +71,8 @@ public class EntryJsonChangeTest extends AbstractRefTest {
public void createEntryWithLink() throws Exception {
final String requestBody = "{\"Id\":\"99\",\"Name\":\"new room\",\"Seats\":19,\"Version\":42,"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Buildings('1')\"}}}";
- final HttpResponse response = postUri("Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Rooms('104')/nr_Building?$format=json");
assertEquals("{\"d\":{\"Name\":\"Building 1\"}}", getBody(callUri("Rooms('104')/nr_Building/Name?$format=json")));
@@ -77,7 +82,8 @@ public class EntryJsonChangeTest extends AbstractRefTest {
public void createEntryWithInlineEntry() throws Exception {
final String requestBody = "{\"Id\":\"99\",\"Name\":\"new room\",\"Seats\":19,\"Version\":42,"
+ "\"nr_Building\":{\"Id\":\"9\",\"Name\":\"new building\"}}";
- final HttpResponse response = postUri("Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Rooms()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Rooms('104')/nr_Building?$format=json");
assertEquals("{\"d\":{\"Name\":\"new building\"}}", getBody(callUri("Rooms('104')/nr_Building/Name?$format=json")));
@@ -90,14 +96,18 @@ public class EntryJsonChangeTest extends AbstractRefTest {
+ " {\"Id\":\"202\",\"Name\":\"Room 202\",\"Seats\":6,\"Version\":3,"
+ " \"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Employees('5')\"}},"
+ " \"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Employees('6')\"}}}]}";
- final HttpResponse response = postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Buildings('4')?$format=json");
checkUri("Buildings('4')/nb_Rooms('104')?$format=json");
- assertEquals("{\"d\":{\"results\":[]}}", getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees?$format=json")));
+ assertEquals("{\"d\":{\"results\":[]}}",
+ getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees?$format=json")));
assertEquals("{\"d\":{\"Seats\":6}}", getBody(callUri("Buildings('4')/nb_Rooms('105')/Seats?$format=json")));
- assertEquals("{\"d\":{\"EmployeeName\":\"" + EMPLOYEE_5_NAME + "\"}}", getBody(callUri("Buildings('4')/nb_Rooms('105')/nr_Employees('5')/EmployeeName?$format=json")));
- assertEquals("{\"d\":{\"Age\":" + EMPLOYEE_6_AGE + "}}", getBody(callUri("Buildings('4')/nb_Rooms('105')/nr_Employees('6')/Age?$format=json")));
+ assertEquals("{\"d\":{\"EmployeeName\":\"" + EMPLOYEE_5_NAME + "\"}}",
+ getBody(callUri("Buildings('4')/nb_Rooms('105')/nr_Employees('5')/EmployeeName?$format=json")));
+ assertEquals("{\"d\":{\"Age\":" + EMPLOYEE_6_AGE + "}}",
+ getBody(callUri("Buildings('4')/nb_Rooms('105')/nr_Employees('6')/Age?$format=json")));
}
@Test
@@ -108,12 +118,15 @@ public class EntryJsonChangeTest extends AbstractRefTest {
+ "\"Location\":{\"City\":{\"PostalCode\":null,\"CityName\":null},\"Country\":null},"
+ "\"EntryDate\":\"\\/Date(1424242424242)\\/\","
+ "\"ne_Manager\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Managers('1')\"}}}]}]}";
- final HttpResponse response = postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Buildings()", requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
assertFalse(getBody(response).isEmpty());
checkUri("Buildings('4')");
assertEquals("1", getBody(callUri("Buildings('4')/nb_Rooms('104')/Seats/$value")));
- assertEquals("2015-02-18T06:53:44.242", getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees('7')/EntryDate/$value")));
- assertEquals(MANAGER_NAME, getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees('7')/ne_Manager/EmployeeName/$value")));
+ assertEquals("2015-02-18T06:53:44.242",
+ getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees('7')/EntryDate/$value")));
+ assertEquals(MANAGER_NAME,
+ getBody(callUri("Buildings('4')/nb_Rooms('104')/nr_Employees('7')/ne_Manager/EmployeeName/$value")));
}
@Test
@@ -134,7 +147,8 @@ public class EntryJsonChangeTest extends AbstractRefTest {
final String requestBody = "{\"Location\":"
+ "{\"City\":{\"PostalCode\":\"69124\",\"CityName\":\"" + CITY_1_NAME + "\"},"
+ " \"Country\":\"Germany\"},\"EntryDate\":null}";
- callUri(ODataHttpMethod.PATCH, "Employees('2')", null, null, requestBody, HttpContentType.APPLICATION_JSON, HttpStatusCodes.NO_CONTENT);
+ callUri(ODataHttpMethod.PATCH, "Employees('2')", null, null, requestBody, HttpContentType.APPLICATION_JSON,
+ HttpStatusCodes.NO_CONTENT);
assertEquals(CITY_1_NAME, getBody(callUri("Employees('2')/Location/City/CityName/$value")));
assertEquals("{\"d\":{\"EntryDate\":null}}", getBody(callUri("Employees('2')/EntryDate?$format=json")));
assertEquals(EMPLOYEE_2_NAME, getBody(callUri("Employees('2')/EmployeeName/$value")));
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateInlineTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateInlineTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateInlineTest.java
index 6dea2f0..2aeef99 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateInlineTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateInlineTest.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.fit.ref;
@@ -26,11 +26,11 @@ import java.util.List;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.junit.Test;
import com.google.gson.internal.StringMap;
-import org.apache.olingo.odata2.api.commons.HttpContentType;
-import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
/**
*
@@ -39,23 +39,26 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
@Test
public void createThreeLevelsDeepInsert() throws Exception {
- String content = "{\"Name\" : \"Room 2\",\"nr_Building\" : {\"Name\" : \"Building 2\",\"nb_Rooms\" : {\"results\" : [{"
- + "\"nr_Employees\" : {\"__deferred\" : {\"uri\" : \"" + getEndpoint() + "Rooms('1')/nr_Employees\""
- + "}},\"nr_Building\" : {\"__deferred\" : {\"uri\" : \"" + getEndpoint() + "/Rooms('1')/nr_Building\""
- + "}}}]}}}";
-
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ String content =
+ "{\"Name\" : \"Room 2\",\"nr_Building\" : {\"Name\" : \"Building 2\",\"nb_Rooms\" : {\"results\" : [{"
+ + "\"nr_Employees\" : {\"__deferred\" : {\"uri\" : \"" + getEndpoint() + "Rooms('1')/nr_Employees\""
+ + "}},\"nr_Building\" : {\"__deferred\" : {\"uri\" : \"" + getEndpoint() + "/Rooms('1')/nr_Building\""
+ + "}}}]}}}";
+
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
- //Check inline building
+ // Check inline building
StringMap<?> map = getStringMap(body);
map = (StringMap<?>) map.get("nr_Building");
assertNotNull(map);
assertEquals("Building 2", map.get("Name"));
- //Check inline rooms of the inline building
+ // Check inline rooms of the inline building
map = (StringMap<?>) map.get("nb_Rooms");
assertNotNull(map);
@@ -76,7 +79,9 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"Id\":\"2\",\"Name\":\"Building 4\",\"Image\":null,"
+ "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Buildings('2')/nb_Rooms\"}}}}}";
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
checkEtag(response, "W/\"2\"");
@@ -114,7 +119,9 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"Id\":\"1\",\"Name\":\"Room 104\",\"Seats\":4,\"Version\":2,"
+ "\"nr_Employees\":[],"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
checkEtag(response, "W/\"2\"");
@@ -139,7 +146,9 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"Id\":\"1\",\"Name\":\"Room 104\",\"Seats\":4,\"Version\":2,"
+ "\"nr_Employees\":{\"results\":[]},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
checkEtag(response, "W/\"2\"");
@@ -174,9 +183,11 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Employees\"}},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Building\"}}}]}}";
- HttpResponse response = postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
- //checkEtag(response, "W/\"2\"");
+ // checkEtag(response, "W/\"2\"");
String body = getBody(response);
StringMap<?> map = getStringMap(body);
@@ -195,7 +206,8 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
map = getStringMap(body);
assertEquals("104", map.get("Id"));
assertEquals("Room 2", map.get("Name"));
- response = callUri("Buildings('4')/nb_Rooms('104')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+ response =
+ callUri("Buildings('4')/nb_Rooms('104')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
body = getBody(response);
assertEquals("5", body);
@@ -204,7 +216,8 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
map = getStringMap(body);
assertEquals("105", map.get("Id"));
assertEquals("Room 3", map.get("Name"));
- response = callUri("Buildings('4')/nb_Rooms('105')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+ response =
+ callUri("Buildings('4')/nb_Rooms('105')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
body = getBody(response);
assertEquals("2", body);
}
@@ -228,12 +241,18 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Employees\"}},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Building\"}}}]}}}";
- HttpResponse response = callUri("Buildings('4')/nb_Rooms('104')/", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.NOT_FOUND);
+ HttpResponse response =
+ callUri("Buildings('4')/nb_Rooms('104')/", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON,
+ HttpStatusCodes.NOT_FOUND);
getBody(response);
- response = callUri("Buildings('4')/nb_Rooms('105')/", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.NOT_FOUND);
+ response =
+ callUri("Buildings('4')/nb_Rooms('105')/", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON,
+ HttpStatusCodes.NOT_FOUND);
getBody(response);
- response = postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ response =
+ postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
@@ -263,10 +282,12 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
assertEquals("Room 3", resultMap.get("Name"));
}
}
- response = callUri("Buildings('4')/nb_Rooms('104')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+ response =
+ callUri("Buildings('4')/nb_Rooms('104')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
assertEquals("5", getBody(response));
- response = callUri("Buildings('4')/nb_Rooms('105')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+ response =
+ callUri("Buildings('4')/nb_Rooms('105')/Seats/$value", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
assertEquals("2", getBody(response));
}
@@ -293,7 +314,9 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"ImageUrl\": \"" + getEndpoint() + "Employees('1')/$value\"}]},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
@@ -317,7 +340,8 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"Id\":\"1\",\"Name\":\"Room 104\",\"Seats\":4,\"Version\":2,"
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Employees\"}},"
+ "\"nr_Building\":{\"results\":[]}}}";
- postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.BAD_REQUEST);
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON,
+ HttpStatusCodes.BAD_REQUEST);
}
@Test
@@ -338,7 +362,8 @@ public class EntryJsonCreateInlineTest extends AbstractRefJsonTest {
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Employees\"}},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('3')/nr_Building\"}}}]}}}";
- postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.BAD_REQUEST);
+ postUri("Buildings", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.BAD_REQUEST);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateTest.java
index 0d2f37b..ca3d884 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonCreateTest.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.fit.ref;
@@ -24,11 +24,11 @@ import static org.junit.Assert.assertNull;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.junit.Test;
import com.google.gson.internal.StringMap;
-import org.apache.olingo.odata2.api.commons.HttpContentType;
-import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
/**
*
@@ -44,7 +44,9 @@ public class EntryJsonCreateTest extends AbstractRefJsonTest {
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Employees\"}},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
assertNotNull(content);
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
@@ -72,7 +74,9 @@ public class EntryJsonCreateTest extends AbstractRefJsonTest {
+ "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Employees\"}},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
assertNotNull(content);
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
+ HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
@@ -93,7 +97,9 @@ public class EntryJsonCreateTest extends AbstractRefJsonTest {
String content = "{iVBORw0KGgoAAAANSUhEUgAAAB4AAAAwCAIAAACJ9F2zAAAAA}";
assertNotNull(content);
- HttpResponse response = postUri("Employees", content, HttpContentType.TEXT_PLAIN, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Employees", content, HttpContentType.TEXT_PLAIN, HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON,
+ HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_JSON);
String body = getBody(response);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
index 9711fa9..e2bc613 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
@@ -1,33 +1,32 @@
/*******************************************************************************
* 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.fit.ref;
import static org.junit.Assert.assertEquals;
import org.apache.http.HttpResponse;
-import org.junit.Test;
-
import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.junit.Test;
/**
* Tests employing the reference scenario reading a single entity in JSON format.
- *
+ *
*/
public class EntryJsonReadOnlyTest extends AbstractRefTest {
@@ -114,7 +113,9 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
@Test
public void entryWithTwoLevelInline() throws Exception {
- HttpResponse response = callUri("Employees('5')?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats,ne_Room/nr_Building/Name&$format=json");
+ HttpResponse response =
+ callUri("Employees('5')?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats," +
+ "ne_Room/nr_Building/Name&$format=json");
checkMediaType(response, HttpContentType.APPLICATION_JSON);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + getEndpoint() + "Employees('5')\","
@@ -132,7 +133,9 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
+ "\"type\":\"RefScenario.Building\"},\"Name\":\"Building 2\"}}}}",
getBody(response));
- response = callUri("Employees('1')?$expand=ne_Room/nr_Building&$select=EntryDate,ne_Manager,ne_Room/*,ne_Room/nr_Building/Name&$format=json");
+ response =
+ callUri("Employees('1')?$expand=ne_Room/nr_Building&$select=EntryDate,ne_Manager,ne_Room/*," +
+ "ne_Room/nr_Building/Name&$format=json");
checkMediaType(response, HttpContentType.APPLICATION_JSON);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + getEndpoint() + "Employees('1')\","
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlChangeTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlChangeTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlChangeTest.java
index 343001e..93616df 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlChangeTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlChangeTest.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.fit.ref;
@@ -35,7 +35,7 @@ import org.junit.Test;
/**
* Tests employing the reference scenario changing entities in XML format.
- *
+ *
*/
public class EntryXmlChangeTest extends AbstractRefXmlTest {
@@ -47,7 +47,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
.replace("Id>1", "Id>9")
.replace("Team 1", "Team X")
.replaceAll("<link.+?/>", "");
- HttpResponse response = postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Teams('4')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
assertNull(response.getFirstHeader(HttpHeaders.ETAG));
@@ -98,7 +99,9 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
HttpStatusCodes expectedStatusCode = HttpStatusCodes.CREATED;
String headerName = "Accept";
String headerValue = "application/atom+xml;type=entry";
- HttpResponse response = callUri(ODataHttpMethod.POST, "Teams()", headerName, headerValue, requestBody, requestContentType, expectedStatusCode );
+ HttpResponse response =
+ callUri(ODataHttpMethod.POST, "Teams()", headerName, headerValue, requestBody, requestContentType,
+ expectedStatusCode);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Teams('4')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
@@ -148,7 +151,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
.replace("Team 1", largeTeamName)
.replaceAll("<link.+?/>", "");
- HttpResponse response = postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Teams('4')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
assertNull(response.getFirstHeader(HttpHeaders.ETAG));
@@ -163,7 +167,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
+ " <content><m:properties><d:Id>99</d:Id></m:properties></content>" + "\n"
+ "</entry>";
- final HttpResponse response = postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ final HttpResponse response =
+ postUri("Teams()", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Teams('4')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
}
@@ -173,7 +178,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
getBody(callUri("Employees('7')", HttpStatusCodes.NOT_FOUND));
final String updateBody = "<invalidXml></invalid>";
- final HttpResponse postResult = postUri("Employees", updateBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ final HttpResponse postResult =
+ postUri("Employees", updateBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(postResult, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertXpathEvaluatesTo("7", "/atom:entry/m:properties/d:EmployeeId", getBody(postResult));
@@ -194,7 +200,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
response = postUri("Container2.Photos", "dummy", HttpContentType.TEXT_PLAIN, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
- assertEquals(getEndpoint() + "Container2.Photos(Id=5,Type='application%2Foctet-stream')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
+ assertEquals(getEndpoint() + "Container2.Photos(Id=5,Type='application%2Foctet-stream')", response.getFirstHeader(
+ HttpHeaders.LOCATION).getValue());
checkEtag(response, "W/\"5\"");
assertXpathEvaluatesTo("Photo 5", "/atom:entry/m:properties/d:Name", getBody(response));
response = callUri("Container2.Photos(Id=5,Type='application%2Foctet-stream')/$value");
@@ -204,7 +211,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
@Test
public void createMediaResourceWithNavigation() throws Exception {
- HttpResponse response = postUri("Teams('1')/nt_Employees", "X", HttpContentType.TEXT_PLAIN, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Teams('1')/nt_Employees", "X", HttpContentType.TEXT_PLAIN, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Employees('7')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
assertXpathEvaluatesTo("7", "/atom:entry/m:properties/d:EmployeeId", getBody(response));
@@ -253,12 +261,14 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
+ "<atom:updated>2012-02-29T11:59:59Z</atom:updated>"
+ "</atom:entry>";
- HttpResponse response = postUri("Buildings", buildingWithRooms, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Buildings", buildingWithRooms, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Buildings('4')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());
final String body = getBody(response);
assertXpathEvaluatesTo("4", "/atom:entry/atom:content/m:properties/d:Id", body);
- assertXpathEvaluatesTo("105", "/atom:entry/atom:link[@rel='" + Edm.NAMESPACE_REL_2007_08 + "nb_Rooms']/m:inline/atom:feed/atom:entry[2]/atom:content/m:properties/d:Id", body);
+ assertXpathEvaluatesTo("105", "/atom:entry/atom:link[@rel='" + Edm.NAMESPACE_REL_2007_08
+ + "nb_Rooms']/m:inline/atom:feed/atom:entry[2]/atom:content/m:properties/d:Id", body);
checkUri("Buildings('4')");
checkUri("Rooms('104')");
checkUri("Buildings('4')/nb_Rooms('104')");
@@ -278,7 +288,9 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
.replace("<d:Age>" + EMPLOYEE_2_AGE + "</d:Age>", "")
.replace(">2003-07-01T00:00:00", " m:null='true'>")
.replaceAll("<link.+?/>", "");
- final HttpResponse response = callUri(ODataHttpMethod.PUT, "Employees('1')", null, null, requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
+ final HttpResponse response =
+ callUri(ODataHttpMethod.PUT, "Employees('1')", null, null, requestBody,
+ HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
assertFalse(response.containsHeader(HttpHeaders.LOCATION));
final String body = getBody(callUri("Employees('1')"));
assertXpathEvaluatesTo("Mister X", "/atom:entry/m:properties/d:EmployeeName", body);
@@ -323,7 +335,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
public void updateInvalidXml() throws Exception {
final String requestBodyBefore = getBody(callUri("Employees('2')"));
- putUri("Employees('2')", "<invalidXml></invalid>", HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.BAD_REQUEST);
+ putUri("Employees('2')", "<invalidXml></invalid>", HttpContentType.APPLICATION_ATOM_XML_ENTRY,
+ HttpStatusCodes.BAD_REQUEST);
assertEquals(requestBodyBefore, getBody(callUri("Employees('2')")));
}
@@ -345,7 +358,8 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
+ " <d:EntryDate m:null=\"true\"/>" + "\n"
+ " </m:properties>" + "\n"
+ "</entry>";
- callUri(ODataHttpMethod.PATCH, "Employees('2')", null, null, requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
+ callUri(ODataHttpMethod.PATCH, "Employees('2')", null, null, requestBody,
+ HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
final String body = getBody(callUri("Employees('2')"));
assertXpathEvaluatesTo(CITY_1_NAME, "/atom:entry/m:properties/d:Location/d:City/d:CityName", body);
assertXpathEvaluatesTo(EMPLOYEE_2_AGE, "/atom:entry/m:properties/d:Age", body);
@@ -357,7 +371,9 @@ public class EntryXmlChangeTest extends AbstractRefXmlTest {
+ " <m:properties><d:Name>Room X</d:Name></m:properties>" + "\n"
+ " </content>" + "\n"
+ "</entry>";
- HttpResponse response = callUri(ODataHttpMethod.MERGE, "Rooms('3')", HttpHeaders.IF_MATCH, "W/\"3\"", requestBody, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
+ HttpResponse response =
+ callUri(ODataHttpMethod.MERGE, "Rooms('3')", HttpHeaders.IF_MATCH, "W/\"3\"", requestBody,
+ HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.NO_CONTENT);
checkEtag(response, "W/\"3\"");
assertXpathEvaluatesTo("Room X", "/atom:entry/atom:content/m:properties/d:Name", getBody(callUri("Rooms('3')")));
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b18130ac/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlCreateTest.java
----------------------------------------------------------------------
diff --git a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlCreateTest.java b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlCreateTest.java
index 51bdf14..8d7e436 100644
--- a/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlCreateTest.java
+++ b/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlCreateTest.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.fit.ref;
@@ -23,15 +23,14 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.apache.http.HttpResponse;
-import org.junit.Test;
-
import org.apache.olingo.odata2.api.commons.HttpContentType;
import org.apache.olingo.odata2.api.commons.HttpHeaders;
import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.junit.Test;
/**
* Tests employing the reference scenario changing entities in XML format.
- *
+ *
*/
public class EntryXmlCreateTest extends AbstractRefXmlTest {
@@ -42,7 +41,8 @@ public class EntryXmlCreateTest extends AbstractRefXmlTest {
String content = readFile("room_w_four_inlined_employees.xml");
assertNotNull(content);
- HttpResponse response = postUri("Rooms", content, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
+ HttpResponse response =
+ postUri("Rooms", content, HttpContentType.APPLICATION_ATOM_XML_ENTRY, HttpStatusCodes.CREATED);
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
assertEquals(getEndpoint() + "Rooms('104')", response.getFirstHeader(HttpHeaders.LOCATION).getValue());