diff --git a/.travis.yml b/.travis.yml index 0deb630a..a69d9b15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,16 @@ language: java jdk: - - oraclejdk8 - oraclejdk7 + - oraclejdk8 +script: + - cd spring-data-mock + - mvn test -B after_success: + - cd spring-data-mock-parent - mvn -P coverage clean cobertura:cobertura coveralls:report - '[[ $TRAVIS_BRANCH == "master" && ( "x${TRAVIS_PULL_REQUEST}" == "xfalse" || "x${TRAVIS_PULL_REQUEST}" == "x" ) && ( "x$(echo $JAVA_HOME | grep -o 8)" == "x8" ) ]] && sudo apt-get install gnupg2' - - '[[ $TRAVIS_BRANCH == "master" && ( "x${TRAVIS_PULL_REQUEST}" == "xfalse" || "x${TRAVIS_PULL_REQUEST}" == "x" ) && ( "x$(echo $JAVA_HOME | grep -o 8)" == "x8" ) ]] && bash deploy.sh eb1a6f34f056 key.asc.enc settings.xml' + - '[[ $TRAVIS_BRANCH == "master" && ( "x${TRAVIS_PULL_REQUEST}" == "xfalse" || "x${TRAVIS_PULL_REQUEST}" == "x" ) && ( "x$(echo $JAVA_HOME | grep -o 8)" == "x8" ) ]] && bash ../deployment/deploy.sh eb1a6f34f056 ../deployment/key.asc.enc ../deployment/settings.xml' +# SUDO should be set to `false` except when deploying to OSSRH to trigger container infrastructure sudo: true env: global: diff --git a/deploy.sh b/deployment/deploy.sh similarity index 100% rename from deploy.sh rename to deployment/deploy.sh diff --git a/key.asc.enc b/deployment/key.asc.enc similarity index 100% rename from key.asc.enc rename to deployment/key.asc.enc diff --git a/settings.xml b/deployment/settings.xml similarity index 100% rename from settings.xml rename to deployment/settings.xml diff --git a/spring-data-mock-build/pom.xml b/spring-data-mock-build/pom.xml new file mode 100644 index 00000000..0e4a0b34 --- /dev/null +++ b/spring-data-mock-build/pom.xml @@ -0,0 +1,84 @@ + + + + + 4.0.0 + + com.mmnaseri.utils + spring-data-mock-build + 1.0.2 + Spring Data Mock: Build Aggregator + This is the build module that will aggregate all reactors for the spring-data-mock project + https://mmnaseri.github.io/spring-data-mock + pom + + + + MIT + http://mit-license.org + + + + + + Milad Naseri + mmnaseri@programmer.net + http://www.mmnaseri.com + + designer + developer + + + + + + scm:git:git@github.com:mmnaseri/spring-data-mock.git + scm:git:git@github.com:mmnaseri/spring-data-mock.git + git@github.com:mmnaseri/spring-data-mock.git + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${target-jdk.version} + ${target-jdk.version} + + + + + + + ../spring-data-mock/ + + + + UTF-8 + 3.5.1 + 1.7 + + + diff --git a/pom.xml b/spring-data-mock/pom.xml similarity index 99% rename from pom.xml rename to spring-data-mock/pom.xml index e5d21f33..b96dd0a5 100644 --- a/pom.xml +++ b/spring-data-mock/pom.xml @@ -26,7 +26,7 @@ com.mmnaseri.utils spring-data-mock - 1.0.2 + 1.0.3 Spring Data Mock A framework for mocking Spring Data repositories https://mmnaseri.github.io/spring-data-mock diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/DataStoreAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/DataStoreAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/DataStoreAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/DataStoreAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/IdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/IdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/IdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/IdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/Invocation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Invocation.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/Invocation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Invocation.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/InvocationMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/InvocationMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/InvocationMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/InvocationMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGeneratorAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGeneratorAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGeneratorAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/KeyGeneratorAware.java diff --git a/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/MatchedOperator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/MatchedOperator.java new file mode 100644 index 00000000..115d3c48 --- /dev/null +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/MatchedOperator.java @@ -0,0 +1,16 @@ +package com.mmnaseri.utils.spring.data.domain; + +/** + * Represents an operator that was picked because of a parse operation + * + * @author Mohammad Milad Naseri (m.m.naseri@gmail.com) + * @since 1.0 (4/17/16, 12:36 PM) + */ +public interface MatchedOperator extends Operator { + + /** + * @return the suffix that was matched when looking up this operator + */ + String getMatchedToken(); + +} diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/Matcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Matcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/Matcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Matcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/Modifier.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Modifier.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/Modifier.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Modifier.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/Operator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Operator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/Operator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Operator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/OperatorContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/OperatorContext.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/OperatorContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/OperatorContext.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/Parameter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Parameter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/Parameter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/Parameter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadata.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadata.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadata.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadata.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/RepositoryMetadataResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolver.java diff --git a/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java new file mode 100644 index 00000000..56918ca0 --- /dev/null +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java @@ -0,0 +1,87 @@ +package com.mmnaseri.utils.spring.data.domain.impl; + +import com.mmnaseri.utils.spring.data.domain.Operator; +import com.mmnaseri.utils.spring.data.domain.OperatorContext; +import com.mmnaseri.utils.spring.data.domain.impl.matchers.*; +import com.mmnaseri.utils.spring.data.error.DuplicateOperatorException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Arrays; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; + +/** + * This class is used to store the operators used in the name of a query method. Operators are matched by + * the "suffixes" eagerly (meaning that "EqualTo" will precede over "To"). + * + * @author Milad Naseri (mmnaseri@programmer.net) + * @since 1.0 (9/29/15) + */ +public class DefaultOperatorContext implements OperatorContext { + + private static final Log log = LogFactory.getLog(DefaultOperatorContext.class); + private final Set operators; + + public DefaultOperatorContext() { + this(true); + } + + public DefaultOperatorContext(boolean registerDefaults) { + operators = new CopyOnWriteArraySet<>(); + if (registerDefaults) { + log.info("Registering all the default operators"); + operators.add(new ImmutableOperator("AFTER", 1, new IsGreaterThanMatcher(), "After", "IsAfter")); + operators.add(new ImmutableOperator("BEFORE", 1, new IsLessThanMatcher(), "Before", "IsBefore")); + operators.add(new ImmutableOperator("CONTAINING", 1, new ContainingMatcher(), "Containing", "IsContaining", "Contains")); + operators.add(new ImmutableOperator("BETWEEN", 2, new IsBetweenMatcher(), "Between", "IsBetween")); + operators.add(new ImmutableOperator("NOT_BETWEEN", 2, new IsNotBetweenMatcher(), "NotBetween", "IsNotBetween")); + operators.add(new ImmutableOperator("ENDING_WITH", 1, new EndingWithMatcher(), "EndingWith", "IsEndingWith", "EndsWith")); + operators.add(new ImmutableOperator("FALSE", 0, new IsFalseMatcher(), "False", "IsFalse")); + operators.add(new ImmutableOperator("GREATER_THAN", 1, new IsGreaterThanMatcher(), "GreaterThan", "IsGreaterThan")); + operators.add(new ImmutableOperator("GREATER_THAN_EQUALS", 1, new IsGreaterThanOrEqualToMatcher(), "GreaterThanEqual", "IsGreaterThanEqual")); + operators.add(new ImmutableOperator("IN", 1, new IsInMatcher(), "In", "IsIn")); + operators.add(new ImmutableOperator("IS", 1, new IsEqualToMatcher(), "Is", "EqualTo", "IsEqualTo", "Equals")); + operators.add(new ImmutableOperator("NOT_NULL", 0, new IsNotNullMatcher(), "NotNull", "IsNotNull")); + operators.add(new ImmutableOperator("NULL", 0, new IsNullMatcher(), "Null", "IsNull")); + operators.add(new ImmutableOperator("LESS_THAN", 1, new IsLessThanMatcher(), "LessThan", "IsLessThan")); + operators.add(new ImmutableOperator("LESS_THAN_EQUAL", 1, new IsLessThanOrEqualToMatcher(), "LessThanEqual", "IsLessThanEqual")); + operators.add(new ImmutableOperator("LIKE", 1, new IsLikeMatcher(), "Like", "IsLike")); + operators.add(new ImmutableOperator("NEAR", 1, null, "Near", "IsNear")); + operators.add(new ImmutableOperator("NOT", 1, new IsNotMatcher(), "IsNot", "Not", "IsNotEqualTo", "DoesNotEqual")); + operators.add(new ImmutableOperator("NOT_IN", 1, new IsNotInMatcher(), "NotIn", "IsNotIn")); + operators.add(new ImmutableOperator("NOT_LIKE", 1, new IsNotLikeMatcher(), "NotLike", "IsNotLike")); + operators.add(new ImmutableOperator("REGEX", 1, new RegexMatcher(), "Regex", "MatchesRegex", "Matches")); + operators.add(new ImmutableOperator("STARTING_WITH", 1, new StartingWithMatcher(), "StartingWith", "IsStartingWith", "StartsWith")); + operators.add(new ImmutableOperator("TRUE", 0, new IsTrueMatcher(), "True", "IsTrue")); + } + } + + @Override + public void register(Operator operator) { + log.info("Registering operator " + operator.getName() + " which will respond to suffixes " + Arrays.toString(operator.getTokens())); + for (Operator item : operators) { + for (String token : item.getTokens()) { + for (String newToken : operator.getTokens()) { + if (newToken.equals(token)) { + throw new DuplicateOperatorException(item, token); + } + } + } + } + operators.add(operator); + } + + @Override + public Operator getBySuffix(String suffix) { + for (Operator operator : operators) { + for (String token : operator.getTokens()) { + if (token.equals(suffix)) { + return operator; + } + } + } + return null; + } + +} diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java similarity index 74% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java index d6117ba2..213f6132 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolver.java @@ -1,6 +1,8 @@ package com.mmnaseri.utils.spring.data.domain.impl; import com.mmnaseri.utils.spring.data.domain.RepositoryMetadata; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.data.repository.RepositoryDefinition; /** @@ -18,14 +20,17 @@ */ public class DefaultRepositoryMetadataResolver extends AbstractRepositoryMetadataResolver { + private static final Log log = LogFactory.getLog(DefaultRepositoryMetadataResolver.class); private final AssignableRepositoryMetadataResolver assignableRepositoryMetadataResolver = new AssignableRepositoryMetadataResolver(); private final AnnotationRepositoryMetadataResolver annotationRepositoryMetadataResolver = new AnnotationRepositoryMetadataResolver(); @Override protected RepositoryMetadata resolveFromInterface(Class repositoryInterface) { if (repositoryInterface.isAnnotationPresent(RepositoryDefinition.class)) { + log.info("Since the repository interface was annotated with @RepositoryDefinition we will try to resolve the metadata using the provided annotation"); return annotationRepositoryMetadataResolver.resolve(repositoryInterface); } + log.info("Since no annotation was found on the repository, we will try to read the metadata from the generic type parameters derived from the Repository interface"); return assignableRepositoryMetadataResolver.resolve(repositoryInterface); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java similarity index 82% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java index f91c3a11..70232ff6 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperation.java @@ -7,6 +7,8 @@ import com.mmnaseri.utils.spring.data.query.QueryDescriptor; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.List; @@ -19,7 +21,8 @@ * @since 1.0 (9/29/15) */ public class DescribedDataStoreOperation implements DataStoreOperation { - + + private static final Log log = LogFactory.getLog(DescribedDataStoreOperation.class); private final SelectDataStoreOperation selectOperation; private final DataFunctionRegistry functionRegistry; @@ -30,11 +33,14 @@ public DescribedDataStoreOperation(SelectDataStoreOperation selectOperatio @Override public Object execute(DataStore store, RepositoryConfiguration configuration, Invocation invocation) { + log.info("Trying to select the data from the data store"); final List selection = selectOperation.execute(store, configuration, invocation); final QueryDescriptor descriptor = selectOperation.getDescriptor(); if (descriptor.getFunction() == null) { + log.info("No function was specified for the current selection"); return selection; } + log.info("Executing function " + descriptor.getFunction() + " on the selected items"); final DataFunction function = functionRegistry.getFunction(descriptor.getFunction()); return function.apply(store, descriptor, configuration, selection); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java similarity index 83% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java index c240784d..53293735 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableInvocation.java @@ -3,6 +3,7 @@ import com.mmnaseri.utils.spring.data.domain.Invocation; import java.lang.reflect.Method; +import java.util.Arrays; /** * This is an immutable invocation. @@ -29,4 +30,10 @@ public Method getMethod() { public Object[] getArguments() { return arguments; } + + @Override + public String toString() { + return method + ", " + Arrays.toString(arguments); + } + } diff --git a/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperator.java new file mode 100644 index 00000000..8a55e6d2 --- /dev/null +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperator.java @@ -0,0 +1,47 @@ +package com.mmnaseri.utils.spring.data.domain.impl; + +import com.mmnaseri.utils.spring.data.domain.MatchedOperator; +import com.mmnaseri.utils.spring.data.domain.Matcher; +import com.mmnaseri.utils.spring.data.domain.Operator; + +/** + * @author Mohammad Milad Naseri (m.m.naseri@gmail.com) + * @since 1.0 (4/17/16, 12:37 PM) + */ +@SuppressWarnings("WeakerAccess") +public class ImmutableMatchedOperator implements MatchedOperator { + + private final Operator original; + private final String matchedToken; + + public ImmutableMatchedOperator(Operator original, String matchedToken) { + this.original = original; + this.matchedToken = matchedToken; + } + + @Override + public String getName() { + return original.getName(); + } + + @Override + public int getOperands() { + return original.getOperands(); + } + + @Override + public Matcher getMatcher() { + return original.getMatcher(); + } + + @Override + public String[] getTokens() { + return original.getTokens(); + } + + @Override + public String getMatchedToken() { + return matchedToken; + } + +} diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableOperator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableOperator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableOperator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableOperator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableRepositoryMetadata.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableRepositoryMetadata.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableRepositoryMetadata.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableRepositoryMetadata.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java similarity index 87% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java index 390478d4..fd9b90bd 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperation.java @@ -5,6 +5,8 @@ import com.mmnaseri.utils.spring.data.proxy.RepositoryConfiguration; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; @@ -19,6 +21,7 @@ */ public class MethodInvocationDataStoreOperation implements DataStoreOperation { + private static final Log log = LogFactory.getLog(MethodInvocationDataStoreOperation.class); private final Object instance; private final Method method; @@ -31,6 +34,7 @@ public MethodInvocationDataStoreOperation(Object instance, Method method) { public Object execute(DataStore store, RepositoryConfiguration configuration, Invocation invocation) { final Object result; try { + log.info("Invoking method " + method + " to handle invocation " + invocation); result = method.invoke(instance, invocation.getArguments()); } catch (IllegalAccessException e) { throw new DataOperationExecutionException("Failed to access target method: " + method, e); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java similarity index 57% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java index cf77716a..b163ad54 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractor.java @@ -117,7 +117,7 @@ public QueryDescriptor extract(RepositoryMetadata repositoryMetadata, Method met //this is the extractor used for getting paging data final PageParameterExtractor pageExtractor; //this is the extractor used for getting sorting data - final SortParameterExtractor sortExtractor; + SortParameterExtractor sortExtractor = null; //these are decision branches, each of which denoting an AND clause final List> branches = new ArrayList<>(); //if the method name simply was the function name, no metadata can be extracted @@ -125,129 +125,194 @@ public QueryDescriptor extract(RepositoryMetadata repositoryMetadata, Method met pageExtractor = null; sortExtractor = null; } else { - reader.read("By"); + reader.expect("By"); if (!reader.hasMore()) { throw new QueryParserException(method.getDeclaringClass(), "Query method name cannot end with `By`"); } //current parameter index - int index = 0; - branches.add(new LinkedList()); - while (reader.hasMore()) { - //read a full expression - final Parameter parameter; - String expression = reader.expect("(.*?)(And[A-Z]|Or[A-Z]|$)"); - if (expression.matches(".*?(And|Or)[A-Z]")) { - //if the expression ended in And/Or, we need to put the one extra character we scanned back - //we scan one extra character because we don't want anything like "Order" to be mistaken for "Or" - reader.backtrack(1); - expression = expression.substring(0, expression.length() - 1); - } - //if the expression ended in Or, this is the end of this branch - boolean branchEnd = expression.endsWith("Or"); - //if the expression contains an OrderBy, it is not only the end of the branch, but also the end of the query - boolean expressionEnd = expression.matches(".+[a-z]OrderBy[A-Z].+"); - if (expressionEnd) { - //if that is the case, we need to put back the entirety of the order by clause - int length = expression.length(); - expression = expression.replaceFirst("^(.+[a-z])OrderBy[A-Z].+$", "$1"); - length -= expression.length(); - reader.backtrack(length); - } - final Set modifiers = new HashSet<>(); - if (expression.matches(".*" + IGNORE_CASE_SUFFIX)) { - //if the expression ended in IgnoreCase, we need to strip that off - modifiers.add(Modifier.IGNORE_CASE); - expression = expression.replaceFirst(IGNORE_CASE_SUFFIX, ""); - } else if (allIgnoreCase) { - //if we had already set "AllIgnoreCase", we will still add the modifier - modifiers.add(Modifier.IGNORE_CASE); - } - //if the expression ends in And/Or, we expect there to be more - if (expression.matches(".*?(And|Or)$") && !reader.hasMore()) { - throw new QueryParserException(method.getDeclaringClass(), "Expected more tokens to follow AND/OR operator"); - } - expression = expression.replaceFirst("(And|Or)$", ""); - String property = null; - Operator operator = null; - //let's find out the operator that covers the longest suffix of the operation - for (int i = 1; i < expression.length(); i++) { - operator = operatorContext.getBySuffix(expression.substring(i)); - if (operator != null) { - property = expression.substring(0, i); - break; - } - } - //if no operator was found, it is the implied "IS" operator - if (operator == null || property.isEmpty()) { - property = expression; - operator = operatorContext.getBySuffix(DEFAULT_OPERATOR_SUFFIX); - } - //let's get the property descriptor - final PropertyDescriptor propertyDescriptor; - try { - propertyDescriptor = PropertyUtils.getPropertyDescriptor(repositoryMetadata.getEntityType(), property); - } catch (Exception e) { - throw new QueryParserException(method.getDeclaringClass(), "Could not find property `" + StringUtils.uncapitalize(property) + "` on `" + repositoryMetadata.getEntityType() + "`", e); - } - property = propertyDescriptor.getPath(); - //we need to match the method parameters with the operands for the designated operator - final int[] indices = new int[operator.getOperands()]; - for (int i = 0; i < operator.getOperands(); i++) { - if (index >= method.getParameterTypes().length) { - throw new QueryParserException(method.getDeclaringClass(), "Expected to see parameter with index " + index); - } - if (!propertyDescriptor.getType().isAssignableFrom(method.getParameterTypes()[index])) { - throw new QueryParserException(method.getDeclaringClass(), "Expected parameter " + index + " on method " + methodName + " to be a descendant of " + propertyDescriptor.getType()); - } - indices[i] = index ++; - } - //create a parameter definition for the given expression - parameter = new ImmutableParameter(property, modifiers, indices, operator); - //get the current branch - final List currentBranch = branches.get(branches.size() - 1); - //add this parameter to the latest branch - currentBranch.add(parameter); - //if the branch has ended with "OR", we set up a new branch - if (branchEnd) { - branches.add(new LinkedList()); - } - //if this is the end of expression, so we need to jump out - if (expressionEnd) { - break; - } + int index = parseExpression(repositoryMetadata, method, methodName, allIgnoreCase, reader, branches); + final com.mmnaseri.utils.spring.data.query.Sort sort = parseSort(repositoryMetadata, method, reader); + pageExtractor = getPageParameterExtractor(method, index, sort); + sortExtractor = getSortParameterExtractor(method, index, sort); + } + return new DefaultQueryDescriptor(queryModifiers.isDistinct(), function, queryModifiers.getLimit(), pageExtractor, sortExtractor, branches, configuration, repositoryMetadata); + } + + private SortParameterExtractor getSortParameterExtractor(Method method, int index, com.mmnaseri.utils.spring.data.query.Sort sort) { + SortParameterExtractor sortExtractor = null; + if (method.getParameterTypes().length == index) { + sortExtractor = sort == null ? null : new WrappedSortParameterExtractor(sort); + } else if (method.getParameterTypes().length == index + 1) { + if (Pageable.class.isAssignableFrom(method.getParameterTypes()[index])) { + sortExtractor = sort == null ? new PageableSortParameterExtractor(index) : new WrappedSortParameterExtractor(sort); + } else if (Sort.class.isAssignableFrom(method.getParameterTypes()[index])) { + sortExtractor = new DirectSortParameterExtractor(index); } - final com.mmnaseri.utils.spring.data.query.Sort sort; - //let's figure out if there is a sort requirement embedded in the query definition - if (reader.read("OrderBy") != null) { - final List orders = new ArrayList<>(); - while (reader.hasMore()) { - orders.add(parseOrder(method, reader, repositoryMetadata)); + } + return sortExtractor; + } + + private PageParameterExtractor getPageParameterExtractor(Method method, int index, com.mmnaseri.utils.spring.data.query.Sort sort) { + PageParameterExtractor pageExtractor; + if (method.getParameterTypes().length == index) { + pageExtractor = null; + } else if (method.getParameterTypes().length == index + 1) { + if (Pageable.class.isAssignableFrom(method.getParameterTypes()[index])) { + pageExtractor = new PageablePageParameterExtractor(index); + } else if (Sort.class.isAssignableFrom(method.getParameterTypes()[index])) { + if (sort != null) { + throw new QueryParserException(method.getDeclaringClass(), "You cannot specify both an order-by clause and a dynamic ordering"); } - sort = new ImmutableSort(orders); - } else { - sort = null; - } - if (method.getParameterTypes().length == index) { pageExtractor = null; - sortExtractor = sort == null ? null : new WrappedSortParameterExtractor(sort); - } else if (method.getParameterTypes().length == index + 1) { - if (Pageable.class.isAssignableFrom(method.getParameterTypes()[index])) { - pageExtractor = new PageablePageParameterExtractor(index); - sortExtractor = sort == null ? new PageableSortParameterExtractor(index) : new WrappedSortParameterExtractor(sort); - } else if (Sort.class.isAssignableFrom(method.getParameterTypes()[index])) { - if (sort != null) { - throw new QueryParserException(method.getDeclaringClass(), "You cannot specify both an order-by clause and a dynamic ordering"); - } - pageExtractor = null; - sortExtractor = new DirectSortParameterExtractor(index); - } else { - throw new QueryParserException(method.getDeclaringClass(), "Invalid last argument: expected paging or sorting " + method); - } } else { - throw new QueryParserException(method.getDeclaringClass(), "Too many parameters declared for query method " + method); + throw new QueryParserException(method.getDeclaringClass(), "Invalid last argument: expected paging or sorting " + method); } + } else { + throw new QueryParserException(method.getDeclaringClass(), "Too many parameters declared for query method " + method); } - return new DefaultQueryDescriptor(queryModifiers.isDistinct(), function, queryModifiers.getLimit(), pageExtractor, sortExtractor, branches, configuration, repositoryMetadata); + return pageExtractor; + } + + private int parseExpression(RepositoryMetadata repositoryMetadata, Method method, String methodName, boolean allIgnoreCase, DocumentReader reader, List> branches) { + int index = 0; + branches.add(new LinkedList()); + while (reader.hasMore()) { + final Parameter parameter; + //read a full expression + String expression = parseInitialExpression(reader); + //if the expression ended in Or, this is the end of this branch + boolean branchEnd = expression.endsWith("Or"); + //if the expression contains an OrderBy, it is not only the end of the branch, but also the end of the query + boolean expressionEnd = expression.matches(".+[a-z]OrderBy[A-Z].+"); + expression = handleExpressionEnd(reader, expression, expressionEnd); + final Set modifiers = new HashSet<>(); + expression = parseModifiers(allIgnoreCase, expression, modifiers); + //if the expression ends in And/Or, we expect there to be more + if (expression.matches(".*?(And|Or)$") && !reader.hasMore()) { + throw new QueryParserException(method.getDeclaringClass(), "Expected more tokens to follow AND/OR operator"); + } + expression = expression.replaceFirst("(And|Or)$", ""); + String foundProperty = null; + Operator operator = parseOperator(expression); + if (operator != null) { + foundProperty = expression.substring(0, expression.length() - ((MatchedOperator) operator).getMatchedToken().length()); + } + //if no operator was found, it is the implied "IS" operator + if (operator == null || foundProperty.isEmpty()) { + foundProperty = expression; + operator = operatorContext.getBySuffix(DEFAULT_OPERATOR_SUFFIX); + } + final PropertyDescriptor propertyDescriptor = getPropertyDescriptor(repositoryMetadata, method, foundProperty); + final String property = propertyDescriptor.getPath(); + //we need to match the method parameters with the operands for the designated operator + final int[] indices = new int[operator.getOperands()]; + index = parseParameterIndices(method, methodName, index, operator, propertyDescriptor, indices); + //create a parameter definition for the given expression + parameter = new ImmutableParameter(property, modifiers, indices, operator); + //get the current branch + final List currentBranch = branches.get(branches.size() - 1); + //add this parameter to the latest branch + currentBranch.add(parameter); + //if the branch has ended with "OR", we set up a new branch + if (branchEnd) { + branches.add(new LinkedList()); + } + //if this is the end of expression, so we need to jump out + if (expressionEnd) { + break; + } + } + return index; + } + + private com.mmnaseri.utils.spring.data.query.Sort parseSort(RepositoryMetadata repositoryMetadata, Method method, DocumentReader reader) { + final com.mmnaseri.utils.spring.data.query.Sort sort; + //let's figure out if there is a sort requirement embedded in the query definition + if (reader.read("OrderBy") != null) { + final List orders = new ArrayList<>(); + while (reader.hasMore()) { + orders.add(parseOrder(method, reader, repositoryMetadata)); + } + sort = new ImmutableSort(orders); + } else { + sort = null; + } + return sort; + } + + private int parseParameterIndices(Method method, String methodName, int index, Operator operator, PropertyDescriptor propertyDescriptor, int[] indices) { + int parameterIndex = index; + for (int i = 0; i < operator.getOperands(); i++) { + if (parameterIndex >= method.getParameterTypes().length) { + throw new QueryParserException(method.getDeclaringClass(), "Expected to see parameter with index " + parameterIndex); + } + if (!propertyDescriptor.getType().isAssignableFrom(method.getParameterTypes()[parameterIndex])) { + throw new QueryParserException(method.getDeclaringClass(), "Expected parameter " + parameterIndex + " on method " + methodName + " to be a descendant of " + propertyDescriptor.getType()); + } + indices[i] = parameterIndex ++; + } + return parameterIndex; + } + + private PropertyDescriptor getPropertyDescriptor(RepositoryMetadata repositoryMetadata, Method method, String property) { + //let's get the property descriptor + final PropertyDescriptor propertyDescriptor; + try { + propertyDescriptor = PropertyUtils.getPropertyDescriptor(repositoryMetadata.getEntityType(), property); + } catch (Exception e) { + throw new QueryParserException(method.getDeclaringClass(), "Could not find property `" + StringUtils.uncapitalize(property) + "` on `" + repositoryMetadata.getEntityType() + "`", e); + } + return propertyDescriptor; + } + + private Operator parseOperator(String expression) { + Operator operator = null; + //let's find out the operator that covers the longest suffix of the operation + for (int i = 1; i < expression.length(); i++) { + final String suffix = expression.substring(i); + operator = operatorContext.getBySuffix(suffix); + if (operator != null) { + operator = new ImmutableMatchedOperator(operator, suffix); + break; + } + } + return operator; + } + + private String parseModifiers(boolean allIgnoreCase, String originalExpression, Set modifiers) { + String expression = originalExpression; + if (expression.matches(".*" + IGNORE_CASE_SUFFIX)) { + //if the expression ended in IgnoreCase, we need to strip that off + modifiers.add(Modifier.IGNORE_CASE); + expression = expression.replaceFirst(IGNORE_CASE_SUFFIX, ""); + } else if (allIgnoreCase) { + //if we had already set "AllIgnoreCase", we will still add the modifier + modifiers.add(Modifier.IGNORE_CASE); + } + return expression; + } + + private String handleExpressionEnd(DocumentReader reader, String originalExpression, boolean expressionEnd) { + String expression = originalExpression; + if (expressionEnd) { + //if that is the case, we need to put back the entirety of the order by clause + int length = expression.length(); + expression = expression.replaceFirst("^(.+[a-z])OrderBy[A-Z].+$", "$1"); + length -= expression.length(); + reader.backtrack(length); + } + return expression; + } + + private String parseInitialExpression(DocumentReader reader) { + String expression = reader.expect("(.*?)(And[A-Z]|Or[A-Z]|$)"); + if (expression.matches(".*?(And|Or)[A-Z]")) { + //if the expression ended in And/Or, we need to put the one extra character we scanned back + //we scan one extra character because we don't want anything like "Order" to be mistaken for "Or" + reader.backtrack(1); + expression = expression.substring(0, expression.length() - 1); + } + return expression; } private Order parseOrder(Method method, DocumentReader reader, RepositoryMetadata repositoryMetadata) { diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java similarity index 85% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java index 7552c806..b5c1f023 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/QueryModifiers.java @@ -7,6 +7,7 @@ * @author Milad Naseri (mmnaseri@programmer.net) * @since 1.0 (4/13/16, 9:25 AM) */ +@SuppressWarnings("WeakerAccess") class QueryModifiers { private final int limit; @@ -17,11 +18,11 @@ class QueryModifiers { this.distinct = distinct; } - int getLimit() { + public int getLimit() { return limit; } - boolean isDistinct() { + public boolean isDistinct() { return distinct; } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java similarity index 81% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java index 316449bb..d2b26ab5 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperation.java @@ -7,6 +7,8 @@ import com.mmnaseri.utils.spring.data.query.Sort; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.*; @@ -21,6 +23,7 @@ */ public class SelectDataStoreOperation implements DataStoreOperation, K, E> { + private static final Log log = LogFactory.getLog(SelectDataStoreOperation.class); private final QueryDescriptor descriptor; public SelectDataStoreOperation(QueryDescriptor descriptor) { @@ -33,6 +36,7 @@ public QueryDescriptor getDescriptor() { @Override public List execute(DataStore store, RepositoryConfiguration configuration, Invocation invocation) { + log.info("Selecting the data according to the provided selection descriptor: " + descriptor); final List selection = new LinkedList<>(); final Collection all = new LinkedList<>(store.retrieveAll()); for (E entity : all) { @@ -40,17 +44,21 @@ public List execute(DataStore store, RepositoryConfiguration configurat selection.add(entity); } } + log.info("Matched " + selection.size() + " items from the data store"); if (descriptor.isDistinct()) { final Set distinctValues = new HashSet<>(selection); selection.clear(); selection.addAll(distinctValues); + log.info("After clearing up duplicates, " + selection.size() + " items remained"); } final Sort sort = descriptor.getSort(invocation); final Page page = descriptor.getPage(invocation); if (sort != null) { + log.info("Sorting the selected items according to the provided ordering"); PropertyComparator.sort(selection, sort); } if (page != null) { + log.info("We need to paginate the selection to fit the selection criteria"); int start = page.getPageSize() * page.getPageNumber(); int finish = Math.min(start + page.getPageSize(), selection.size()); if (start > selection.size()) { @@ -65,6 +73,7 @@ public List execute(DataStore store, RepositoryConfiguration configurat } } if (descriptor.getLimit() > 0) { + log.info("Going to limit the result to " + descriptor.getLimit() + " items"); final List view = new ArrayList<>(); for (E item : selection.subList(0, Math.min(selection.size(), descriptor.getLimit()))) { view.add(item); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedIdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedIdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java similarity index 76% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java index 34cb4c34..a65a885a 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolver.java @@ -2,6 +2,8 @@ import com.mmnaseri.utils.spring.data.domain.IdPropertyResolver; import com.mmnaseri.utils.spring.data.error.NoIdPropertyException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; @@ -26,6 +28,7 @@ */ public class EntityIdPropertyResolver implements IdPropertyResolver { + private static final Log log = LogFactory.getLog(EntityIdPropertyResolver.class); private final AnnotatedGetterIdPropertyResolver annotatedGetterIdPropertyResolver = new AnnotatedGetterIdPropertyResolver(); private final AnnotatedFieldIdPropertyResolver annotatedFieldIdPropertyResolver = new AnnotatedFieldIdPropertyResolver(); private final NamedGetterIdPropertyResolver namedGetterIdPropertyResolver = new NamedGetterIdPropertyResolver(); @@ -33,17 +36,22 @@ public class EntityIdPropertyResolver implements IdPropertyResolver { @Override public String resolve(Class entityType, Class idType) { + log.info("Trying to resolve the ID property for entity " + entityType + " using the annotated getter method"); String idProperty = annotatedGetterIdPropertyResolver.resolve(entityType, idType); if (idProperty == null) { + log.info("Trying to resolve the ID property for entity " + entityType + " using the annotated ID field"); idProperty = annotatedFieldIdPropertyResolver.resolve(entityType, idType); } if (idProperty == null) { + log.info("Trying to resolve the ID property for entity " + entityType + " using the getter method"); idProperty = namedGetterIdPropertyResolver.resolve(entityType, idType); } if (idProperty == null) { + log.info("Trying to resolve the ID property for entity " + entityType + " using the field"); idProperty = namedFieldIdPropertyResolver.resolve(entityType, idType); } if (idProperty == null) { + log.error("No ID property was found for entity " + entityType); throw new NoIdPropertyException(entityType); } return idProperty; diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomIntegerKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomIntegerKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomIntegerKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomIntegerKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomLongKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomLongKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomLongKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/RandomLongKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialIntegerKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialIntegerKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialIntegerKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialIntegerKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialLongKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialLongKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialLongKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/SequentialLongKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/UUIDKeyGenerator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/UUIDKeyGenerator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/UUIDKeyGenerator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/key/UUIDKeyGenerator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Auditing.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Auditing.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Auditing.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Auditing.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctions.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctions.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctions.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctions.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctionsAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctionsAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctionsAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataFunctionsAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStores.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStores.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStores.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStores.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStoresAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStoresAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStoresAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/DataStoresAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/End.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/End.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/End.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/End.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java similarity index 95% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java index f141d480..1e67f26c 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListener.java @@ -3,7 +3,6 @@ import com.mmnaseri.utils.spring.data.store.DataStoreEvent; import com.mmnaseri.utils.spring.data.store.DataStoreEventListener; import com.mmnaseri.utils.spring.data.store.DataStoreEventListenerContext; -import org.springframework.data.domain.AuditorAware; /** * Lets us define the various listener configurations used when data operations are taking place diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListenerAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListenerAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListenerAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/EventListenerAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContext.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContext.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContextAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContextAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContextAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MappingContextAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MetadataResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MetadataResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MetadataResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/MetadataResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlersAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlersAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlersAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlersAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Operators.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Operators.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Operators.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Operators.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperatorsAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperatorsAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperatorsAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperatorsAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescription.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescription.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescription.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescription.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescriptionConfigurer.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescriptionConfigurer.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescriptionConfigurer.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/QueryDescriptionConfigurer.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilder.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilder.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilder.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilder.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdapters.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdapters.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdapters.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdapters.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdaptersAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdaptersAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdaptersAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/ResultAdaptersAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Start.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Start.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Start.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/Start.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Configuration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Configuration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Configuration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Configuration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/End.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/End.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/End.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/End.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Factory.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Factory.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Factory.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Factory.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Implementation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Implementation.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Implementation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Implementation.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/ImplementationAnd.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/ImplementationAnd.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/ImplementationAnd.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/ImplementationAnd.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java similarity index 96% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java index d383e0d5..1f1ff20f 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/KeyGeneratorProvider.java @@ -19,6 +19,7 @@ * @author Milad Naseri (mmnaseri@programmer.net) * @since 1.0 (10/12/15) */ +@SuppressWarnings("WeakerAccess") class KeyGeneratorProvider { private final Map, List>> generators; @@ -74,7 +75,7 @@ private List>> getKeyGe * @param the type of keys the generator will provide * @return the generator or {@literal null} if none could be found to satisfy the key type */ - Class> getKeyGenerator(Class keyType) { + public Class> getKeyGenerator(Class keyType) { final List>> generators = getKeyGenerators(keyType); return generators.isEmpty() ? null : generators.get(0); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilder.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilder.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilder.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilder.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Start.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Start.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Start.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/mock/Start.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/CorruptDataException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/CorruptDataException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/CorruptDataException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/CorruptDataException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataFunctionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataFunctionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataFunctionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataFunctionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationDefinitionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationDefinitionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationDefinitionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationDefinitionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationExecutionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationExecutionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationExecutionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataOperationExecutionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreNotFoundException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreNotFoundException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreNotFoundException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DataStoreNotFoundException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateFunctionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateFunctionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateFunctionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateFunctionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateOperatorException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateOperatorException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateOperatorException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/DuplicateOperatorException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/EntityDefinitionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityDefinitionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/EntityDefinitionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityDefinitionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/EntityMissingKeyException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityMissingKeyException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/EntityMissingKeyException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityMissingKeyException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/EntityStateException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityStateException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/EntityStateException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/EntityStateException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionNotFoundException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionNotFoundException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/FunctionNotFoundException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionNotFoundException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionRegistryException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionRegistryException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/FunctionRegistryException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/FunctionRegistryException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/InvalidArgumentException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/InvalidArgumentException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/InvalidArgumentException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/InvalidArgumentException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/MockBuilderException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/MockBuilderException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/MockBuilderException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/MockBuilderException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/MultipleIdPropertiesException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/MultipleIdPropertiesException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/MultipleIdPropertiesException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/MultipleIdPropertiesException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/NoIdPropertyException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/NoIdPropertyException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/NoIdPropertyException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/NoIdPropertyException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/OperatorContextException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/OperatorContextException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/OperatorContextException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/OperatorContextException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/ParserException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ParserException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/ParserException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ParserException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/PropertyTypeMismatchException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/PropertyTypeMismatchException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/PropertyTypeMismatchException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/PropertyTypeMismatchException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/QueryParserException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/QueryParserException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/QueryParserException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/QueryParserException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryDefinitionException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryDefinitionException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryDefinitionException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryDefinitionException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryMockException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryMockException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryMockException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/RepositoryMockException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/ResultAdapterFailureException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ResultAdapterFailureException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/ResultAdapterFailureException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ResultAdapterFailureException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/ResultConversionFailureException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ResultConversionFailureException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/ResultConversionFailureException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/ResultConversionFailureException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/error/UnknownDataOperationException.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/UnknownDataOperationException.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/error/UnknownDataOperationException.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/error/UnknownDataOperationException.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/DataOperationResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/DataOperationResolver.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/DataOperationResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/DataOperationResolver.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/DependencyAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/DependencyAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/DependencyAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/DependencyAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/InvocationMapping.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/InvocationMapping.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/InvocationMapping.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/InvocationMapping.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/NonDataOperationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/NonDataOperationHandler.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/NonDataOperationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/NonDataOperationHandler.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfiguration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfiguration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfiguration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfiguration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfigurationAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfigurationAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfigurationAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryConfigurationAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactory.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactory.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactory.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactory.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfiguration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfiguration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfiguration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfiguration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfigurationAware.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfigurationAware.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfigurationAware.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/RepositoryFactoryConfigurationAware.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapterContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapterContext.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapterContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultAdapterContext.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/ResultConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMapping.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMapping.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMapping.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMapping.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMappingContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMappingContext.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMappingContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/TypeMappingContext.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java similarity index 87% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java index ca061c78..fa438518 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandler.java @@ -9,6 +9,8 @@ import com.mmnaseri.utils.spring.data.proxy.impl.converters.DefaultResultConverter; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.lang.reflect.InvocationHandler; @@ -32,6 +34,7 @@ @SuppressWarnings("WeakerAccess") public class DataOperationInvocationHandler implements InvocationHandler { + private static final Log log = LogFactory.getLog(DataOperationInvocationHandler.class); private final DataStore dataStore; private final ResultAdapterContext adapterContext; private final ResultConverter converter; @@ -54,6 +57,7 @@ public DataOperationInvocationHandler(RepositoryConfiguration repositoryConfigur @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + log.info("A method call to " + method + " has been intercepted. We will now try to find an appropriate invocation."); final Invocation methodInvocation = new ImmutableInvocation(method, args); InvocationMapping targetMapping = null; if (!misses.contains(method)) { @@ -70,11 +74,14 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } } if (targetMapping == null) { + log.info("The invocation cannot be resolved using a data operation. We will try to handle this as a non-data operation"); misses.add(method); return operationInvocationHandler.invoke(proxy, method, args); } final DataStoreOperation operation = targetMapping.getOperation(); + log.info("Executing the operation for method " + method); final Object operationResult = operation.execute(dataStore, repositoryConfiguration, methodInvocation); + log.info("Trying to see if any conversion is necessary on the object"); final Object convertedResult = converter.convert(methodInvocation, operationResult); return adapterContext.adapt(methodInvocation, convertedResult); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java similarity index 92% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java index 26f72f65..89e58fbe 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactory.java @@ -11,11 +11,14 @@ import com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext; import com.mmnaseri.utils.spring.data.store.impl.EventPublishingDataStore; import com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -29,7 +32,8 @@ * @since 1.0 (9/29/15) */ public class DefaultRepositoryFactory implements RepositoryFactory { - + + private static final Log log = LogFactory.getLog(DefaultRepositoryFactory.class); private final RepositoryMetadataResolver repositoryMetadataResolver; private final Map, RepositoryMetadata> metadataMap = new ConcurrentHashMap<>(); private final QueryDescriptionExtractor descriptionExtractor; @@ -53,17 +57,22 @@ public DefaultRepositoryFactory(RepositoryFactoryConfiguration configuration) { @Override public E getInstance(KeyGenerator keyGenerator, Class repositoryInterface, Class... implementations) { + log.info("We are going to create a proxy instance of type " + repositoryInterface + " using key generator " + keyGenerator + " and binding the implementations to " + Arrays.toString(implementations)); //figure out the repository metadata + log.info("Resolving repository metadata for " + repositoryInterface); final RepositoryMetadata metadata = getRepositoryMetadata(repositoryInterface); //get the underlying data store + log.info("Resolving the data store for " + repositoryInterface); final DataStore dataStore = getDataStore(metadata); //figure out type mappings + log.info("Trying to find all the proper type mappings for entity repository " + repositoryInterface); final List> typeMappings = getTypeMappings(metadata, dataStore, keyGenerator, implementations); //set up the data operation resolver final DataOperationResolver operationResolver = new DefaultDataOperationResolver(typeMappings, descriptionExtractor, metadata, functionRegistry, configuration); //get all of this repository's methods final Method[] methods = repositoryInterface.getMethods(); //get mappings for the repository methods + log.info("Trying to find all the invocation mappings for methods declared on " + repositoryInterface); final List> invocationMappings = getInvocationMappings(operationResolver, methods); //extract the bound implementation types final List> boundImplementations = new LinkedList<>(); @@ -76,9 +85,11 @@ public E getInstance(KeyGenerator keyGenerator, Clas //noinspection unchecked final InvocationHandler interceptor = new DataOperationInvocationHandler(repositoryConfiguration, invocationMappings, dataStore, adapterContext, operationInvocationHandler); //create a proxy for the repository + log.info("Instantiating the proxy using the provided configuration"); final Object instance = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{repositoryInterface}, interceptor); //for each type mapping, inject proper dependencies for (TypeMapping typeMapping : typeMappings) { + log.info("Injecting all the required dependencies into the repository mapping implementations"); if (typeMapping.getInstance() instanceof RepositoryAware) { //noinspection unchecked ((RepositoryAware) typeMapping.getInstance()).setRepository(instance); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryConfiguration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryConfiguration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryConfiguration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryConfiguration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java similarity index 85% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java index 69baf839..3e17f47e 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContext.java @@ -5,6 +5,8 @@ import com.mmnaseri.utils.spring.data.proxy.ResultAdapter; import com.mmnaseri.utils.spring.data.proxy.ResultAdapterContext; import com.mmnaseri.utils.spring.data.proxy.impl.adapters.*; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.Collection; @@ -20,6 +22,7 @@ @SuppressWarnings("WeakerAccess") public class DefaultResultAdapterContext implements ResultAdapterContext { + private static final Log log = LogFactory.getLog(DefaultResultAdapterContext.class); private final List> adapters; /** @@ -60,17 +63,20 @@ public DefaultResultAdapterContext(boolean registerDefaults) { @Override public synchronized void register(ResultAdapter adapter) { + log.info("Registering adapter " + adapter + " with the registry"); adapters.add(adapter); Collections.sort(adapters); } @Override public Object adapt(Invocation invocation, Object originalResult) { + log.info("Adapting the result of invocation to type " + invocation.getMethod().getReturnType()); for (ResultAdapter adapter : adapters) { if (adapter.accepts(invocation, originalResult)) { return adapter.adapt(invocation, originalResult); } } + log.error("Could not find any result adapter that was capable of adapting the result of the invocation to type " + invocation.getMethod().getReturnType()); throw new ResultAdapterFailureException(originalResult, invocation.getMethod().getReturnType()); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java similarity index 78% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java index 44e0b799..56e8961d 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContext.java @@ -7,6 +7,8 @@ import com.mmnaseri.utils.spring.data.repository.DefaultGemfireRepository; import com.mmnaseri.utils.spring.data.repository.DefaultJpaRepository; import com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.util.ClassUtils; @@ -27,6 +29,7 @@ @SuppressWarnings("WeakerAccess") public class DefaultTypeMappingContext implements TypeMappingContext { + private static final Log log = LogFactory.getLog(DefaultTypeMappingContext.class); private final TypeMappingContext parent; private ConcurrentMap, List>> mappings = new ConcurrentHashMap<>(); @@ -44,10 +47,13 @@ public DefaultTypeMappingContext() { public DefaultTypeMappingContext(boolean registerDefaults) { this(null); if (registerDefaults) { + log.info("Trying to register all the default type mappings"); if (ClassUtils.isPresent("org.springframework.data.gemfire.repository.GemfireRepository", ClassUtils.getDefaultClassLoader())) { + log.debug("We seem to have Gemfire in the classpath, so, we should register the supporting registry"); register(Object.class, DefaultGemfireRepository.class); } if (ClassUtils.isPresent("org.springframework.data.jpa.repository.JpaRepository", ClassUtils.getDefaultClassLoader())) { + log.debug("JPA support is enabled in this project, so we need to support the methods"); register(Object.class, DefaultJpaRepository.class); } register(Object.class, DefaultPagingAndSortingRepository.class); @@ -62,8 +68,12 @@ public DefaultTypeMappingContext(TypeMappingContext parent) { @Override public void register(Class repositoryType, Class implementation) { if (Modifier.isAbstract(implementation.getModifiers()) || Modifier.isInterface(implementation.getModifiers())) { + log.error("Cannot bind a non-concrete class as an implementation for a non-concrete class"); throw new RepositoryDefinitionException(repositoryType, "Cannot bind a non-concrete class as an implementation for a non-concrete class"); } + log.info("Registering implementation " + implementation + " to super type " + repositoryType + + "; this means any repository of this type will inherit functionality defined in the " + + "bound implementation class."); mappings.putIfAbsent(repositoryType, new LinkedList>()); mappings.get(repositoryType).add(implementation); } @@ -87,15 +97,19 @@ public List> getImplementations(Class repositoryType) { public List> getMappings(Class repositoryType) { final List> typeMappings = new LinkedList<>(); final List> implementations = getImplementations(repositoryType); + log.info("The repository " + repositoryType + " is bound to implementations " + implementations); for (Class implementation : implementations) { final Object instance; try { instance = implementation.newInstance(); } catch (InstantiationException e) { + log.error("Failed to instantiate class " + implementation + " because there was an error in the constructor"); throw new RepositoryDefinitionException(repositoryType, "Failed to instantiate an object of type " + implementation, e); } catch (IllegalAccessException e) { + log.error("The constructor for the implementation class is not accessible: " + implementation); throw new RepositoryDefinitionException(repositoryType, "Failed to access the constructor for " + implementation, e); } catch (Exception e) { + log.error("The constructor for " + implementation + " threw an exception"); throw new RepositoryDefinitionException(repositoryType, "Constructor threw an exception " + implementation, e); } //noinspection unchecked diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMapping.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMapping.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMapping.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMapping.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryConfiguration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryConfiguration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryConfiguration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryConfiguration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfiguration.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfiguration.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfiguration.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfiguration.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableTypeMapping.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableTypeMapping.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableTypeMapping.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableTypeMapping.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java similarity index 77% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java index 5a5b52f2..94fec0ce 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandler.java @@ -5,6 +5,8 @@ import com.mmnaseri.utils.spring.data.proxy.impl.regular.EqualsNonDataOperationHandler; import com.mmnaseri.utils.spring.data.proxy.impl.regular.HashCodeNonDataOperationHandler; import com.mmnaseri.utils.spring.data.proxy.impl.regular.ToStringNonDataOperationHandler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -20,6 +22,7 @@ */ public class NonDataOperationInvocationHandler implements InvocationHandler { + private static final Log log = LogFactory.getLog(NonDataOperationInvocationHandler.class); private final List handlers; public NonDataOperationInvocationHandler() { @@ -29,6 +32,7 @@ public NonDataOperationInvocationHandler() { public NonDataOperationInvocationHandler(boolean registerDefaults) { handlers = new LinkedList<>(); if (registerDefaults) { + log.info("Registering all the default operation handlers"); handlers.add(new EqualsNonDataOperationHandler()); handlers.add(new HashCodeNonDataOperationHandler()); handlers.add(new ToStringNonDataOperationHandler()); @@ -37,15 +41,19 @@ public NonDataOperationInvocationHandler(boolean registerDefaults) { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + log.info("Intercepting non-data method " + method); for (NonDataOperationHandler handler : handlers) { if (handler.handles(proxy, method, args)) { + log.info("Found handler " + handler + " for method " + method); return handler.invoke(proxy, args); } } + log.error("No data or non-data operation handler could be found for method " + method); throw new UnknownDataOperationException(method); } public void register(NonDataOperationHandler handler) { + log.info("Registering operation handler " + handler); handlers.add(handler); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/AbstractResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIterator.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIterator.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIterator.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIterator.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SameTypeResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SameTypeResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SameTypeResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SameTypeResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/DefaultResultConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/DefaultResultConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/DefaultResultConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/DefaultResultConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/EqualsNonDataOperationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/EqualsNonDataOperationHandler.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/EqualsNonDataOperationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/EqualsNonDataOperationHandler.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/HashCodeNonDataOperationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/HashCodeNonDataOperationHandler.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/HashCodeNonDataOperationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/HashCodeNonDataOperationHandler.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/ToStringNonDataOperationHandler.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/ToStringNonDataOperationHandler.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/ToStringNonDataOperationHandler.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/regular/ToStringNonDataOperationHandler.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java similarity index 83% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java index 0c38ba23..664e72f5 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolver.java @@ -9,6 +9,8 @@ import com.mmnaseri.utils.spring.data.proxy.TypeMapping; import com.mmnaseri.utils.spring.data.query.DataFunctionRegistry; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.lang.reflect.Method; import java.util.ArrayList; @@ -22,6 +24,7 @@ */ public class DefaultDataOperationResolver implements DataOperationResolver { + private static final Log log = LogFactory.getLog(DefaultDataOperationResolver.class); private final List resolvers; public DefaultDataOperationResolver(List> implementations, QueryDescriptionExtractor descriptionExtractor, RepositoryMetadata repositoryMetadata, DataFunctionRegistry functionRegistry, RepositoryFactoryConfiguration configuration) { @@ -32,7 +35,9 @@ public DefaultDataOperationResolver(List> implementations, QueryD @Override public DataStoreOperation resolve(Method method) { + log.info("Resolving the data operation for method " + method); for (DataOperationResolver resolver : resolvers) { + log.debug("Attempting to resolve the method call using resolver " + resolver); final DataStoreOperation resolution; try { resolution = resolver.resolve(method); @@ -43,6 +48,7 @@ public DefaultDataOperationResolver(List> implementations, QueryD return resolution; } } + log.error("No suitable data operation could be found for method " + method); throw new UnknownDataOperationException(method); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java similarity index 88% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java index d9f439e9..f2041a4b 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolver.java @@ -9,6 +9,8 @@ import com.mmnaseri.utils.spring.data.query.DataFunctionRegistry; import com.mmnaseri.utils.spring.data.query.QueryDescriptor; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.data.annotation.QueryAnnotation; @@ -27,6 +29,7 @@ @SuppressWarnings("WeakerAccess") public class QueryMethodDataOperationResolver implements DataOperationResolver { + private static final Log log = LogFactory.getLog(QueryMethodDataOperationResolver.class); private final QueryDescriptionExtractor descriptionExtractor; private final RepositoryMetadata repositoryMetadata; private final DataFunctionRegistry functionRegistry; @@ -42,9 +45,11 @@ public QueryMethodDataOperationResolver(QueryDescriptionExtractor descriptionExt @Override public DataStoreOperation resolve(Method method) { if (AnnotationUtils.findAnnotation(method, QueryAnnotation.class) != null) { + log.info("Found a @Query annotation on the method " + method); //we don't know how to handle vendor-specific query methods return null; } + log.info("Extracting query description from the method by parsing the method"); final QueryDescriptor descriptor = descriptionExtractor.extract(repositoryMetadata, method, configuration); return new DescribedDataStoreOperation<>(new SelectDataStoreOperation<>(descriptor), functionRegistry); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java similarity index 80% rename from src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java index 31ddc146..ee6047a3 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolver.java @@ -5,9 +5,12 @@ import com.mmnaseri.utils.spring.data.proxy.TypeMapping; import com.mmnaseri.utils.spring.data.store.DataStoreOperation; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.List; /** @@ -25,6 +28,7 @@ @SuppressWarnings("WeakerAccess") public class SignatureDataOperationResolver implements DataOperationResolver { + private static final Log log = LogFactory.getLog(SignatureDataOperationResolver.class); private final List> mappings; public SignatureDataOperationResolver(List> mappings) { @@ -33,10 +37,12 @@ public SignatureDataOperationResolver(List> mappings) { @Override public DataStoreOperation resolve(Method method) { + log.info("Trying to resolve the data operation for method " + method + " by going through the previously set up type mappings"); for (TypeMapping mapping : mappings) { final Class type = mapping.getType(); final Method declaration = findMethod(type, method.getName(), method.getParameterTypes()); if (declaration != null) { + log.info("Setting the resolution as a method invocation on the previously prepared type mapping"); final Object instance = mapping.getInstance(); return new MethodInvocationDataStoreOperation(instance, declaration); } @@ -45,8 +51,10 @@ public SignatureDataOperationResolver(List> mappings) { } private static Method findMethod(Class type, String name, Class... parameterTypes) { + log.debug("Attempting to look for the actual declaration of the method named '" + name + "' with parameter types " + Arrays.toString(parameterTypes) + " on the child type " + type); Class searchType = type; while (searchType != null) { + log.trace("Looking at type " + type + " for method " + name); final Method[] methods = searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(name) && parameterTypes.length == method.getParameterTypes().length) { diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunction.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunction.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/DataFunction.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunction.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunctionRegistry.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunctionRegistry.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/DataFunctionRegistry.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/DataFunctionRegistry.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/NullHandling.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/NullHandling.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/NullHandling.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/NullHandling.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/Order.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Order.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/Order.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Order.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/Page.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Page.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/Page.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Page.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/PageParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/PageParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/PageParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/PageParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/ParameterMetadataExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/ParameterMetadataExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/ParameterMetadataExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/ParameterMetadataExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/PropertyDescriptor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/PropertyDescriptor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/PropertyDescriptor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/PropertyDescriptor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/QueryDescriptor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/QueryDescriptor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/QueryDescriptor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/QueryDescriptor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/Sort.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Sort.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/Sort.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/Sort.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/SortDirection.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/SortDirection.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/SortDirection.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/SortDirection.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/SortParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/SortParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/SortParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/SortParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java similarity index 85% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java index 34d6b27e..c74ffadc 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/AbstractSortParameterExtractor.java @@ -19,6 +19,12 @@ @SuppressWarnings("WeakerAccess") public abstract class AbstractSortParameterExtractor implements SortParameterExtractor { + /** + * Given a sort parameter from the Spring Data framework, will determine the appropriate sort metadata compatible + * with this framework + * @param sort the sort specification + * @return converted sort metadata + */ protected Sort getSort(org.springframework.data.domain.Sort sort) { final List orders = new ArrayList<>(); for (org.springframework.data.domain.Sort.Order order : sort) { diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java similarity index 81% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java index 6ffaab1f..0c33a7d5 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunction.java @@ -5,6 +5,8 @@ import com.mmnaseri.utils.spring.data.query.DataFunction; import com.mmnaseri.utils.spring.data.query.QueryDescriptor; import com.mmnaseri.utils.spring.data.store.DataStore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.List; @@ -18,9 +20,12 @@ @SuppressWarnings("WeakerAccess") public class CountDataFunction implements DataFunction { + private static final Log log = LogFactory.getLog(CountDataFunction.class); + @Override public Long apply(DataStore dataStore, QueryDescriptor query, RepositoryConfiguration repositoryConfiguration, List selection) { if (selection == null) { + log.error("Cannot calculate the count if the selection is null"); throw new InvalidArgumentException("Selection cannot be null"); } return ((Integer) selection.size()).longValue(); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java similarity index 78% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java index 2ec76508..ffb37f4b 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistry.java @@ -4,6 +4,8 @@ import com.mmnaseri.utils.spring.data.error.FunctionNotFoundException; import com.mmnaseri.utils.spring.data.query.DataFunction; import com.mmnaseri.utils.spring.data.query.DataFunctionRegistry; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.Map; import java.util.Set; @@ -19,6 +21,8 @@ @SuppressWarnings("WeakerAccess") public class DefaultDataFunctionRegistry implements DataFunctionRegistry { + private static final Log log = LogFactory.getLog(DefaultDataFunctionRegistry.class); + private final Map> functions; public DefaultDataFunctionRegistry() { @@ -28,6 +32,7 @@ public DefaultDataFunctionRegistry() { public DefaultDataFunctionRegistry(boolean registerDefaults) { functions = new ConcurrentHashMap<>(); if (registerDefaults) { + log.info("Registering the default functions"); register("count", new CountDataFunction()); register("delete", new DeleteDataFunction()); } @@ -36,14 +41,17 @@ public DefaultDataFunctionRegistry(boolean registerDefaults) { @Override public void register(String name, DataFunction function) { if (functions.containsKey(name)) { + log.error("Cannot register a function with name " + name + " because that name is already taken"); throw new DuplicateFunctionException(name); } + log.info("Registering function with name " + name); functions.put(name, function); } @Override public DataFunction getFunction(String name) { if (!functions.containsKey(name)) { + log.error("No function could be found with name " + name); throw new FunctionNotFoundException(name); } return functions.get(name); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java similarity index 92% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java index 847db102..2d79a971 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptor.java @@ -1,11 +1,10 @@ package com.mmnaseri.utils.spring.data.query.impl; -import com.mmnaseri.utils.spring.data.domain.Invocation; -import com.mmnaseri.utils.spring.data.domain.Operator; -import com.mmnaseri.utils.spring.data.domain.Parameter; -import com.mmnaseri.utils.spring.data.domain.RepositoryMetadata; +import com.mmnaseri.utils.spring.data.domain.*; import com.mmnaseri.utils.spring.data.proxy.RepositoryFactoryConfiguration; import com.mmnaseri.utils.spring.data.query.*; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; @@ -18,7 +17,9 @@ * @since 1.0 (9/20/15) */ public class DefaultQueryDescriptor implements QueryDescriptor { - + + private static final Log log = LogFactory.getLog(InvocationMatcher.class); + private final boolean distinct; private final String function; private final int limit; @@ -81,6 +82,7 @@ public List> getBranches() { @Override public boolean matches(Object entity, Invocation invocation) { + log.info("Matching " + entity + " against " + invocation); final List> branches = getBranches(); if (branches.isEmpty()) { return entity != null; diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java similarity index 73% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java index 476db96f..716ffd09 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunction.java @@ -7,13 +7,15 @@ import com.mmnaseri.utils.spring.data.query.QueryDescriptor; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.LinkedList; import java.util.List; /** - * This function provides support for the delete data operation, by issueing a delete request for every + * This function provides support for the delete data operation, by issuing a delete request for every * selected entity to the underlying data store. * * @author Milad Naseri (mmnaseri@programmer.net) @@ -22,27 +24,35 @@ @SuppressWarnings("WeakerAccess") public class DeleteDataFunction implements DataFunction> { + private static final Log log = LogFactory.getLog(DeleteDataFunction.class); + @Override public List apply(DataStore dataStore, QueryDescriptor query, RepositoryConfiguration repositoryConfiguration, List selection) { if (dataStore == null) { + log.error("Cannot delete entities when the data store is null"); throw new InvalidArgumentException("Data store cannot be null"); } if (query == null) { + log.error("Cannot delete entities when the query is null"); throw new InvalidArgumentException("Query cannot be null"); } if (selection == null) { + log.error("Cannot delete entities when the selection is null"); throw new InvalidArgumentException("Selection cannot be null"); } final String identifier = query.getRepositoryMetadata().getIdentifierProperty(); + log.info("Using property " + identifier + " to delete the entities"); final List deleted = new LinkedList<>(); for (E item : selection) { final Object key; try { key = PropertyUtils.getPropertyValue(item, identifier); } catch (Exception e) { + log.error("The value of property " + identifier + " could not be read "); throw new DataFunctionException("Failed to read property value for property " + identifier, e); } if (key == null) { + log.error("Cannot delete an entity when the identifier property has been set to null"); throw new DataFunctionException("Cannot delete an entity without the key property being set: " + identifier); } //noinspection unchecked @@ -50,6 +60,7 @@ public List apply(DataStore dataStore, Quer deleted.add(item); } } + log.error("Deleted " + deleted.size() + " entities as the result of the delete call"); return deleted; } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java similarity index 92% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java index 08af908a..fee71665 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableOrder.java @@ -42,4 +42,9 @@ public NullHandling getNullHandling() { return nullHandling; } + @Override + public String toString() { + return property + " " + direction; + } + } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePage.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePage.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePage.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePage.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePropertyDescriptor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePropertyDescriptor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePropertyDescriptor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutablePropertyDescriptor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableSort.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableSort.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableSort.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/ImmutableSort.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java similarity index 78% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java index 5e40222e..5f0bf09e 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupport.java @@ -3,6 +3,8 @@ import com.mmnaseri.utils.spring.data.domain.*; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; @@ -13,8 +15,10 @@ * @author Milad Naseri (mmnaseri@programmer.net) * @since 1.0 (2015/11/09, 21:40) */ +@SuppressWarnings("WeakerAccess") public class CrudRepositorySupport implements DataStoreAware, RepositoryMetadataAware, KeyGeneratorAware { + private static final Log log = LogFactory.getLog(CrudRepositorySupport.class); private KeyGenerator keyGenerator; private DataStore dataStore; private RepositoryMetadata repositoryMetadata; @@ -29,10 +33,16 @@ protected CrudRepositorySupport() {} */ public Object save(Object entity) { Object key = PropertyUtils.getPropertyValue(entity, repositoryMetadata.getIdentifierProperty()); + log.info("The entity that is to be saved has a key with value " + key); if (key == null && keyGenerator != null) { + log.info("The key was null, but the generator was not, so we are going to get a key for the entity"); key = keyGenerator.generate(); + log.debug("The generated key for the entity was " + key); PropertyUtils.setPropertyValue(entity, repositoryMetadata.getIdentifierProperty(), key); } + if (key == null) { + log.warn("Attempting to save an entity without a key. This might result in an error. To fix this, specify a key generator."); + } //noinspection unchecked dataStore.save((Serializable) key, entity); return entity; diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java similarity index 72% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java index 15fc9761..8b4ffd3b 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepository.java @@ -2,8 +2,11 @@ import com.mmnaseri.utils.spring.data.error.EntityMissingKeyException; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; +import java.util.Collection; import java.util.LinkedList; import java.util.List; @@ -17,6 +20,8 @@ @SuppressWarnings({"unchecked", "WeakerAccess"}) public class DefaultCrudRepository extends CrudRepositorySupport { + private static final Log log = LogFactory.getLog(DefaultCrudRepository.class); + /** * Saves all the given entities * @param entities entities to save (insert or update) @@ -24,6 +29,8 @@ public class DefaultCrudRepository extends CrudRepositorySupport { */ public Iterable save(Iterable entities) { final List list = new LinkedList<>(); + log.info("Going to save a number of entities in the underlying data store"); + log.debug(entities); for (Object entity : entities) { list.add(save(entity)); } @@ -36,6 +43,7 @@ public Iterable save(Iterable entities) { * @return the entity */ public Object findOne(Serializable key) { + log.info("Attempting to load the entity with key " + key); return getDataStore().retrieve(key); } @@ -55,9 +63,12 @@ public boolean exists(Serializable key) { */ public Iterable findAll(Iterable ids) { final List entities = new LinkedList(); + log.info("Looking for multiple entities for a number of ids"); + log.debug(ids); for (Object id : ids) { final Object found = findOne((Serializable) id); if (found != null) { + log.trace("Entity found for key " + id + ", adding the found entity to the list of returned entity"); entities.add(found); } } @@ -84,6 +95,7 @@ public Object delete(Serializable id) { public Object delete(Object entity) { final Object key = PropertyUtils.getPropertyValue(entity, getRepositoryMetadata().getIdentifierProperty()); if (key == null) { + log.error("The entity that was supposed to be deleted, does not have a key"); throw new EntityMissingKeyException(getRepositoryMetadata().getEntityType(), getRepositoryMetadata().getIdentifierProperty()); } return delete((Serializable) key); @@ -95,10 +107,13 @@ public Object delete(Object entity) { * @return the entities that were actually deleted */ public Iterable delete(Iterable entities) { + log.info("Attempting to delete multiple entities via entity objects themselves"); + log.debug(entities); final List list = new LinkedList(); for (Object entity : entities) { final Object deleted = delete(entity); if (deleted != null) { + log.debug("The entity was deleted successfully and will be added to the list of deleted entities"); list.add(deleted); } } @@ -110,13 +125,19 @@ public Iterable delete(Iterable entities) { * @return all the entities that were removed */ public Iterable deleteAll() { + log.info("Attempting to delete all entities at once"); final List list = new LinkedList(); - for (Object key : getDataStore().keys()) { + final Collection keys = getDataStore().keys(); + log.debug("There are " + keys.size() + " entities altogether in the data store that are going to be deleted"); + for (Object key : keys) { final Object deleted = delete(((Serializable) key)); if (deleted != null) { + log.debug("The entity was deleted successfully and will be added to the list of deleted entities"); list.add(deleted); } } + final Collection remainingKeys = getDataStore().keys(); + log.debug("There are " + remainingKeys.size() + " keys remaining in the data store after the delete operation"); return list; } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java similarity index 76% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java index 6375321b..b3bb3c04 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepository.java @@ -5,6 +5,8 @@ import com.mmnaseri.utils.spring.data.domain.RepositoryMetadataAware; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.data.gemfire.repository.Wrapper; import java.io.Serializable; @@ -15,19 +17,24 @@ */ public class DefaultGemfireRepository implements DataStoreAware, RepositoryMetadataAware { + private static final Log log = LogFactory.getLog(DefaultGemfireRepository.class); private DataStore dataStore; private RepositoryMetadata repositoryMetadata; /** * Saves the wrapped data object into the data store. If the wrapped object is also an instance of * the type bound to this data store, it will set the key on the object - * @param wrapper the wrapper for the key and the object + * + * @param wrapper the wrapper for the key and the object * @return the saved entity */ public Object save(Wrapper wrapper) { + log.info("Going to save a wrapped data store object"); final Object entity = wrapper.getEntity(); final Serializable key = wrapper.getKey(); if (repositoryMetadata.getEntityType().isInstance(entity)) { + log.debug("Since the entity is of the same type as the actual entity type supported by the data store, " + + "we know how to set the key on the wrapped entity."); PropertyUtils.setPropertyValue(entity, repositoryMetadata.getIdentifierProperty(), key); } //noinspection unchecked diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java similarity index 79% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java index c0ab27b3..f80876fe 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepository.java @@ -4,6 +4,8 @@ import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.QueueingDataStore; import com.mmnaseri.utils.spring.data.tools.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.Collection; @@ -17,6 +19,8 @@ @SuppressWarnings({"unchecked", "WeakerAccess"}) public class DefaultJpaRepository extends CrudRepositorySupport { + private static final Log log = LogFactory.getLog(DefaultJpaRepository.class); + /** * If the underlying data store supports {@link QueueingDataStore queueing} and needs the queue to be * flushed, this method will flush the queue. Otherwise, it will not do anything @@ -24,6 +28,7 @@ public class DefaultJpaRepository extends CrudRepositorySupport { public void flush() { final DataStore dataStore = getDataStore(); if (dataStore instanceof QueueingDataStore) { + log.info("Asking the data store to flush the underlying operation queue"); final QueueingDataStore store = (QueueingDataStore) dataStore; store.flush(); } @@ -41,6 +46,7 @@ public Iterable deleteInBatch(Iterable entities) { for (Object entity : entities) { final Object key = PropertyUtils.getPropertyValue(entity, getRepositoryMetadata().getIdentifierProperty()); if (key == null) { + log.error("There is no key set for the entity we were trying to delete"); throw new EntityMissingKeyException(getRepositoryMetadata().getEntityType(), getRepositoryMetadata().getIdentifierProperty()); } final Serializable serializable = (Serializable) key; @@ -54,6 +60,7 @@ public Iterable deleteInBatch(Iterable entities) { * @return deleted entities */ public Iterable deleteAllInBatch() { + log.info("Attempting to delete all the entities in the data store in a batch"); return deleteByKeysInBatch(getDataStore().keys()); } @@ -65,8 +72,10 @@ public Iterable deleteAllInBatch() { private Iterable deleteByKeysInBatch(Collection keys) { final Object batch; if (getDataStore() instanceof QueueingDataStore) { + log.debug("The data store support queueing, so we are going to start a batch"); batch = ((QueueingDataStore) getDataStore()).startBatch(); } else { + log.debug("The data store does not support batching, so this is the same as a normal delete"); batch = null; } final List result = new LinkedList(); @@ -77,6 +86,7 @@ private Iterable deleteByKeysInBatch(Collection keys) { } } if (getDataStore() instanceof QueueingDataStore) { + log.debug("Ending the batch operation that was started previously."); ((QueueingDataStore) getDataStore()).endBatch(batch); } return result; @@ -89,8 +99,10 @@ private Iterable deleteByKeysInBatch(Collection keys) { */ public Object getOne(Serializable key) { if (getDataStore().hasKey(key)) { + log.info("Returning entity for key " + key); return getDataStore().retrieve(key); } + log.info("No entity was found with key " + key); return null; } @@ -100,7 +112,9 @@ public Object getOne(Serializable key) { * @return the saved entity */ public Object saveAndFlush(Object entity) { + log.info("Saving entity " + entity + " to the data store."); final Object saved = save(entity); + log.info("Going to flush the data store after the save"); flush(); return saved; } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java similarity index 80% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java index 63e9105f..76b13ef3 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepository.java @@ -8,6 +8,8 @@ import com.mmnaseri.utils.spring.data.query.impl.ImmutableOrder; import com.mmnaseri.utils.spring.data.query.impl.ImmutableSort; import com.mmnaseri.utils.spring.data.store.DataStore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; @@ -23,6 +25,8 @@ @SuppressWarnings("WeakerAccess") public class DefaultPagingAndSortingRepository implements DataStoreAware { + private static final Log log = LogFactory.getLog(DefaultPagingAndSortingRepository.class); + private DataStore dataStore; /** @@ -31,12 +35,14 @@ public class DefaultPagingAndSortingRepository implements DataStoreAware { * @return sorted entries, unless sort is null. */ public List findAll(Sort sort) { + log.info("Loading all the data in the data store"); //noinspection unchecked final List list = new LinkedList(dataStore.retrieveAll()); if (sort == null) { + log.info("No sort was specified, so we are just going to return the data as-is"); return list; } - final LinkedList orders = new LinkedList<>(); + final List orders = new LinkedList<>(); for (Sort.Order order : sort) { final SortDirection direction = order.getDirection().equals(Sort.Direction.ASC) ? SortDirection.ASCENDING : SortDirection.DESCENDING; final NullHandling nullHandling; @@ -54,6 +60,7 @@ public List findAll(Sort sort) { final Order derivedOrder = new ImmutableOrder(direction, order.getProperty(), nullHandling); orders.add(derivedOrder); } + log.info("Sorting the retrieved data: " + orders); PropertyComparator.sort(list, new ImmutableSort(orders)); return list; } @@ -66,8 +73,10 @@ public List findAll(Sort sort) { public Page findAll(Pageable pageable) { final List all; if (pageable.getSort() != null) { + log.info("The page specification requests sorting, so we are going to sort the data first"); all = findAll(pageable.getSort()); } else { + log.info("The page specification does not need sorting, so we are going to load the data as-is"); //noinspection unchecked all = new LinkedList(dataStore.retrieveAll()); } @@ -75,6 +84,7 @@ public Page findAll(Pageable pageable) { int end = start + pageable.getPageSize(); start = Math.min(start, all.size()); end = Math.min(end, all.size()); + log.info("Trimming the selection down for page " + pageable.getPageNumber() + " to include items from " + start + " to " + end); final List selection = new LinkedList<>(all.subList(start, end)); //noinspection unchecked return new PageImpl(selection, pageable, all.size()); diff --git a/src/main/java/com/mmnaseri/utils/spring/data/repository/package-info.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/package-info.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/repository/package-info.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/repository/package-info.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStore.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStore.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStore.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStore.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListener.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListener.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListener.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListener.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListenerContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListenerContext.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListenerContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventListenerContext.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventPublisher.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventPublisher.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventPublisher.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreEventPublisher.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreOperation.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreOperation.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreOperation.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreOperation.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreRegistry.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreRegistry.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreRegistry.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/DataStoreRegistry.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/QueueingDataStore.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/QueueingDataStore.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/QueueingDataStore.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/QueueingDataStore.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractEntityDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractEntityDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractEntityDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AbstractEntityDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterDeleteDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterDeleteDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterDeleteDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterDeleteDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterInsertDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterInsertDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterInsertDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterInsertDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterUpdateDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterUpdateDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterUpdateDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AfterUpdateDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListener.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListener.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListener.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListener.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapper.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapper.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapper.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapper.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeDeleteDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeDeleteDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeDeleteDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeDeleteDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeInsertDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeInsertDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeInsertDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeInsertDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeUpdateDataStoreEvent.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeUpdateDataStoreEvent.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeUpdateDataStoreEvent.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/BeforeUpdateDataStoreEvent.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java similarity index 79% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java index 46d85105..fcd161d9 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContext.java @@ -1,8 +1,11 @@ package com.mmnaseri.utils.spring.data.store.impl; +import com.mmnaseri.utils.spring.data.error.InvalidArgumentException; import com.mmnaseri.utils.spring.data.store.DataStoreEvent; import com.mmnaseri.utils.spring.data.store.DataStoreEventListener; import com.mmnaseri.utils.spring.data.store.DataStoreEventListenerContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.LinkedList; import java.util.List; @@ -24,6 +27,7 @@ */ public class DefaultDataStoreEventListenerContext implements DataStoreEventListenerContext { + private static final Log log = LogFactory.getLog(DefaultDataStoreEventListenerContext.class); private final ConcurrentMap, List>> listeners; private final DataStoreEventListenerContext parent; @@ -40,20 +44,28 @@ public DefaultDataStoreEventListenerContext(DataStoreEventListenerContext parent public void register(DataStoreEventListener listener) { final SmartDataStoreEventListener eventListener = new SmartDataStoreEventListener<>(listener); listeners.putIfAbsent(eventListener.getEventType(), new CopyOnWriteArrayList>()); + log.info("Registering an event listener for type " + eventListener.getEventType()); listeners.get(eventListener.getEventType()).add(eventListener); } @Override public void trigger(DataStoreEvent event) { + if (event == null) { + log.error("The data store event that was triggered was a null value"); + throw new InvalidArgumentException("Cannot raise a null event"); + } + log.info("Triggering data store event of type " + event.getClass()); for (Class eventType : listeners.keySet()) { if (eventType.isInstance(event)) { for (DataStoreEventListener listener : listeners.get(eventType)) { + log.debug("Triggering event on listener " + ((SmartDataStoreEventListener) listener).getDelegate()); //noinspection unchecked listener.onEvent(event); } } } if (parent != null) { + log.info("Going to trigger the same event on the parent context"); parent.trigger(event); } } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java similarity index 76% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java index 89132caf..37be1b40 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistry.java @@ -3,6 +3,8 @@ import com.mmnaseri.utils.spring.data.error.DataStoreNotFoundException; import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.DataStoreRegistry; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.Map; @@ -17,16 +19,20 @@ */ public class DefaultDataStoreRegistry implements DataStoreRegistry { + private static final Log log = LogFactory.getLog(DefaultDataStoreRegistry.class); private final Map, DataStore> dataStores = new ConcurrentHashMap<>(); @Override public void register(DataStore dataStore) { + log.info("Registering a data store for type " + dataStore.getEntityType()); dataStores.put(dataStore.getEntityType(), dataStore); } @Override public DataStore getDataStore(Class entityType) { if (!dataStores.containsKey(entityType)) { + log.error("There is no data store registered for entity type " + entityType); + log.debug("Registered data types are " + dataStores.keySet()); throw new DataStoreNotFoundException(entityType); } //noinspection unchecked diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java similarity index 79% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java index 7400a7f9..859428fb 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStore.java @@ -6,6 +6,8 @@ import com.mmnaseri.utils.spring.data.store.DataStoreEvent; import com.mmnaseri.utils.spring.data.store.DataStoreEventListenerContext; import com.mmnaseri.utils.spring.data.store.DataStoreEventPublisher; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.Collection; @@ -19,6 +21,7 @@ */ public class EventPublishingDataStore implements DataStore, DataStoreEventPublisher { + private static final Log log = LogFactory.getLog(EventPublishingDataStore.class); private final DataStore delegate; private final RepositoryMetadata repositoryMetadata; private final DataStoreEventListenerContext listenerContext; @@ -37,22 +40,28 @@ public boolean hasKey(K key) { @Override public boolean save(K key, E entity) { if (key == null) { + log.error("Cannot save an entity under a null key"); throw new CorruptDataException(getEntityType(), null, "Cannot save an entity with a null key"); } if (entity == null) { + log.error("Cannot save a null value into the data store"); throw new CorruptDataException(getEntityType(), null, "Cannot save null into the data store"); } final boolean entityIsNew = !delegate.hasKey(key); if (entityIsNew) { + log.info("About to insert a new entity in the data store under key " + key); publishEvent(new BeforeInsertDataStoreEvent(repositoryMetadata, this, entity)); } else { + log.info("About to update the entity in the data store under key " + key); publishEvent(new BeforeUpdateDataStoreEvent(repositoryMetadata, this, entity)); } delegate.save(key, entity); if (entityIsNew) { + log.info("Finished inserting the entity in the data store under key " + key); publishEvent(new AfterInsertDataStoreEvent(repositoryMetadata, this, entity)); return true; } else { + log.info("Finished updating the entity under key " + key); publishEvent(new AfterUpdateDataStoreEvent(repositoryMetadata, this, entity)); return false; } @@ -61,11 +70,14 @@ public boolean save(K key, E entity) { @Override public boolean delete(K key) { if (!delegate.hasKey(key)) { + log.info("Attempted to delete entity with key " + key + " but found nothing"); return false; } final E entity = delegate.retrieve(key); + log.info("About to delete an entity with key " + key); publishEvent(new BeforeDeleteDataStoreEvent(repositoryMetadata, this, entity)); delegate.delete(key); + log.info("Finished deleting the entity with key " + key); publishEvent(new AfterDeleteDataStoreEvent(repositoryMetadata, this, entity)); return true; } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java similarity index 67% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java index 8ed0321e..dd18c8bf 100644 --- a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java +++ b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStore.java @@ -2,6 +2,8 @@ import com.mmnaseri.utils.spring.data.error.DataStoreException; import com.mmnaseri.utils.spring.data.store.DataStore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.Collection; @@ -17,7 +19,8 @@ * @since 1.0 (9/17/15) */ public class MemoryDataStore implements DataStore { - + + private static final Log log = LogFactory.getLog(MemoryDataStore.class); private final ConcurrentMap store = new ConcurrentHashMap<>(); private final Class entityType; @@ -27,27 +30,37 @@ public MemoryDataStore(Class entityType) { @Override public boolean hasKey(K key) { + log.info("Looking for an object with key " + key); return store.containsKey(key); } @Override public boolean save(K key, E entity) { if (key == null) { + log.error("Asked to save an entity with a null key"); throw new DataStoreException(entityType, "Cannot save an entity with a null key"); } else if (entity == null) { + log.error("Asked to save a null value into the data store"); throw new DataStoreException(entityType, "Cannot save a null entity"); } - return store.put(key, entity) == null; + log.info("Attempting to save entity with key " + key); + boolean saved = store.put(key, entity) == null; + log.debug("Entity was " + (!saved ? "not " : "") + "saved under key " + key); + return saved; } @Override public boolean delete(K key) { if (key == null) { + log.error("Asked to delete an entity with a null key for reference"); throw new DataStoreException(entityType, "Cannot delete an entity with a null key"); } if (store.containsKey(key)) { + log.info("Deleting entity under key " + key); store.remove(key); return true; + } else { + log.info("No entity was found to delete under key " + key); } return false; } @@ -55,10 +68,14 @@ public boolean delete(K key) { @Override public E retrieve(K key) { if (key == null) { + log.error("Asked to retrieve an entity from a null key"); throw new DataStoreException(entityType, "Cannot retrieve an entity with a null key"); } if (store.containsKey(key)) { + log.info("Retrieving entity from key " + key); return store.get(key); + } else { + log.info("No entity was found to return under key " + key); } return null; } @@ -70,6 +87,7 @@ public Collection keys() { @Override public synchronized Collection retrieveAll() { + log.info("Retrieving all entities from the data store"); return new LinkedList<>(store.values()); } diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitor.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitor.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitor.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitor.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListener.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListener.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListener.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListener.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/string/DocumentReader.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/string/DocumentReader.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/string/DocumentReader.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/string/DocumentReader.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/string/impl/DefaultDocumentReader.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/string/impl/DefaultDocumentReader.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/string/impl/DefaultDocumentReader.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/string/impl/DefaultDocumentReader.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtils.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtils.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtils.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtils.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilter.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilter.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilter.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilter.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/tools/PropertyUtils.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/PropertyUtils.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/tools/PropertyUtils.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/PropertyUtils.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/tools/StringUtils.java b/spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/StringUtils.java similarity index 100% rename from src/main/java/com/mmnaseri/utils/spring/data/tools/StringUtils.java rename to spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/tools/StringUtils.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRandomKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AbstractRepositoryMetadataResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AnnotationRepositoryMetadataResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/AssignableRepositoryMetadataResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/BaseKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/BaseKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/BaseKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/BaseKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContextTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContextTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContextTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContextTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultRepositoryMetadataResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperationTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperationTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperationTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/DescribedDataStoreOperationTest.java diff --git a/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperatorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperatorTest.java new file mode 100644 index 00000000..78cd416e --- /dev/null +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableMatchedOperatorTest.java @@ -0,0 +1,41 @@ +package com.mmnaseri.utils.spring.data.domain.impl; + +import com.mmnaseri.utils.spring.data.domain.MatchedOperator; +import com.mmnaseri.utils.spring.data.domain.Operator; +import com.mmnaseri.utils.spring.data.domain.impl.matchers.IsFalseMatcher; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.Random; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +/** + * @author Mohammad Milad Naseri (m.m.naseri@gmail.com) + * @since 1.0 (4/17/16, 12:41 PM) + */ +public class ImmutableMatchedOperatorTest { + + private Operator original; + private MatchedOperator matchedOperator; + + @BeforeMethod + public void setUp() throws Exception { + original = new ImmutableOperator("operator", new Random().nextInt(), new IsFalseMatcher(), "a", "b", "c"); + matchedOperator = new ImmutableMatchedOperator(original, "a"); + } + + @Test + public void testDelegation() throws Exception { + assertThat(matchedOperator.getMatcher(), is(original.getMatcher())); + assertThat(matchedOperator.getName(), is(original.getName())); + assertThat(matchedOperator.getOperands(), is(original.getOperands())); + assertThat(matchedOperator.getTokens(), is(original.getTokens())); + } + + @Test + public void testMatchedToken() throws Exception { + assertThat(matchedOperator.getMatchedToken(), is("a")); + } +} \ No newline at end of file diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/ImmutableParameterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperationTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperationTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperationTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/MethodInvocationDataStoreOperationTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparatorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparatorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparatorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/PropertyComparatorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/QueryDescriptionExtractorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomIntegerKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomIntegerKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomIntegerKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomIntegerKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomLongKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomLongKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomLongKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/RandomLongKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperationTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperationTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperationTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SelectDataStoreOperationTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialIntegerKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialIntegerKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialIntegerKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialIntegerKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialLongKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialLongKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialLongKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/SequentialLongKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/UUIDKeyGeneratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/UUIDKeyGeneratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/UUIDKeyGeneratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/UUIDKeyGeneratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedFieldIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/AnnotatedGetterIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseRepeatableIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseRepeatableIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseRepeatableIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/BaseRepeatableIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/EntityIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedFieldIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/id/NamedGetterIdPropertyResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java similarity index 98% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java index 951e8179..2fa6e768 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryComparableMatcherTest.java @@ -32,7 +32,7 @@ public void testWhenSecondParameterIsNotComparable() throws Exception { @Test public void testWhenAllAreComparable() throws Exception { final NotMatchingBinaryComparableMatcher matcher = new NotMatchingBinaryComparableMatcher(); - matcher.matches(new ImmutableParameter("x.y.z", null, null, null), 1, (Object) 2, 3); + matcher.matches(new ImmutableParameter("x.y.z", null, null, null), 1, 2, 3); } } \ No newline at end of file diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java similarity index 92% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java index 74068aa5..01ac0c6d 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractBinaryMatcherTest.java @@ -27,6 +27,8 @@ public void testWhenHasMoreThanTwoParameters() throws Exception { @Test public void testWhenHasTwoParameters() throws Exception { final NotMatchingBinaryMatcher matcher = new NotMatchingBinaryMatcher(); + //we are creating the varargs array explicitly to call to the proper method signature + //noinspection RedundantArrayCreation matcher.matches(new ImmutableParameter("x.y.z", null, null, new ImmutableOperator("sample", 2, null)), new Object(), new Object[]{new Object(), new Object()}); } diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractCollectionMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java similarity index 98% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java index a21be2bb..945b6011 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleComparableMatcherTest.java @@ -26,7 +26,7 @@ public void testWhenPivotIsNotComparable() throws Exception { @Test public void testWhenBothAreComparable() throws Exception { final NotMatchingSimpleComparableMatcher matcher = new NotMatchingSimpleComparableMatcher(); - matcher.matches(new ImmutableParameter("x.y.z", null, null, null), 1, (Object) 2); + matcher.matches(new ImmutableParameter("x.y.z", null, null, null), 1, 2); } } \ No newline at end of file diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractSimpleStringMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/AbstractStateMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/ContainingMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/EndingWithMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsBetweenMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsEqualToMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsFalseMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsGreaterThanOrEqualToMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsInMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLessThanOrEqualToMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsLikeMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotBetweenMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotInMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotLikeMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNotNullMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsNullMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/IsTrueMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/RegexMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcherTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcherTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcherTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/domain/impl/matchers/StartingWithMatcherTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java similarity index 99% rename from src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java index 3b3f3823..d53b88b1 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/dsl/factory/RepositoryFactoryBuilderTest.java @@ -275,7 +275,7 @@ public void testEnablingAuditingWithCustomAuditorAware() throws Exception { final AuditDataEventListener auditDataEventListener = (AuditDataEventListener) listeners.get(0); final AuditorAware usedAuditorAware = auditDataEventListener.getAuditorAware(); assertThat(usedAuditorAware, is(notNullValue())); - assertThat(usedAuditorAware, Matchers.is(auditorAware)); + assertThat(usedAuditorAware, is(auditorAware)); } @Test diff --git a/src/test/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilderTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilderTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilderTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/dsl/mock/RepositoryMockBuilderTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandlerTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandlerTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandlerTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DataOperationInvocationHandlerTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultRepositoryFactoryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContextTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContextTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContextTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultResultAdapterContextTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java index 4912400f..f66ce9c8 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/DefaultTypeMappingContextTest.java @@ -1,11 +1,11 @@ package com.mmnaseri.utils.spring.data.proxy.impl; +import com.mmnaseri.utils.spring.data.error.RepositoryDefinitionException; +import com.mmnaseri.utils.spring.data.proxy.TypeMapping; import com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository; import com.mmnaseri.utils.spring.data.repository.DefaultGemfireRepository; import com.mmnaseri.utils.spring.data.repository.DefaultJpaRepository; import com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository; -import com.mmnaseri.utils.spring.data.error.RepositoryDefinitionException; -import com.mmnaseri.utils.spring.data.proxy.TypeMapping; import com.mmnaseri.utils.spring.data.sample.usecases.proxy.*; import org.hamcrest.Matchers; import org.testng.annotations.BeforeMethod; diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMappingTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMappingTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMappingTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableInvocationMappingTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfigurationTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfigurationTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfigurationTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/ImmutableRepositoryFactoryConfigurationTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandlerTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandlerTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandlerTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/NonDataOperationInvocationHandlerTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/CollectionIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIteratorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIteratorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIteratorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/EmptyIteratorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/FutureIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/GeoPageIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/IteratorIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/ListenableFutureIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullSimpleResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToCollectionResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToFutureResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToIteratorResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToListenableFutureResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NullToSliceResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/NumberIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/PageIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SimpleIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/SliceIterableResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/adapters/VoidResultAdapterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/AbstractResultConverterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/FutureToIterableConverterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/IteratorToIterableConverterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/converters/SingleValueToIterableConverterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/DefaultDataOperationResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/QueryMethodDataOperationResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolverTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolverTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolverTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/proxy/impl/resolvers/SignatureDataOperationResolverTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunctionTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunctionTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunctionTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/CountDataFunctionTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultDataFunctionRegistryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DefaultQueryDescriptorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunctionTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunctionTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunctionTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DeleteDataFunctionTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/DirectSortParameterExtractorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageablePageParameterExtractorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/PageableSortParameterExtractorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/query/impl/WrappedSortParameterExtractorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupportTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupportTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupportTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/CrudRepositorySupportTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepositoryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepositoryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepositoryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultCrudRepositoryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepositoryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepositoryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepositoryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultGemfireRepositoryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepositoryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepositoryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepositoryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultJpaRepositoryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepositoryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepositoryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepositoryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/repository/DefaultPagingAndSortingRepositoryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AfterInsertEventListener.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AfterInsertEventListener.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AfterInsertEventListener.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AfterInsertEventListener.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AllCatchingEventListener.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AllCatchingEventListener.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AllCatchingEventListener.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/AllCatchingEventListener.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/CustomStringKeyGenerator.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/CustomStringKeyGenerator.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/CustomStringKeyGenerator.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/CustomStringKeyGenerator.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DataFunctionInvocation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DataFunctionInvocation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DataFunctionInvocation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DataFunctionInvocation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DuplicatingKeyGenerator.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DuplicatingKeyGenerator.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DuplicatingKeyGenerator.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/DuplicatingKeyGenerator.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/EventTrigger.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/EventTrigger.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/EventTrigger.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/EventTrigger.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryComparableMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryComparableMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryComparableMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryComparableMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingBinaryMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleComparableMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleComparableMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleComparableMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleComparableMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingSimpleMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStateMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStateMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStateMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStateMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStringMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStringMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStringMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NotMatchingStringMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NullReturningRepositoryMetadataResolver.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NullReturningRepositoryMetadataResolver.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NullReturningRepositoryMetadataResolver.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/NullReturningRepositoryMetadataResolver.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/Operation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/Operation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/Operation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/Operation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/OperationRequest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/OperationRequest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/OperationRequest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/OperationRequest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingCollectionMatcher.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingCollectionMatcher.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingCollectionMatcher.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingCollectionMatcher.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataFunction.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataFunction.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataFunction.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataFunction.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java similarity index 94% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java index 0a9db220..9259bb56 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingDataStore.java @@ -2,17 +2,13 @@ import com.mmnaseri.utils.spring.data.store.DataStore; import com.mmnaseri.utils.spring.data.store.QueueingDataStore; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; import java.io.Serializable; import java.util.*; import java.util.concurrent.atomic.AtomicLong; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.*; /** * @author Milad Naseri (mmnaseri@programmer.net) diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingEventListener.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingEventListener.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingEventListener.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingEventListener.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingHandler.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingHandler.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingHandler.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingHandler.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingListenerContext.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingListenerContext.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingListenerContext.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingListenerContext.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingOperation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingOperation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingOperation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingOperation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingResultAdapter.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingResultAdapter.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingResultAdapter.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingResultAdapter.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingSelectDataStoreOperation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingSelectDataStoreOperation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingSelectDataStoreOperation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/SpyingSelectDataStoreOperation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/StringifiableDataStoreOperation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/StringifiableDataStoreOperation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/StringifiableDataStoreOperation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/mocks/StringifiableDataStoreOperation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Address.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Address.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/Address.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Address.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditableEntity.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditableEntity.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditableEntity.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditableEntity.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditedPerson.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditedPerson.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditedPerson.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/AuditedPerson.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/BaseEntity.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/BaseEntity.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/BaseEntity.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/BaseEntity.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ChildZip.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ChildZip.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/ChildZip.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ChildZip.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/DummyEvent.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/DummyEvent.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/DummyEvent.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/DummyEvent.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EmptyEntity.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EmptyEntity.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EmptyEntity.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EmptyEntity.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdGetter.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdGetter.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdGetter.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotatedIdGetter.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetter.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetter.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetter.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetter.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetterAndAnIdField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetterAndAnIdField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetterAndAnIdField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithAnnotationOnIdFieldAndGetterAndAnIdField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedBy.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedBy.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedBy.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedBy.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithCreatedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithDateTimeLastModifiedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithDateTimeLastModifiedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithDateTimeLastModifiedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithDateTimeLastModifiedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithFinalCreatedBy.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithFinalCreatedBy.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithFinalCreatedBy.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithFinalCreatedBy.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldAndAnAnnotatedIdField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldAndAnAnnotatedIdField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldAndAnAnnotatedIdField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldAndAnAnnotatedIdField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldHiddenBehindDifferentlyNamedAccessors.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldHiddenBehindDifferentlyNamedAccessors.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldHiddenBehindDifferentlyNamedAccessors.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithIdFieldHiddenBehindDifferentlyNamedAccessors.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithLastModifiedBy.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithLastModifiedBy.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithLastModifiedBy.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithLastModifiedBy.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedFields.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedFields.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedFields.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedFields.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedIdGetters.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedIdGetters.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedIdGetters.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithMultipleAnnotatedIdGetters.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithNoImmediatelyResolvableIdProperty.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithNoImmediatelyResolvableIdProperty.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithNoImmediatelyResolvableIdProperty.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithNoImmediatelyResolvableIdProperty.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithSqlDateLastModifiedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithSqlDateLastModifiedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithSqlDateLastModifiedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithSqlDateLastModifiedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimeLastModifiedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimeLastModifiedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimeLastModifiedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimeLastModifiedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimestampDateLastModifiedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimestampDateLastModifiedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimestampDateLastModifiedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithTimestampDateLastModifiedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUnderscorePrecedingIdField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUnderscorePrecedingIdField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUnderscorePrecedingIdField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUnderscorePrecedingIdField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUtilDateLastModifiedDate.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUtilDateLastModifiedDate.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUtilDateLastModifiedDate.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithUtilDateLastModifiedDate.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithWriteOnlyCreatedBy.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithWriteOnlyCreatedBy.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithWriteOnlyCreatedBy.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithWriteOnlyCreatedBy.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedFields.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedFields.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedFields.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedFields.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedIdGetter.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedIdGetter.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedIdGetter.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/EntityWithoutAnnotatedIdGetter.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ImplicitlyAuditableEntity.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ImplicitlyAuditableEntity.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/ImplicitlyAuditableEntity.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/ImplicitlyAuditableEntity.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/NoAccessorPerson.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/NoAccessorPerson.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/NoAccessorPerson.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/NoAccessorPerson.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/OtherChildZip.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/OtherChildZip.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/OtherChildZip.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/OtherChildZip.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Person.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Person.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/Person.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Person.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleClass.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleClass.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleClass.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleClass.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleEntity.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleEntity.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleEntity.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/SampleEntity.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/State.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/State.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/State.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/State.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Zip.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Zip.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/models/Zip.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/models/Zip.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/AnnotatedInheritingRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/AnnotatedInheritingRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/AnnotatedInheritingRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/AnnotatedInheritingRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ClearableSimpleCrudPersonRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ClearableSimpleCrudPersonRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ClearableSimpleCrudPersonRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ClearableSimpleCrudPersonRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredSimplePersonRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredSimplePersonRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredSimplePersonRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ConfiguredSimplePersonRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ExtendedSimplePersonRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ExtendedSimplePersonRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ExtendedSimplePersonRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/ExtendedSimplePersonRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/MalformedRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/MalformedRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/MalformedRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/MalformedRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/NumberMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/NumberMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/NumberMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/NumberMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryClearerMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryClearerMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryClearerMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryClearerMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryWithValidMethods.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryWithValidMethods.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryWithValidMethods.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/RepositoryWithValidMethods.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SampleAnnotatedRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SampleAnnotatedRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SampleAnnotatedRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SampleAnnotatedRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimpleCrudPersonRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimpleCrudPersonRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimpleCrudPersonRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimpleCrudPersonRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimplePersonRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimplePersonRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimplePersonRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/SimplePersonRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/StringMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/StringMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/StringMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/repositories/StringMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/domain/MappedClass.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/domain/MappedClass.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/domain/MappedClass.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/domain/MappedClass.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/CustomCollectionImplementation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/CustomCollectionImplementation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/CustomCollectionImplementation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/CustomCollectionImplementation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/DefaultInformationExposingRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/DefaultInformationExposingRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/DefaultInformationExposingRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/DefaultInformationExposingRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingCallable.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingCallable.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingCallable.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingCallable.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingImplementation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingImplementation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingImplementation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ErrorThrowingImplementation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/HighPriorityMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/HighPriorityMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/HighPriorityMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/HighPriorityMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithPrivateConstructor.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithPrivateConstructor.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithPrivateConstructor.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithPrivateConstructor.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithoutADefaultConstructor.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithoutADefaultConstructor.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithoutADefaultConstructor.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ImplementationWithoutADefaultConstructor.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingInvocationHandler.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingInvocationHandler.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingInvocationHandler.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingInvocationHandler.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepositoryFactory.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepositoryFactory.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepositoryFactory.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/InformationExposingRepositoryFactory.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/LowerPriorityMapping.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/LowerPriorityMapping.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/LowerPriorityMapping.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/LowerPriorityMapping.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ProperImplementation.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ProperImplementation.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ProperImplementation.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ProperImplementation.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ReturnTypeSampleRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ReturnTypeSampleRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ReturnTypeSampleRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/ReturnTypeSampleRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/converters/NoOpResultConverter.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/converters/NoOpResultConverter.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/converters/NoOpResultConverter.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/converters/NoOpResultConverter.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ChildClass.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ChildClass.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ChildClass.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ChildClass.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/MappedType.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/MappedType.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/MappedType.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/MappedType.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/NoOpQueryDescriptionExtractor.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/NoOpQueryDescriptionExtractor.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/NoOpQueryDescriptionExtractor.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/NoOpQueryDescriptionExtractor.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ProxiedClass.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ProxiedClass.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ProxiedClass.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/ProxiedClass.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SampleMappedRepository.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SampleMappedRepository.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SampleMappedRepository.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SampleMappedRepository.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperClass.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperClass.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperClass.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperClass.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterface.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterface.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterface.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterface.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterfaceImpl.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterfaceImpl.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterfaceImpl.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/proxy/resolvers/SuperInterfaceImpl.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/store/SampleAuditorAware.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/store/SampleAuditorAware.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/store/SampleAuditorAware.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/store/SampleAuditorAware.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithErrorThrowingAccessors.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithErrorThrowingAccessors.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithErrorThrowingAccessors.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithErrorThrowingAccessors.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithFinalId.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithFinalId.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithFinalId.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithFinalId.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithNoGetters.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithNoGetters.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithNoGetters.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithNoGetters.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithPrimitiveField.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithPrimitiveField.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithPrimitiveField.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/sample/usecases/tools/ClassWithPrimitiveField.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListenerTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListenerTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListenerTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditDataEventListenerTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapperTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapperTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapperTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/AuditableWrapperTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java similarity index 92% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java index f993d0a1..6d198af3 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreEventListenerContextTest.java @@ -1,5 +1,6 @@ package com.mmnaseri.utils.spring.data.store.impl; +import com.mmnaseri.utils.spring.data.error.InvalidArgumentException; import com.mmnaseri.utils.spring.data.sample.mocks.AfterInsertEventListener; import com.mmnaseri.utils.spring.data.sample.mocks.AllCatchingEventListener; import com.mmnaseri.utils.spring.data.store.DataStoreEvent; @@ -16,6 +17,12 @@ */ public class DefaultDataStoreEventListenerContextTest { + @Test(expectedExceptions = InvalidArgumentException.class) + public void testTriggeringNullEvent() throws Exception { + DefaultDataStoreEventListenerContext context = new DefaultDataStoreEventListenerContext(); + context.trigger(null); + } + @Test public void testExactEventType() throws Exception { final AfterInsertEventListener first = new AfterInsertEventListener(); diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistryTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistryTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistryTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/DefaultDataStoreRegistryTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStoreTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStoreTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStoreTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/EventPublishingDataStoreTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStoreTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStoreTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStoreTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/MemoryDataStoreTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitorTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitorTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitorTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/PropertyVisitorTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListenerTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListenerTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListenerTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/store/impl/SmartDataStoreEventListenerTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/tools/AbstractUtilityClassTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/AbstractUtilityClassTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/tools/AbstractUtilityClassTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/AbstractUtilityClassTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtilsTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtilsTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtilsTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/CollectionInstanceUtilsTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilterTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilterTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilterTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/GetterMethodFilterTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java similarity index 99% rename from src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java index a43a6372..550f63f4 100644 --- a/src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java +++ b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/PropertyUtilsTest.java @@ -172,7 +172,7 @@ public void testReadingPropertyValueThroughField() throws Exception { final Field id = ReflectionUtils.findField(ClassWithNoGetters.class, "id"); id.setAccessible(true); id.set(object, "1234"); - assertThat(PropertyUtils.getPropertyValue(object, "id"), Matchers.is(id.get(object))); + assertThat(PropertyUtils.getPropertyValue(object, "id"), is(id.get(object))); } @Test(expectedExceptions = IllegalStateException.class) diff --git a/src/test/java/com/mmnaseri/utils/spring/data/tools/StringUtilsTest.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/StringUtilsTest.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/tools/StringUtilsTest.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/tools/StringUtilsTest.java diff --git a/src/test/java/com/mmnaseri/utils/spring/data/utils/TestUtils.java b/spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/utils/TestUtils.java similarity index 100% rename from src/test/java/com/mmnaseri/utils/spring/data/utils/TestUtils.java rename to spring-data-mock/src/test/java/com/mmnaseri/utils/spring/data/utils/TestUtils.java diff --git a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java b/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java deleted file mode 100644 index b10aed48..00000000 --- a/src/main/java/com/mmnaseri/utils/spring/data/domain/impl/DefaultOperatorContext.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.mmnaseri.utils.spring.data.domain.impl; - -import com.mmnaseri.utils.spring.data.domain.Operator; -import com.mmnaseri.utils.spring.data.domain.OperatorContext; -import com.mmnaseri.utils.spring.data.domain.impl.matchers.*; -import com.mmnaseri.utils.spring.data.error.DuplicateOperatorException; - -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; - -/** - * This class is used to store the operators used in the name of a query method. Operators are matched by - * the "suffixes" eagerly (meaning that "EqualTo" will precede over "To"). - * - * @author Milad Naseri (mmnaseri@programmer.net) - * @since 1.0 (9/29/15) - */ -public class DefaultOperatorContext implements OperatorContext { - - private final Set operators; - - public DefaultOperatorContext() { - operators = new CopyOnWriteArraySet<>(); - operators.add(new ImmutableOperator("AFTER", 1, new IsGreaterThanMatcher(), "After", "IsAfter")); - operators.add(new ImmutableOperator("BEFORE", 1, new IsLessThanMatcher(), "Before", "IsBefore")); - operators.add(new ImmutableOperator("CONTAINING", 1, new ContainingMatcher(), "Containing", "IsContaining", "Contains")); - operators.add(new ImmutableOperator("BETWEEN", 2, new IsBetweenMatcher(), "Between", "IsBetween")); - operators.add(new ImmutableOperator("NOT_BETWEEN", 2, new IsNotBetweenMatcher(), "NotBetween", "IsNotBetween")); - operators.add(new ImmutableOperator("ENDING_WITH", 1, new EndingWithMatcher(), "EndingWith", "IsEndingWith", "EndsWith")); - operators.add(new ImmutableOperator("FALSE", 0, new IsFalseMatcher(), "False", "IsFalse")); - operators.add(new ImmutableOperator("GREATER_THAN", 1, new IsGreaterThanMatcher(), "GreaterThan", "IsGreaterThan")); - operators.add(new ImmutableOperator("GREATER_THAN_EQUALS", 1, new IsGreaterThanOrEqualToMatcher(), "GreaterThanEqual", "IsGreaterThanEqual")); - operators.add(new ImmutableOperator("IN", 1, new IsInMatcher(), "In", "IsIn")); - operators.add(new ImmutableOperator("IS", 1, new IsEqualToMatcher(), "Is", "EqualTo", "IsEqualTo", "Equals")); - operators.add(new ImmutableOperator("NOT_NULL", 0, new IsNotNullMatcher(), "NotNull", "IsNotNull")); - operators.add(new ImmutableOperator("NULL", 0, new IsNullMatcher(), "Null", "IsNull")); - operators.add(new ImmutableOperator("LESS_THAN", 1, new IsLessThanMatcher(), "LessThan", "IsLessThan")); - operators.add(new ImmutableOperator("LESS_THAN_EQUAL", 1, new IsLessThanOrEqualToMatcher(), "LessThanEqual", "IsLessThanEqual")); - operators.add(new ImmutableOperator("LIKE", 1, new IsLikeMatcher(), "Like", "IsLike")); - operators.add(new ImmutableOperator("NEAR", 1, null, "Near", "IsNear")); - operators.add(new ImmutableOperator("NOT", 1, new IsNotMatcher(), "IsNot", "Not", "IsNotEqualTo", "DoesNotEqual")); - operators.add(new ImmutableOperator("NOT_IN", 1, new IsNotInMatcher(), "NotIn", "IsNotIn")); - operators.add(new ImmutableOperator("NOT_LIKE", 1, new IsNotLikeMatcher(), "NotLike", "IsNotLike")); - operators.add(new ImmutableOperator("REGEX", 1, new RegexMatcher(), "Regex", "MatchesRegex", "Matches")); - operators.add(new ImmutableOperator("STARTING_WITH", 1, new StartingWithMatcher(), "StartingWith", "IsStartingWith", "StartsWith")); - operators.add(new ImmutableOperator("TRUE", 0, new IsTrueMatcher(), "True", "IsTrue")); - } - - @Override - public void register(Operator operator) { - for (Operator item : operators) { - for (String token : item.getTokens()) { - for (String newToken : operator.getTokens()) { - if (newToken.equals(token)) { - throw new DuplicateOperatorException(item, token); - } - } - } - } - operators.add(operator); - } - - @Override - public Operator getBySuffix(String suffix) { - for (Operator operator : operators) { - for (String token : operator.getTokens()) { - if (token.equals(suffix)) { - return operator; - } - } - } - return null; - } - -}