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 f5a9fa9d5..000000000 --- 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 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"); - } -} 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 0562670b0..000000000 --- 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 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"); - } -} 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 4d7f5d7c1..7a28ed109 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