You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/04/01 16:18:49 UTC
[22/51] [abbrv] git commit: Consolidating ServiceDocument IT tests
Consolidating ServiceDocument IT tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8c58e3ea
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8c58e3ea
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8c58e3ea
Branch: refs/heads/master
Commit: 8c58e3ea8d75316d25acae49cb0f6610ec39356b
Parents: 72b264e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 06:39:30 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 06:39:30 2014 +0100
----------------------------------------------------------------------
.../v3/ServiceDocumentRetrieveTestITCase.java | 73 -------------------
.../v4/ServiceDocumentRetrieveTestITCase.java | 74 --------------------
.../core/it/v4/ServiceDocumentTestITCase.java | 8 ++-
3 files changed, 7 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
deleted file mode 100644
index f5a9fa9..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
- *
- * 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.
- */
-package org.apache.olingo.client.core.it.v3;
-
-import static org.junit.Assert.*;
-import java.net.URI;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
-
- private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
- final ODataServiceDocumentRequest req =
- client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
- req.setFormat(reqFormat);
- req.setAccept(acceptFormat);
- final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
- assertEquals(200, res.getStatusCode());
- final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(24, serviceDocument.getEntitySetTitles().size());
- assertEquals(URI.create(testStaticServiceRootURL + "/Customer"), serviceDocument.getEntitySetURI("Customer"));
- }
-
- @Test
- public void jsonTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON, "application/json");
- }
-
- @Test
- public void jsonNoMetadataTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json");
- }
-
- @Test
- public void xmlTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/xml");
- }
-
- @Test(expected = ODataClientErrorException.class)
- public void atomAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml");
- }
-
- @Test
- public void nullAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, null);
- }
-
- @Test
- public void nullServiceFormatTest() {
- retrieveServiceDocumentTest(null, "application/xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
deleted file mode 100644
index 0562670..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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
- *
- * 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.
- */
-package org.apache.olingo.client.core.it.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
-
- private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
- final ODataServiceDocumentRequest req =
- client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
- req.setFormat(reqFormat);
- req.setAccept(acceptFormat);
- final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
- assertEquals(200, res.getStatusCode());
- final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(12, serviceDocument.getEntitySetTitles().size());
- assertEquals(URI.create(testStaticServiceRootURL + "/Customers"), serviceDocument.getEntitySetURI("Customers"));
- assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
- }
-
- @Test
- @Ignore
- public void jsonTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON, "application/json");
- }
-
- @Test
- @Ignore
- public void jsonNoMetadataTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json");
- }
-
- @Test
- public void xmlTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/xml");
- }
-
- @Test(expected = ODataClientErrorException.class)
- public void atomAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml");
- }
-
- @Test
- public void nullServiceFormatTest() {
- retrieveServiceDocumentTest(null, "application/xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
index 4d7f5d7..7a28ed1 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -41,10 +41,16 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
final ODataServiceDocument serviceDocument = res.getBody();
assertEquals(12, serviceDocument.getEntitySetTitles().size());
+ assertEquals(6, serviceDocument.getSingletonTitles().size());
+ assertEquals(6, serviceDocument.getFunctionImportTitles().size());
+ assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
serviceDocument.getEntitySetURI("ProductDetails"));
- assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
+ assertEquals(URI.create(testStaticServiceRootURL + "/Boss"),
+ serviceDocument.getSingletonURI("Boss"));
+ assertEquals(URI.create(testStaticServiceRootURL + "/GetPerson"),
+ serviceDocument.getFunctionImportURI("GetPerson"));
}
@Test