mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-03-06 16:49:09 +00:00
[OLINGO-62] Cleanup
This commit is contained in:
parent
dbd0146311
commit
5d98f9097e
@ -217,7 +217,8 @@ public abstract class EdmImpl implements Edm {
|
||||
|
||||
protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
|
||||
|
||||
protected abstract EdmAction createBoundAction(FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
|
||||
protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
|
||||
FullQualifiedName bindingParameterTypeName,
|
||||
Boolean isBindingParameterCollection);
|
||||
|
||||
protected abstract EdmFunction createBoundFunction(FullQualifiedName functionName,
|
||||
|
@ -48,5 +48,4 @@ public class EdmComplexTypeImpl extends EdmStructuralTypeImpl implements EdmComp
|
||||
return baseType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class EdmEntitySetInfoImpl implements EdmEntitySetInfo {
|
||||
private final EntityContainer entityContainer;
|
||||
private final EntitySet set;
|
||||
|
||||
public EdmEntitySetInfoImpl(EntityContainer entityContainer, EntitySet set) {
|
||||
public EdmEntitySetInfoImpl(final EntityContainer entityContainer, final EntitySet set) {
|
||||
this.entityContainer = entityContainer;
|
||||
this.set = set;
|
||||
}
|
||||
|
@ -115,5 +115,4 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
||||
return baseType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class EdmEnumImpl extends EdmNamedImpl implements EdmEnumType {
|
||||
|
||||
@Override
|
||||
public boolean isCompatible(final EdmPrimitiveType primitiveType) {
|
||||
return this.equals(primitiveType);
|
||||
return equals(primitiveType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,8 +80,9 @@ public class EdmEnumImpl extends EdmNamedImpl implements EdmEnumType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T valueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale,
|
||||
Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException {
|
||||
public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
|
||||
final Integer precision, final Integer scale,
|
||||
final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
|
||||
if (value == null) {
|
||||
if (isNullable != null && !isNullable) {
|
||||
throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_NULL_NOT_ALLOWED");
|
||||
@ -92,8 +93,9 @@ public class EdmEnumImpl extends EdmNamedImpl implements EdmEnumType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(Object value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale,
|
||||
Boolean isUnicode) throws EdmPrimitiveTypeException {
|
||||
public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
|
||||
final Integer precision, final Integer scale,
|
||||
final Boolean isUnicode) throws EdmPrimitiveTypeException {
|
||||
if (value == null) {
|
||||
if (isNullable != null && !isNullable) {
|
||||
throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.VALUE_NULL_NOT_ALLOWED");
|
||||
|
@ -30,7 +30,7 @@ public class EdmFunctionImportInfoImpl implements EdmFunctionImportInfo {
|
||||
private EntityContainer entityContainer;
|
||||
private FunctionImport functionImport;
|
||||
|
||||
public EdmFunctionImportInfoImpl(EntityContainer entityContainer, FunctionImport functionImport) {
|
||||
public EdmFunctionImportInfoImpl(final EntityContainer entityContainer, final FunctionImport functionImport) {
|
||||
this.entityContainer = entityContainer;
|
||||
this.functionImport = functionImport;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class EdmProviderImpl extends EdmImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmAction createUnboundAction(FullQualifiedName actionName) {
|
||||
protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
|
||||
try {
|
||||
List<Action> actions = actionsMap.get(actionName);
|
||||
if (actions == null) {
|
||||
@ -247,7 +247,7 @@ public class EdmProviderImpl extends EdmImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames) {
|
||||
protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
|
||||
try {
|
||||
List<Function> functions = functionsMap.get(functionName);
|
||||
if (functions == null) {
|
||||
|
@ -30,7 +30,7 @@ public class EdmSingletonInfoImpl implements EdmSingletonInfo {
|
||||
private final EntityContainer entityContainer;
|
||||
private final Singleton singleton;
|
||||
|
||||
public EdmSingletonInfoImpl(EntityContainer entityContainer, Singleton singleton) {
|
||||
public EdmSingletonInfoImpl(final EntityContainer entityContainer, final Singleton singleton) {
|
||||
this.entityContainer = entityContainer;
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public abstract class EdmStructuralTypeImpl extends EdmTypeImpl implements EdmSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean compatibleTo(EdmType targetType) {
|
||||
public boolean compatibleTo(final EdmType targetType) {
|
||||
EdmStructuralType sourceType = this;
|
||||
if (targetType == null) {
|
||||
throw new EdmException("Target type must not be null");
|
||||
|
@ -40,7 +40,7 @@ public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefini
|
||||
this.typeDefinition = typeDefinition;
|
||||
// TODO: Should we check for edmNamespace in the underlying type name?
|
||||
try {
|
||||
this.edmPrimitiveTypeInstance =
|
||||
edmPrimitiveTypeInstance =
|
||||
EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new EdmException("Invalid underlying type: " + typeDefinitionName, e);
|
||||
|
@ -43,7 +43,8 @@ public class ActionMapKeyTest {
|
||||
|
||||
}
|
||||
|
||||
private void createAndCheckForEdmException(FullQualifiedName fqn, FullQualifiedName typeName, Boolean collection) {
|
||||
private void createAndCheckForEdmException(final FullQualifiedName fqn, final FullQualifiedName typeName,
|
||||
final Boolean collection) {
|
||||
try {
|
||||
new ActionMapKey(fqn, typeName, collection);
|
||||
} catch (EdmException e) {
|
||||
|
@ -351,7 +351,7 @@ public class EdmImplCachingTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmAction createUnboundAction(FullQualifiedName fqn) {
|
||||
protected EdmAction createUnboundAction(final FullQualifiedName fqn) {
|
||||
if (NAME1.equals(fqn)) {
|
||||
EdmAction action = mock(EdmAction.class);
|
||||
when(action.getNamespace()).thenReturn(fqn.getNamespace());
|
||||
@ -367,7 +367,7 @@ public class EdmImplCachingTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmFunction createUnboundFunction(FullQualifiedName fqn, List<String> parameterNames) {
|
||||
protected EdmFunction createUnboundFunction(final FullQualifiedName fqn, final List<String> parameterNames) {
|
||||
if (NAME1.equals(fqn)) {
|
||||
EdmFunction function = mock(EdmFunction.class);
|
||||
when(function.getNamespace()).thenReturn(fqn.getNamespace());
|
||||
|
@ -217,7 +217,8 @@ public class EdmImplCallCreateTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmFunction createBoundFunction(final FullQualifiedName fqn, final FullQualifiedName bindingParameterTypeName,
|
||||
public EdmFunction createBoundFunction(final FullQualifiedName fqn,
|
||||
final FullQualifiedName bindingParameterTypeName,
|
||||
final Boolean isBindingParameterCollection, final List<String> bindingParameterNames) {
|
||||
if (FQN.getNamespace().equals(fqn.getNamespace()) && FQN.getName().equals(fqn.getName())) {
|
||||
EdmFunction function = mock(EdmFunction.class);
|
||||
@ -239,7 +240,7 @@ public class EdmImplCallCreateTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmAction createUnboundAction(FullQualifiedName fqn) {
|
||||
protected EdmAction createUnboundAction(final FullQualifiedName fqn) {
|
||||
if (FQN.getNamespace().equals(fqn.getNamespace()) && FQN.getName().equals(fqn.getName())) {
|
||||
EdmAction action = mock(EdmAction.class);
|
||||
when(action.getNamespace()).thenReturn(fqn.getNamespace());
|
||||
@ -250,7 +251,7 @@ public class EdmImplCallCreateTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmFunction createUnboundFunction(FullQualifiedName fqn, List<String> parameterNames) {
|
||||
protected EdmFunction createUnboundFunction(final FullQualifiedName fqn, final List<String> parameterNames) {
|
||||
if (FQN.getNamespace().equals(fqn.getNamespace()) && FQN.getName().equals(fqn.getName())) {
|
||||
EdmFunction function = mock(EdmFunction.class);
|
||||
when(function.getNamespace()).thenReturn(fqn.getNamespace());
|
||||
|
@ -24,7 +24,8 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -167,7 +167,8 @@ public class EdmEntityContainerImplTest {
|
||||
|
||||
private class CustomProvider extends EdmProvider {
|
||||
@Override
|
||||
public EntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
|
||||
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
|
||||
throws ODataException {
|
||||
if (entitySetName != null) {
|
||||
return new EntitySet().setName("entitySetName");
|
||||
}
|
||||
@ -175,7 +176,8 @@ public class EdmEntityContainerImplTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Singleton getSingleton(FullQualifiedName entityContainer, String singletonName) throws ODataException {
|
||||
public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
|
||||
throws ODataException {
|
||||
if (singletonName != null) {
|
||||
return new Singleton().setName("singletonName");
|
||||
}
|
||||
@ -183,7 +185,7 @@ public class EdmEntityContainerImplTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionImport getActionImport(FullQualifiedName entityContainer, String actionImportName)
|
||||
public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
|
||||
throws ODataException {
|
||||
if (actionImportName != null) {
|
||||
return new ActionImport().setName("singletonName");
|
||||
@ -192,7 +194,7 @@ public class EdmEntityContainerImplTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionImport getFunctionImport(FullQualifiedName entityContainer, String functionImportName)
|
||||
public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
|
||||
throws ODataException {
|
||||
if (functionImportName != null) {
|
||||
return new FunctionImport().setName("singletonName");
|
||||
|
@ -117,7 +117,7 @@ public class EdmProviderImplTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void callMethodAndExpectEdmException(Edm localEdm, String methodName) throws Exception {
|
||||
private void callMethodAndExpectEdmException(final Edm localEdm, final String methodName) throws Exception {
|
||||
Method method = localEdm.getClass().getMethod(methodName, FullQualifiedName.class);
|
||||
try {
|
||||
method.invoke(localEdm, new FullQualifiedName("namespace", "name"));
|
||||
|
@ -22,7 +22,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
|
||||
|
@ -126,7 +126,7 @@ public class EdmServiceMetadataImplTest {
|
||||
callGetFunctionImportInfosAndExpectException(serviceMetadata);
|
||||
}
|
||||
|
||||
private void callGetFunctionImportInfosAndExpectException(EdmServiceMetadata svc) {
|
||||
private void callGetFunctionImportInfosAndExpectException(final EdmServiceMetadata svc) {
|
||||
try {
|
||||
svc.getFunctionImportInfos();
|
||||
} catch (EdmException e) {
|
||||
@ -137,7 +137,7 @@ public class EdmServiceMetadataImplTest {
|
||||
|
||||
}
|
||||
|
||||
private void callGetSingletonInfosAndExpectException(EdmServiceMetadata svc) {
|
||||
private void callGetSingletonInfosAndExpectException(final EdmServiceMetadata svc) {
|
||||
try {
|
||||
svc.getSingletonInfos();
|
||||
} catch (EdmException e) {
|
||||
@ -147,7 +147,7 @@ public class EdmServiceMetadataImplTest {
|
||||
fail("Expected EdmException was not thrown");
|
||||
}
|
||||
|
||||
private void callGetEntitySetInfosAndExpectException(EdmServiceMetadata svc) {
|
||||
private void callGetEntitySetInfosAndExpectException(final EdmServiceMetadata svc) {
|
||||
try {
|
||||
svc.getEntitySetInfos();
|
||||
} catch (EdmException e) {
|
||||
@ -160,7 +160,7 @@ public class EdmServiceMetadataImplTest {
|
||||
private class CustomProvider extends EdmProvider {
|
||||
private List<Schema> schemas;
|
||||
|
||||
public CustomProvider(boolean fillSchema) {
|
||||
public CustomProvider(final boolean fillSchema) {
|
||||
schemas = new ArrayList<Schema>();
|
||||
if (fillSchema) {
|
||||
List<EntitySet> entitySets = new ArrayList<EntitySet>();
|
||||
|
@ -1,6 +1,17 @@
|
||||
package org.apache.olingo.odata4.commons.core.edm.provider;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmException;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
|
||||
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.TypeDefinition;
|
||||
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
|
||||
import org.junit.Test;
|
||||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -19,17 +30,6 @@ import static org.junit.Assert.assertEquals;
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmException;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
|
||||
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.TypeDefinition;
|
||||
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EdmTypeDefinitionImplTest {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user