diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java index aaed37a6b..e17bfdff7 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java @@ -90,7 +90,7 @@ public abstract class AbstractService { throw new ODataRuntimeException("Only OData V4 or higher supported."); } - this.client = ODataClientFactory.getEdmEnabledV4(serviceRoot, edm, metadataETag); + this.client = ODataClientFactory.getEdmEnabledClient(serviceRoot, edm, metadataETag); this.client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON_FULL_METADATA); this.transactional = transactional; this.context = new Context(); diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java index dd85277ec..47333e7ad 100644 --- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java +++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java @@ -49,6 +49,6 @@ public class V4POJOGenMojo extends AbstractPOJOGenMojo { @Override protected ODataClient getClient() { - return ODataClientFactory.getV4(); + return ODataClientFactory.getClient(); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java index 4518cdc47..806bbc6c2 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java @@ -393,7 +393,7 @@ public class BasicITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java index b76c17c2b..2e80a2c95 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java @@ -217,7 +217,7 @@ public class BindingITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java index 3dfcbd373..9ef35eaed 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java @@ -353,7 +353,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java index 4265c406e..9038c4b71 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java @@ -151,6 +151,6 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - return ODataClientFactory.getEdmEnabledV4(TecSvcConst.BASE_URI); + return ODataClientFactory.getEdmEnabledClient(TecSvcConst.BASE_URI); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java index e996763bf..4bab35d3b 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java @@ -985,7 +985,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java index e931203bf..9d02810a2 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java @@ -149,7 +149,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java index 79abd095e..e8b679fbd 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java @@ -134,7 +134,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java index 15990072e..802060066 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java @@ -160,7 +160,7 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java index 2155c0803..253b4821d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java @@ -226,7 +226,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java index f319c503a..d014086f9 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java @@ -301,7 +301,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Override protected ODataClient getClient() { - ODataClient odata = ODataClientFactory.getV4(); + ODataClient odata = ODataClientFactory.getClient(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java index c95d7cb47..7b8381108 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java @@ -53,7 +53,7 @@ import static org.junit.Assert.assertThat; public abstract class AbstractTestITCase extends AbstractBaseTestITCase { - protected static final ODataClient client = ODataClientFactory.getV4(); + protected static final ODataClient client = ODataClientFactory.getClient(); protected static EdmEnabledODataClient edmClient; @@ -87,7 +87,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc"; testOAuth2ServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OAuth2.svc"; - edmClient = ODataClientFactory.getEdmEnabledV4(testStaticServiceRootURL); + edmClient = ODataClientFactory.getEdmEnabledClient(testStaticServiceRootURL); edmClient.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM); client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java index 2729086f2..53a4106b7 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java @@ -48,20 +48,20 @@ public class AuthBatchTestITCase extends AbstractTestITCase { @Test public void clean() throws EdmPrimitiveTypeException { - final ODataClient authclient = ODataClientFactory.getV4(); + final ODataClient authclient = ODataClientFactory.getClient(); batchRequest(authclient, testStaticServiceRootURL); } @Test public void authorized() throws EdmPrimitiveTypeException { - final ODataClient authclient = ODataClientFactory.getV4(); + final ODataClient authclient = ODataClientFactory.getClient(); authclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient")); batchRequest(authclient, testAuthServiceRootURL); } @Test(expected = HttpClientException.class) public void unauthorized() throws EdmPrimitiveTypeException { - final ODataClient unauthclient = ODataClientFactory.getV4(); + final ODataClient unauthclient = ODataClientFactory.getClient(); unauthclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth")); batchRequest(unauthclient, testAuthServiceRootURL); } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java index ed3b65e8e..9dfc97f78 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java @@ -88,7 +88,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase { @Test public void readAsJSON() throws IOException { - read(ODataClientFactory.getEdmEnabledV4(testDemoServiceRootURL), ODataFormat.JSON); + read(ODataClientFactory.getEdmEnabledClient(testDemoServiceRootURL), ODataFormat.JSON); } @Test diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java index 79aaba1b9..1eba762a9 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java @@ -62,7 +62,7 @@ public class OAuth2TestITCase extends AbstractTestITCase { protected EdmEnabledODataClient getEdmClient() { if (_edmClient == null) { - _edmClient = ODataClientFactory.getEdmEnabledV4(testOAuth2ServiceRootURL); + _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL); _edmClient.getConfiguration().setHttpClientFactory( new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java index 8fce369d7..b9f18a89c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java @@ -25,15 +25,15 @@ import org.apache.olingo.commons.api.format.ODataFormat; public final class ODataClientFactory { - public static ODataClient getV4() { + public static ODataClient getClient() { return new ODataClientImpl(); } - public static EdmEnabledODataClient getEdmEnabledV4(final String serviceRoot) { - return getEdmEnabledV4(serviceRoot, null, null); + public static EdmEnabledODataClient getEdmEnabledClient(final String serviceRoot) { + return getEdmEnabledClient(serviceRoot, null, null); } - public static EdmEnabledODataClient getEdmEnabledV4( + public static EdmEnabledODataClient getEdmEnabledClient( final String serviceRoot, final Edm edm, final String metadataETag) { final EdmEnabledODataClient instance = diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java index ea68a7aa6..04a4e4e63 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java @@ -43,8 +43,6 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { private final EntityContainer xmlEntityContainer; - private final List xmlSchemas; - private EdmAnnotationHelper helper; public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName, @@ -54,7 +52,6 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { ? null : new FullQualifiedName(xmlEntityContainer.getExtends())); this.xmlEntityContainer = xmlEntityContainer; - this.xmlSchemas = xmlSchemas; if (xmlEntityContainer instanceof EntityContainer) { this.helper = new EdmAnnotationHelperImpl(edm, (EntityContainer) xmlEntityContainer); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java index b1cbd1c73..e6f0f7d4b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java @@ -55,7 +55,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema { private final Edm edm; - private final List xmlSchemas; + private final List xmlSchemas; private final Schema schema; @@ -64,7 +64,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema { private List entityContainers; public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm, - final List xmlSchemas, final Schema schema) { + final List xmlSchemas, final Schema schema) { super(schema.getNamespace(), schema.getAlias()); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java index 89726d5ee..127dfadb7 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -22,6 +22,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.olingo.client.api.edm.xml.ComplexType; import org.apache.olingo.client.api.edm.xml.EntityType; import org.apache.olingo.client.api.edm.xml.NavigationProperty; import org.apache.olingo.client.api.edm.xml.Property; @@ -39,28 +40,25 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper { private final FullQualifiedName structuredTypeName; - private final StructuralType complexType; - - private final List xmlSchemas; + private final StructuralType structuralType; private Map properties; private Map navigationProperties; public EdmStructuredTypeHelperImpl(final Edm edm, final FullQualifiedName structuredTypeName, - final List xmlSchemas, final StructuralType structuralType) { + final List xmlSchemas, final StructuralType structuralType) { this.edm = edm; this.structuredTypeName = structuredTypeName; - this.complexType = structuralType; - this.xmlSchemas = xmlSchemas; + this.structuralType = structuralType; } @Override public Map getProperties() { if (properties == null) { properties = new LinkedHashMap(); - for (Property property : complexType.getProperties()) { + for (Property property : structuralType.getProperties()) { properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property)); } } @@ -71,11 +69,11 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper { public Map getNavigationProperties() { if (navigationProperties == null) { navigationProperties = new LinkedHashMap(); - for (NavigationProperty navigationProperty : complexType.getNavigationProperties()) { + for (NavigationProperty navigationProperty : structuralType.getNavigationProperties()) { if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.NavigationProperty) { navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl( - edm, structuredTypeName, - (org.apache.olingo.client.api.edm.xml.NavigationProperty) navigationProperty)); + edm, structuredTypeName, + (org.apache.olingo.client.api.edm.xml.NavigationProperty) navigationProperty)); } } } @@ -84,19 +82,23 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper { @Override public boolean isOpenType() { - return complexType instanceof org.apache.olingo.client.api.edm.xml.ComplexType - ? ((org.apache.olingo.client.api.edm.xml.ComplexType) complexType).isOpenType() - : complexType instanceof EntityType - ? ((EntityType) complexType).isOpenType() - : false; + boolean isOpen = false; + if(structuralType instanceof ComplexType){ + isOpen = ((ComplexType) structuralType).isOpenType(); + }else if(structuralType instanceof EntityType){ + isOpen = ((EntityType) structuralType).isOpenType(); + } + return isOpen; } @Override public boolean isAbstract() { - return complexType instanceof org.apache.olingo.client.api.edm.xml.ComplexType - ? ((org.apache.olingo.client.api.edm.xml.ComplexType) complexType).isAbstractType() - : complexType instanceof EntityType - ? ((EntityType) complexType).isAbstractType() - : false; + boolean isAbstract = false; + if(structuralType instanceof ComplexType){ + isAbstract = ((ComplexType) structuralType).isAbstractType(); + }else if(structuralType instanceof EntityType){ + isAbstract = ((EntityType) structuralType).isAbstractType(); + } + return isAbstract; } } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java index dc644940e..c0a346a5a 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java @@ -40,7 +40,7 @@ public abstract class AbstractTest { @BeforeClass public static void setClientInstances() { - v4Client = ODataClientFactory.getV4(); + v4Client = ODataClientFactory.getClient(); } protected String getSuffix(final ODataFormat format) { diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java index f18e36d8f..eaca8b54d 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java @@ -29,7 +29,7 @@ public class ODataClientTest { @Test public void before() { - ODataClient client = ODataClientFactory.getV4(); + ODataClient client = ODataClientFactory.getClient(); assertNotNull(client); assertEquals(ODataServiceVersion.V40, client.getServiceVersion()); }