GithubHelp home page GithubHelp logo

mmnaseri / spring-data-mock Goto Github PK

View Code? Open in Web Editor NEW
135.0 12.0 44.0 2.4 MB

Mock facility for Spring Data repositories

License: MIT License

Java 99.61% Shell 0.38% Dockerfile 0.01%
spring-data mocking database java testing unit-testing repository

spring-data-mock's Introduction

Spring Data Mock

Donae MIT license Maven Central Build Status Codacy Badge Coverage Status


This is a fairly flexible, versatile framework for mocking Spring Data repositories. Spring Data provides a very good foundation for separating the concerns of managing a database and its subsequently resulting queries from those of the business layer.

This is great for writing services. They only need to depend upon Spring Data repositories and manage their data through this level of indirection. This, however, means that for testing purposes, you will either have to write lots of boilerplate code for your Spring powered application, or you will have to start up a full blown application context with a backing database.

For most test cases, this is entirely unnecessary and, moreover, creates time burdens and takes away valuable time from productive tasks. This is why I decided to write this framework: to avoid the unnecessary effort, and to have a reliable infrastructure replicating what Spring would do with an actual database, only in-memory. This will allow for mocking the repository with actual data. Thus, you can test your services without having to start up the application context, and with the highest level of isolation -- with actual data.

Downloading

You can either clone this project and start using it:

$ git clone https://github.com/mmnaseri/spring-data-mock.git

or you can add a maven dependency since it is now available in Maven central:

<dependency>
    <groupId>com.mmnaseri.utils</groupId>
    <artifactId>spring-data-mock</artifactId>
    <version>${spring-data-mock.version}</version>
    <scope>test</scope>
</dependency>

Note on Dependencies

Spring Data Mock depends on Apache Commons Logging to log all the interactions with the framework. If you need to, you can exclude this dependency from the framework by using Maven exclusions:

    <dependency>
        <groupId>com.mmnaseri.utils</groupId>
        <artifactId>spring-data-mock</artifactId>
        <version>${spring-data-mock.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Quick Start

Regardless of how you add the necessary dependency to your project, mocking a repository can be as simple as:

final UserRepository repository = builder().mock(UserRepository.class);

where builder() is a static method of the RepositoryFactoryBuilder class under package com.mmnaseri.utils.spring.data.dsl.factory.

Example:

import com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder;

public class CustomerRepositoryTest {

    @Test
    public void testDemo() {

        final CustomerRepository repository = RepositoryFactoryBuilder.builder().mock(CustomerRepository.class);
        repository.save(new Customer());

An alternate way of mocking a repository would be by using the RepositoryMockBuilder class under the com.mmnaseri.utils.spring.data.dsl.mock package:

final RepositoryFactoryConfiguration configuration = ... ;
final UserRepository repository = new RepositoryMockBuilder().useConfiguration(configuration).mock(UserRepository.class);

Documentation

For a complete documentation check out the website.

There you can get more information on how to download the framework, as well as how you can incorporate it in your project to have hassle-free data store mocking capabilities added to your shiny applications.

Breaking Changes since v2.0

v2.0 introduces compatibility with Spring Boot 2.0, but also creates some incompatibilities with prior versions.

  • As well it should, it is now adopting all the new method signatures for the new Spring Data, meaning that those are now automatic breaking changes.
  • The library now runs on Java 8+, meaning we do not support JDK 7 anymore.

History

  • 2.0 Upgrade to Spring Boot 2.0 (many thanks to binakot@). This is a major release and breaks some stuff.

  • 1.1 Add QueryDSL and findByExample support

see site changelog

FAQ

  1. Why did you write this?

I was testing some pretty complicated services that relied on Spring Data to provide data. It was a lot of hassle to keep the test environment up-to-date with the test requirements as well as the real world situation. Also, it was pretty darn slow to run the tests, given database connection latency and all. I wanted to be able to isolate my services and test them regardless of the database features. To make it short, I wrote this framework to be able to separate integration/acceptance tests and unit tests.

  1. Why did you make this open source?

Because everything I use (or nearly so) in my line of work is open source. It was time I gave something back. Also, the people behind Spring rock. I felt like I was selling tickets to the concert of rockstars by releasing this.

  1. What is the main design principle behind this framework?

Make you do as little as possible.

  1. When should I use this?

You should only use this to write your unit tests. For anything else, you would want the whole application to come alive and work. Using mocks for that is a bad idea.

  1. This is going to be used at the level of code testing. Is it really well written?

It is. According to Cobertura, it has 100% code coverage, and according to Codacy, it has 0 code issues. It is maintained by myself the best I can. The rest is up to you.

Some Numbers and Facts

  • This project has 1000+ individual unit tests.

  • This project has effective 100% (deprecated code is not tested) code coverage

  • This project has 95% branch coverage rate.

  • The project issue response turn around is an average of 2 days.

  • It covers all the repository specifications in Spring Data Commons (except predicates -- support is planned).

  • It has more than 6k lines of code, a lot of which is unit tests.

  • Every public class or method has JavaDoc

  • There is a dedicated documentation website for this project at https://mmnaseri.github.io/spring-data-mock/

Contribution

Since this project aims to help you in the testing phase of your code, it is paramount that it is written with the best of qualities and that it maintains the highest standard.

Contributors are more than welcome. In fact, I flag most of the issues I receive as help wanted and there are really generous people out there who do take care of some issues.

If you see a piece of code that you don't like for whatever reason -- so long as that reason can be backed by pioneers and standards -- feel free to dig in and change the code to your heart's content and create a pull request.

Building the Code

To make the code builds universal and canonical, I have a Docker configuration attached to this project which installs OpenJDK 8 on Ubuntu Xenial. This is the build environment I will be using to test and release the code.

docker build -t spring-data-mock:jdk8 .
docker run -it --rm -v $(pwd):/src spring-data-mock:jdk8

Donation

This software is written without any expectations. I developed this originally to solve a business need at the company I was working at at the time, and then rewrote it for the purpose of open-sourcing it.

After it received some attention, I decided that I should sit down and redo it.

That is why I did a marathon development on it, and got it to a point where I could say it was safe for public use.

It still has a lot of room for improvement and enhancements. Even though I will continue to develop and maintain this framework, receiving donations would make it feel so much more real.

If you feel generous and want to buy me a cup of coffee, you can use my PayPal link: https://paypal.me/mmnaseri

Thank you in advance if you choose to donate! And if not, I hope you have some time to explore this framework and give me feedback so that I can make it better.

spring-data-mock's People

Contributors

benoitaverty avatar binakot avatar blackleg avatar hectorespert avatar joshsh avatar mateuszstefek avatar mmnaseri avatar usr42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-data-mock's Issues

Fix the issue where JPA annotations aren't honored

Unit test below fails

com.mmnaseri.utils.spring.data.error.NoIdPropertyException: No id property could be resolved for type class com.bee2c.platform.entity.FbpMbpPolicy
    at com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver.resolve(EntityIdPropertyResolver.java:55)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolveIdProperty(AbstractRepositoryMetadataResolver.java:69)
    at com.mmnaseri.utils.spring.data.domain.impl.AssignableRepositoryMetadataResolver.resolveFromInterface(AssignableRepositoryMetadataResolver.java:29)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolve(AbstractRepositoryMetadataResolver.java:49)
    at com.mmnaseri.utils.spring.data.domain.impl.DefaultRepositoryMetadataResolver.resolveFromInterface(DefaultRepositoryMetadataResolver.java:34)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolve(AbstractRepositoryMetadataResolver.java:49)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:97)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at com.bee2c.platform.MbpDatabaseRelationsTest.testDemo(MbpDatabaseRelationsTest.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Entity

@Entity
@Table(name = "fbp_mbp_policy")
public class FbpMbpPolicy extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "mbp_policy_id")
    private Long mbpPolicyId;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.bee2c.platform.entity.FbpMbpPolicy;
import com.bee2c.platform.entity.FbpMbpPolicyDate;
import com.bee2c.platform.repository.FbpMbpPolicyDateRepository;
import com.bee2c.platform.repository.FbpMbpPolicyRepository;

import com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder;

public class MbpDatabaseRelationsTest {

    private static final Logger log = LoggerFactory.getLogger(MbpDatabaseRelationsTest.class);


    @Test
    public void testDemo() {

        final FbpMbpPolicyRepository repository = RepositoryFactoryBuilder.builder().mock(FbpMbpPolicyRepository.class);
        final FbpMbpPolicyDateRepository policyDateRepository = RepositoryFactoryBuilder.builder().mock(FbpMbpPolicyDateRepository.class);

        FbpMbpPolicy policy = new FbpMbpPolicy();
        repository.save(policy);
        log.info(policy.toString());

        FbpMbpPolicyDate policyDate = new FbpMbpPolicyDate();
        policyDate.setMbpPolicy(policy);
        policyDateRepository.save(policyDate);
        log.info(policyDate.toString());

        FbpMbpPolicyDate policyDate2 = new FbpMbpPolicyDate();
        policyDate2.setMbpPolicy(policy);
        policyDateRepository.save(policyDate2);
        log.info(policyDate2.toString());


    }

}

1.1.2 Support case: custom behavior to all repositories

It looks like custom implementation for base repository is not supported

While of cause this can't be mocked, the project should warn and ignore, but not fail

com.mmnaseri.utils.spring.data.error.DataOperationDefinitionException: Encountered an error while resolving operation metadata: public abstract java.util.List com.bee2c.platform.repository.ExtendedJpaRepository.findByCon(java.lang.String,java.util.Map)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:45)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInvocationMappings(DefaultRepositoryFactory.java:210)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInstance(DefaultRepositoryFactory.java:76)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:103)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:101)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at com.bee2c.platform.MbpDatabaseRelationsTestManual.testDemo(MbpDatabaseRelationsTestManual.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.mmnaseri.utils.spring.data.error.QueryParserException: interface com.bee2c.platform.repository.ExtendedJpaRepository: Could not find property `con` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.getPropertyDescriptor(MethodQueryDescriptionExtractor.java:264)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.parseExpression(MethodQueryDescriptionExtractor.java:206)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.extract(MethodQueryDescriptionExtractor.java:134)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver.resolve(QueryMethodDataOperationResolver.java:53)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:43)
    ... 29 more
Caused by: java.lang.IllegalStateException: Could not find property `con` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.tools.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:217)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.getPropertyDescriptor(MethodQueryDescriptionExtractor.java:262)
    ... 33 more


http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.custom-behaviour-for-all-repositories

package com.bee2c.platform.repository;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;

@NoRepositoryBean
public interface ExtendedJpaRepository<T, ID extends Serializable> 
    extends PagingAndSortingRepository<T, ID> {

    public List<T> findByCon(String jpql, Map<String, Object> map);

    public List<T> findByCon(String jpql, Object... para);

}
package com.bee2c.platform.repository;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;

/**
 * docs
 * http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#
 * repositories.custom-behaviour-for-all-repositories
 * 
 * @author Paul Verest
 *
 */
public class ExtendedJpaRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
        implements ExtendedJpaRepository<T, ID> {

    private final EntityManager em; 

    public ExtendedJpaRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) {
        super(entityInformation, entityManager);

        // Keep the EntityManager around to be used from the newly introduced
        // methods.
        this.em = entityManager;
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<T> findByCon(String jpql, Map<String, Object> map) {
        Query query = em.createQuery(jpql);
        for (String key : map.keySet()) {
            query.setParameter(key, map.get(key));
        }
        return query.getResultList();
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<T> findByCon(String jpql, Object... paras) {
        Query query = em.createQuery(jpql);
        for (int i = 0; i < paras.length; i++) {
            Object para = paras[i];
            query.setParameter(i + 1, para);
        }
        return query.getResultList();
    }

}

Add proper exception handling to the project

Right now, all exceptions are pretty generic (IllegalStateException, etc.). This needs to be replaced with exceptions that are indicative of framework failure, rather than base code failure so that users can separate the two when writing tests.

Add `.configure()` to `RepositoryFactoryBuilder` DSL

The RepositoryFactoryBuilder is internally creating and maintaining an instance of RepositoryFactoryConfiguration. It would be useful to have this configuration made available to the users so that they can build on top of it, reuse, and even modify it outside the DSL.

java.lang.IllegalStateException when destroying Bean that is a mock of a repository

I am using spring to inject a mock created with this project into a context. Here is the configuration class:

@Configuration
@Import(OrderApplication.class)
@ComponentScan("com.example.unit.testing.domain")
class OrderApplicationTestContext {

    @Bean
    OrderRepository orderRepository() {
        return builder()
                .generateKeysUsing(RandomLongKeyGenerator.class)
                .mock(OrderRepository.class);
    }

    @Bean
    CustomerRepository customerRepository() {
        return builder()
                .generateKeysUsing(RandomLongKeyGenerator.class)
                .mock(CustomerRepository.class);
    }

}

It works fine and my test pass. However, when this spring context is destroyed, an exception is thrown by the destroyMethod:

2016-04-08 13:47:56.015 ERROR 23753 --- [       Thread-1] o.s.b.f.s.DefaultListableBeanFactory     : Destroy method on bean with name 'orderRepository' threw an exception

java.lang.IllegalStateException: No operation mapping found for method public native int java.lang.Object.hashCode()
    at com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler.invoke(DataOperationInvocationHandler.java:56) ~[spring-data-mock-1.0.jar:na]
    at com.sun.proxy.$Proxy27.hashCode(Unknown Source) ~[na:na]
    at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106) ~[na:1.8.0_77]
    at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097) ~[na:1.8.0_77]
    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:374) ~[spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:243) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:972) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:901) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]

Do you know what might be causing this ?

Restructure the project

I need to restructure the project. This is what it currently looks like:

spring-data-mock
 :  pom.xml
 :  deployment scripts and tools

This is what I need it to look like:

spring-data-mock
 :   deploy
 :    :  deployment scripts and tools
 :   spring-data-mock-build
 :    :  pom.xml
 :   spring-data-mock
 :    :  pom.xml
 :   spring-data-mock-sample
 :    :  pom.xml

This will let me create a co-dependent sample project that illustrates the uses of the framework, without imposing anything on the developers cloning the repository or releasing the code.

Spread the word, give a talk

Currently I can't recommend this project as if fails from start on simplest cases #83 #84

However over time it will be fine, and good shape for new users.

Then would you give a (remote) talk for Shenzhen Java User Group http://szjug.github.io/ ?
I guess Spring Boot themed meeting would be great fit.

Can't make logger output less with logging.level.com.mmnaseri=ERROR in Eclipse IDE Mars.2

First, hooray

MongoDB example works out of box with Spring-Boot (taking http://spring.io/guides/gs/accessing-data-mongodb as starting point)

Now, when looking into console, there is too many things logged at INFO level.
And I can't disable it.

src\test\resources\application.properties

logging.level.com.mmnaseri=ERROR

Code

package com.example.spring.mongodb;

import static org.junit.Assert.*;

import org.junit.Test;

import com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder;


public class CustomerRepositoryTest {

    @Test
    public void testItWorks() {
        CustomerRepository repository = RepositoryFactoryBuilder.builder().mock(CustomerRepository.class);

        repository.deleteAll();

        // save a couple of customers
        repository.save(new Customer("Alice", "Smith"));
        repository.save(new Customer("Bob", "Smith"));

        // fetch all customers
        System.out.println("Customers found with findAll():");
        System.out.println("-------------------------------");
        for (Customer customer : repository.findAll()) {
            System.out.println(customer);
        }
        System.out.println();

        // fetch an individual customer
        System.out.println("Customer found with findByFirstName('Alice'):");
        System.out.println("--------------------------------");
        System.out.println(repository.findByFirstName("Alice"));

        System.out.println("Customers found with findByLastName('Smith'):");
        System.out.println("--------------------------------");
        for (Customer customer : repository.findByLastName("Smith")) {
            System.out.println(customer);
        }

    }
}

Output

19:41:54.502 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DefaultOperatorContext - Registering all the default operators
19:41:54.515 [main] INFO com.mmnaseri.utils.spring.data.query.impl.DefaultDataFunctionRegistry - Registering the default functions
19:41:54.515 [main] INFO com.mmnaseri.utils.spring.data.query.impl.DefaultDataFunctionRegistry - Registering function with name count
19:41:54.516 [main] INFO com.mmnaseri.utils.spring.data.query.impl.DefaultDataFunctionRegistry - Registering function with name delete
19:41:54.526 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultTypeMappingContext - Trying to register all the default type mappings
19:41:54.532 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultTypeMappingContext - Registering implementation class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository to super type class java.lang.Object; this means any repository of this type will inherit functionality defined in the bound implementation class.
19:41:54.534 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultTypeMappingContext - Registering implementation class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository to super type class java.lang.Object; this means any repository of this type will inherit functionality defined in the bound implementation class.
19:41:54.535 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.NonDataOperationInvocationHandler - Registering all the default operation handlers
19:41:54.568 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DefaultRepositoryMetadataResolver - 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
19:41:54.570 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver - Trying to resolve the ID property for entity class com.example.spring.mongodb.Customer using the annotated getter method
19:41:54.573 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.576 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.577 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.578 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.578 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver - Trying to resolve the ID property for entity class com.example.spring.mongodb.Customer using the annotated ID field
19:41:54.579 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.581 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.581 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.584 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - We are going to create a proxy instance of type interface com.example.spring.mongodb.CustomerRepository using key generator com.mmnaseri.utils.spring.data.domain.impl.key.UUIDKeyGenerator@73846619 and binding the implementations to []
19:41:54.584 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Resolving repository metadata for interface com.example.spring.mongodb.CustomerRepository
19:41:54.584 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DefaultRepositoryMetadataResolver - 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
19:41:54.585 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver - Trying to resolve the ID property for entity class com.example.spring.mongodb.Customer using the annotated getter method
19:41:54.585 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.586 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.586 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.587 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.587 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver - Trying to resolve the ID property for entity class com.example.spring.mongodb.Customer using the annotated ID field
19:41:54.587 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.588 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.588 [main] DEBUG com.mmnaseri.utils.spring.data.domain.impl.id.IdPropertyResolverUtils - Requested ID annotation type javax.persistence.Id is not present in the classpath
19:41:54.588 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Resolving the data store for interface com.example.spring.mongodb.CustomerRepository
19:41:54.590 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreRegistry - Registering a data store for type class com.example.spring.mongodb.Customer
19:41:54.590 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Trying to find all the proper type mappings for entity repository interface com.example.spring.mongodb.CustomerRepository
19:41:54.597 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultTypeMappingContext - The repository interface com.example.spring.mongodb.CustomerRepository is bound to implementations [class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository, class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository]
19:41:54.601 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Trying to find all the invocation mappings for methods declared on interface com.example.spring.mongodb.CustomerRepository
19:41:54.601 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String)
19:41:54.601 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.601 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String) by going through the previously set up type mappings
19:41:54.601 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findByFirstName' with parameter types [class java.lang.String] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.601 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findByFirstName' with parameter types [class java.lang.String] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.601 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.602 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.607 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String)
19:41:54.607 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.607 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String) by going through the previously set up type mappings
19:41:54.607 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findByLastName' with parameter types [class java.lang.String] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.607 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findByLastName' with parameter types [class java.lang.String] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.607 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.607 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.608 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.save(java.lang.Iterable)
19:41:54.608 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.608 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.save(java.lang.Iterable) by going through the previously set up type mappings
19:41:54.608 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.608 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.608 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Object org.springframework.data.mongodb.repository.MongoRepository.insert(java.lang.Object)
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Object org.springframework.data.mongodb.repository.MongoRepository.insert(java.lang.Object) by going through the previously set up type mappings
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'insert' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'insert' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.insert(java.lang.Iterable)
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.insert(java.lang.Iterable) by going through the previously set up type mappings
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'insert' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'insert' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll()
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll() by going through the previously set up type mappings
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.609 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.609 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll(org.springframework.data.domain.Sort)
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll(org.springframework.data.domain.Sort) by going through the previously set up type mappings
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [class org.springframework.data.domain.Sort] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.PagingAndSortingRepository.findAll(org.springframework.data.domain.Sort)
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.PagingAndSortingRepository.findAll(org.springframework.data.domain.Sort) by going through the previously set up type mappings
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [class org.springframework.data.domain.Sort] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract org.springframework.data.domain.Page org.springframework.data.repository.PagingAndSortingRepository.findAll(org.springframework.data.domain.Pageable)
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract org.springframework.data.domain.Page org.springframework.data.repository.PagingAndSortingRepository.findAll(org.springframework.data.domain.Pageable) by going through the previously set up type mappings
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [interface org.springframework.data.domain.Pageable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract long org.springframework.data.repository.CrudRepository.count()
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract long org.springframework.data.repository.CrudRepository.count() by going through the previously set up type mappings
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'count' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'count' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.lang.Object)
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.lang.Object) by going through the previously set up type mappings
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.lang.Iterable)
19:41:54.610 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.610 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.lang.Iterable) by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.io.Serializable)
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract void org.springframework.data.repository.CrudRepository.delete(java.io.Serializable) by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'delete' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object)
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object) by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [class java.lang.Object] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.save(java.lang.Iterable)
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.save(java.lang.Iterable) by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'save' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract boolean org.springframework.data.repository.CrudRepository.exists(java.io.Serializable)
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract boolean org.springframework.data.repository.CrudRepository.exists(java.io.Serializable) by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'exists' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'exists' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract void org.springframework.data.repository.CrudRepository.deleteAll()
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract void org.springframework.data.repository.CrudRepository.deleteAll() by going through the previously set up type mappings
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'deleteAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'deleteAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.611 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.findAll(java.lang.Iterable)
19:41:54.611 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.612 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.findAll(java.lang.Iterable) by going through the previously set up type mappings
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [interface java.lang.Iterable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.findAll()
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Iterable org.springframework.data.repository.CrudRepository.findAll() by going through the previously set up type mappings
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findAll' with parameter types [] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver@2b2948e2
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver - Extracting query description from the method by parsing the method
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Resolving the data operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.findOne(java.io.Serializable)
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver - Attempting to resolve the method call using resolver com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver@335eadca
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Trying to resolve the data operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.findOne(java.io.Serializable) by going through the previously set up type mappings
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findOne' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultPagingAndSortingRepository
19:41:54.613 [main] DEBUG com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Attempting to look for the actual declaration of the method named 'findOne' with parameter types [interface java.io.Serializable] on the child type class com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository
19:41:54.613 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.resolvers.SignatureDataOperationResolver - Setting the resolution as a method invocation on the previously prepared type mapping
19:41:54.617 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Instantiating the proxy using the provided configuration
19:41:54.620 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Injecting all the required dependencies into the repository mapping implementations
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory - Injecting all the required dependencies into the repository mapping implementations
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract void org.springframework.data.repository.CrudRepository.deleteAll() has been intercepted. We will now try to find an appropriate invocation.
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract void org.springframework.data.repository.CrudRepository.deleteAll()
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.MethodInvocationDataStoreOperation - Invoking method public java.lang.Iterable com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository.deleteAll() to handle invocation public abstract void org.springframework.data.repository.CrudRepository.deleteAll(), null
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository - Attempting to delete all entities at once
19:41:54.621 [main] DEBUG com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository - There are 0 entities altogether in the data store that are going to be deleted
19:41:54.621 [main] DEBUG com.mmnaseri.utils.spring.data.repository.DefaultCrudRepository - There are 0 keys remaining in the data store after the delete operation
19:41:54.621 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type void
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object) has been intercepted. We will now try to find an appropriate invocation.
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object)
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.MethodInvocationDataStoreOperation - Invoking method public java.lang.Object com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport.save(java.lang.Object) to handle invocation public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object), [Customer[id=null, firstName='Alice', lastName='Smith']]
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The entity that is to be saved has a key with value null
19:41:54.622 [main] INFO com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The key was null, but the generator was not, so we are going to get a key for the entity
19:41:54.702 [main] DEBUG com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The generated key for the entity was 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.702 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Looking for an object with key 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.702 [main] INFO com.mmnaseri.utils.spring.data.store.impl.EventPublishingDataStore - About to insert a new entity in the data store under key 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.703 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.BeforeInsertDataStoreEvent
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Going to trigger the same event on the parent context
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.BeforeInsertDataStoreEvent
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Attempting to save entity with key 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.704 [main] DEBUG com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Entity was saved under key 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.EventPublishingDataStore - Finished inserting the entity in the data store under key 4a56c9d3-8c52-478c-8dd2-37c3dd1d964a
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.AfterInsertDataStoreEvent
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Going to trigger the same event on the parent context
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.AfterInsertDataStoreEvent
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type class java.lang.Object
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object) has been intercepted. We will now try to find an appropriate invocation.
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object)
19:41:54.704 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.MethodInvocationDataStoreOperation - Invoking method public java.lang.Object com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport.save(java.lang.Object) to handle invocation public abstract java.lang.Object org.springframework.data.repository.CrudRepository.save(java.lang.Object), [Customer[id=null, firstName='Bob', lastName='Smith']]
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The entity that is to be saved has a key with value null
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The key was null, but the generator was not, so we are going to get a key for the entity
19:41:54.705 [main] DEBUG com.mmnaseri.utils.spring.data.repository.CrudRepositorySupport - The generated key for the entity was 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Looking for an object with key 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.EventPublishingDataStore - About to insert a new entity in the data store under key 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.BeforeInsertDataStoreEvent
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Going to trigger the same event on the parent context
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.BeforeInsertDataStoreEvent
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Attempting to save entity with key 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] DEBUG com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Entity was saved under key 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.EventPublishingDataStore - Finished inserting the entity in the data store under key 9bece220-abd8-4763-9d04-9e102ea5d427
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.AfterInsertDataStoreEvent
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Going to trigger the same event on the parent context
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.DefaultDataStoreEventListenerContext - Triggering data store event of type class com.mmnaseri.utils.spring.data.store.impl.AfterInsertDataStoreEvent
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type class java.lang.Object
Customers found with findAll():
-------------------------------
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll() has been intercepted. We will now try to find an appropriate invocation.
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll()
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - Trying to select the data from the data store
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Selecting the data according to the provided selection descriptor: []
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Retrieving all entities from the data store
19:41:54.705 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith'] against public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll(), null
19:41:54.707 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=9bece220-abd8-4763-9d04-9e102ea5d427, firstName='Bob', lastName='Smith'] against public abstract java.util.List org.springframework.data.mongodb.repository.MongoRepository.findAll(), null
19:41:54.707 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Matched 2 items from the data store
19:41:54.707 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - No function was specified for the current selection
19:41:54.707 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.707 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type interface java.util.List
Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith']
Customer[id=9bece220-abd8-4763-9d04-9e102ea5d427, firstName='Bob', lastName='Smith']

Customer found with findByFirstName('Alice'):
--------------------------------
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String) has been intercepted. We will now try to find an appropriate invocation.
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String)
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - Trying to select the data from the data store
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Selecting the data according to the provided selection descriptor: [[(firstName,IS,[0],[])]]
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Retrieving all entities from the data store
19:41:54.708 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith'] against public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String), [Alice]
19:41:54.764 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=9bece220-abd8-4763-9d04-9e102ea5d427, firstName='Bob', lastName='Smith'] against public abstract com.example.spring.mongodb.Customer com.example.spring.mongodb.CustomerRepository.findByFirstName(java.lang.String), [Alice]
19:41:54.764 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Matched 1 items from the data store
19:41:54.764 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - No function was specified for the current selection
19:41:54.764 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.765 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type class com.example.spring.mongodb.Customer
Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith']
Customers found with findByLastName('Smith'):
--------------------------------
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - A method call to public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String) has been intercepted. We will now try to find an appropriate invocation.
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Executing the operation for method public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String)
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - Trying to select the data from the data store
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Selecting the data according to the provided selection descriptor: [[(lastName,IS,[0],[])]]
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.store.impl.MemoryDataStore - Retrieving all entities from the data store
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith'] against public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String), [Smith]
19:41:54.766 [main] INFO com.mmnaseri.utils.spring.data.domain.InvocationMatcher - Matching Customer[id=9bece220-abd8-4763-9d04-9e102ea5d427, firstName='Bob', lastName='Smith'] against public abstract java.util.List com.example.spring.mongodb.CustomerRepository.findByLastName(java.lang.String), [Smith]
19:41:54.767 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.SelectDataStoreOperation - Matched 2 items from the data store
19:41:54.767 [main] INFO com.mmnaseri.utils.spring.data.domain.impl.DescribedDataStoreOperation - No function was specified for the current selection
19:41:54.767 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DataOperationInvocationHandler - Trying to see if any conversion is necessary on the object
19:41:54.767 [main] INFO com.mmnaseri.utils.spring.data.proxy.impl.DefaultResultAdapterContext - Adapting the result of invocation to type interface java.util.List
Customer[id=4a56c9d3-8c52-478c-8dd2-37c3dd1d964a, firstName='Alice', lastName='Smith']
Customer[id=9bece220-abd8-4763-9d04-9e102ea5d427, firstName='Bob', lastName='Smith']

Error: java.lang.reflect.InvocationTargetException

Hi,

I am getting this error when I try to save the User entities in the mocked repository. I cannot use DBUnit, since I need to test entities with dynamic data (ex: lastSeen timestamp), so spring-data-mock is perfect for my use case.

Here the error.

https://i.imgur.com/AYzPWLl.png

`User u = new User();
u.setName("admin");
u.setFirstName("admin");
u.setEmail("[email protected]");
u.lastSeen(new Date().getTime());

UserRepository repo = RepositoryMock
.forRepository(UserRepository.class,"id", KeyGeneration.NONE)
.mock();
repo.save(u);`

The User class extends the AbstractEntity, where the ID (readonly) is generated. UserRepository contains methods with @query annotations as well.

My tech stack is Spring-Data on top of Hibernate, Jackson and Lombok.

Do you have any clou why this error is generated, or in what direction I need looking into?

Thanks

M.

To give note about `commons-logging` dependency?

        <dependency>
            <groupId>com.mmnaseri.utils</groupId>
            <artifactId>spring-data-mock</artifactId>
            <version>1.0.3</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

or with maven-enforcer-plugin config as below, build of cause fails over commons-logging dependency

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.3.1</version>
                <executions>
                    <execution>
                        <id>enforce-version</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration><!-- as in spring-boot-starters pom -->
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <!-- exclude all log4j:log4j, commons-logging -->                                   
                                        <exclude>log4j:log4j:[0.0,9)</exclude>
                                        <exclude>commons-logging:*:*</exclude>
                                    </excludes>
                                    <searchTransitive>true</searchTransitive>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

Increase test coverage

At the moment, the main culprit in test coverage is the ~.string.* package which has code borrowed from couteau

I will need to add tests to this in the interim, and move it out and back to couteau in the long run (when I get to do a release of coueau)

Add samples outlining configuration scope

As #94 indicates, the current behavior (which let's you customize features for the factory and later override it on a per-repository basis) is not immediately obvious.

There should be samples that elaborate this feature.

Problem: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Callback

error why running JUnit.

Note that I am not using querydsl at all, see code at #56

java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Callback
    at com.querydsl.core.alias.Alias.<clinit>(Alias.java:58)
    at com.mmnaseri.utils.spring.data.repository.DefaultQueryDslPredicateExecutor.setDataStore(DefaultQueryDslPredicateExecutor.java:60)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getTypeMappings(DefaultRepositoryFactory.java:137)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInstance(DefaultRepositoryFactory.java:69)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:103)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:101)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at com.bee2c.platform.MbpDatabaseRelationsTestManual.testDemo(MbpDatabaseRelationsTestManual.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 31 more


and code

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.bee2c.platform.entity.FbpMbpPolicy;
import com.bee2c.platform.entity.FbpMbpPolicyDate;
import com.bee2c.platform.repository.FbpMbpPolicyDateRepository;
import com.bee2c.platform.repository.FbpMbpPolicyRepository;

import com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder;

public class MbpDatabaseRelationsTestManual {

    private static final Logger log = LoggerFactory.getLogger(MbpDatabaseRelationsTestManual.class);


    @Test
    public void testDemo() {

        final FbpMbpPolicyRepository repository = RepositoryFactoryBuilder.builder().mock(FbpMbpPolicyRepository.class);
        final FbpMbpPolicyDateRepository policyDateRepository = RepositoryFactoryBuilder.builder().mock(FbpMbpPolicyDateRepository.class);

        FbpMbpPolicy policy = new FbpMbpPolicy();
        repository.save(policy);
        log.info(policy.toString());

        FbpMbpPolicyDate policyDate = new FbpMbpPolicyDate();
        policyDate.setMbpPolicy(policy);
        policyDateRepository.save(policyDate);
        log.info(policyDate.toString());

        FbpMbpPolicyDate policyDate2 = new FbpMbpPolicyDate();
        policyDate2.setMbpPolicy(policy);
        policyDateRepository.save(policyDate2);
        log.info(policyDate2.toString());


    }

Allow for specifying a fallback key generator on a per-application basis

As started in #84 (comment)

makes the assumption that ID generation starts at 1L

        final CustomerRepository repository = RepositoryFactoryBuilder.builder()
                .mock(CustomerRepository.class);
        repository.save(new Customer());

        Customer c = repository.findOne(1L);

I would prefer to specify that Hibernate is used, and have default to start from 1.
And possibly more.

Please leave this open for other people to comment.

Add samples to the project

There should be sample JUnits to demo what works (and what yet not)

One of sample can be use case in #78 #69 #54

In other words, some end user oriented examples

Add support for querying entities by example

com.mmnaseri.utils.spring.data.error.DataOperationDefinitionException: Encountered an error while resolving operation metadata: public abstract java.util.List com.bee2c.platform.repository.FbpMbpPolicyRepositoryCustom.findByExample(com.bee2c.platform.entity.FbpMbpPolicy)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:45)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInvocationMappings(DefaultRepositoryFactory.java:210)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInstance(DefaultRepositoryFactory.java:76)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:103)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:101)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at com.bee2c.platform.MbpDatabaseRelationsTest.testDemo(MbpDatabaseRelationsTest.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.mmnaseri.utils.spring.data.error.QueryParserException: interface com.bee2c.platform.repository.FbpMbpPolicyRepositoryCustom: Could not find property `example` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.domain.impl.QueryDescriptionExtractor.getPropertyDescriptor(QueryDescriptionExtractor.java:263)
    at com.mmnaseri.utils.spring.data.domain.impl.QueryDescriptionExtractor.parseExpression(QueryDescriptionExtractor.java:205)
    at com.mmnaseri.utils.spring.data.domain.impl.QueryDescriptionExtractor.extract(QueryDescriptionExtractor.java:133)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver.resolve(QueryMethodDataOperationResolver.java:53)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:43)
    ... 29 more
Caused by: java.lang.IllegalStateException: Could not find property `example` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.tools.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:217)
    at com.mmnaseri.utils.spring.data.domain.impl.QueryDescriptionExtractor.getPropertyDescriptor(QueryDescriptionExtractor.java:261)
    ... 33 more

and related code

public interface FbpMbpPolicyRepository extends JpaRepository<FbpMbpPolicy, Long>,
    FbpMbpPolicyRepositoryCustom {
}

public interface FbpMbpPolicyRepositoryCustom {

    public List<FbpMbpPolicy> findByExample(FbpMbpPolicy probe);

    public Page<FbpMbpPolicy> findByExample(FbpMbpPolicy probe, Pageable pageable);

    public Page<FbpMbpPolicy> findByAnyExample(FbpMbpPolicy probe, Pageable pageable);

}

public class FbpMbpPolicyRepositoryImpl implements FbpMbpPolicyRepositoryCustom {

    @Autowired
    FbpMbpPolicyRepository repository;

    @Override
    public List<FbpMbpPolicy> findByExample(FbpMbpPolicy probe) {
        return repository.findAll(Example.of(probe));
    }

    @Override // see QueryByExampleExecutor
    public Page<FbpMbpPolicy> findByExample(FbpMbpPolicy probe, Pageable pageable) {
        return repository.findAll(Example.of(probe),pageable);
    }

    ...

1.1.1 Problem java.lang.AssertionError: saved entity can't be retrieved

java.lang.AssertionError: saved entity can't be retrieved
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.assertTrue(Assert.java:41)
    at hello.CustomerRepository2ndTest.savedEntitiesCanBeRetrieved(CustomerRepository2ndTest.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:670)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


code for #82 sample

package hello;

import org.junit.Test;

import com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder;

import static org.junit.Assert.assertTrue;

public class CustomerRepository2ndTest {

    @Test
    public void savedEntitiesCanBeRetrieved() {

        final CustomerRepository repository = RepositoryFactoryBuilder.builder().mock(CustomerRepository.class);
        repository.save(new Customer());

        Customer c = repository.findOne(1L);
        assertTrue("saved entity can't be retrieved", c!=null);
    }

}

Framework fails to associate primitive ID types -> use Long (not long)

simplest sample No 1 (#82) CustomerRepositoryTest fails

com.mmnaseri.utils.spring.data.error.PropertyTypeMismatchException: Expected property <id> of class <class hello.Customer> to be of type <class java.lang.Long> but it was of type <long>
    at com.mmnaseri.utils.spring.data.domain.impl.id.AnnotatedFieldIdPropertyResolver.resolve(AnnotatedFieldIdPropertyResolver.java:45)
    at com.mmnaseri.utils.spring.data.domain.impl.id.EntityIdPropertyResolver.resolve(EntityIdPropertyResolver.java:43)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolveIdProperty(AbstractRepositoryMetadataResolver.java:69)
    at com.mmnaseri.utils.spring.data.domain.impl.AssignableRepositoryMetadataResolver.resolveFromInterface(AssignableRepositoryMetadataResolver.java:29)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolve(AbstractRepositoryMetadataResolver.java:49)
    at com.mmnaseri.utils.spring.data.domain.impl.DefaultRepositoryMetadataResolver.resolveFromInterface(DefaultRepositoryMetadataResolver.java:34)
    at com.mmnaseri.utils.spring.data.domain.impl.AbstractRepositoryMetadataResolver.resolve(AbstractRepositoryMetadataResolver.java:49)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:97)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at hello.CustomerRepositoryTest.testDemo(CustomerRepositoryTest.java:11)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:670)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Prepare for release `1.1`

At this point I am waiting on responses on #54.
I have closed everything else for milestone 1.1 and will work on #56 which will be the second major feature released with 1.1.

Support for query by example is broken

For code case in #69 #54 with 1.1.1

com.mmnaseri.utils.spring.data.error.DataOperationDefinitionException: Encountered an error while resolving operation metadata: public abstract java.util.List com.bee2c.platform.repository.FbpMbpPolicyRepositoryCustom.findByExample(com.bee2c.platform.entity.FbpMbpPolicy)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:45)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInvocationMappings(DefaultRepositoryFactory.java:210)
    at com.mmnaseri.utils.spring.data.proxy.impl.DefaultRepositoryFactory.getInstance(DefaultRepositoryFactory.java:76)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:103)
    at com.mmnaseri.utils.spring.data.dsl.mock.RepositoryMockBuilder.mock(RepositoryMockBuilder.java:101)
    at com.mmnaseri.utils.spring.data.dsl.factory.RepositoryFactoryBuilder.mock(RepositoryFactoryBuilder.java:273)
    at com.bee2c.platform.MbpDatabaseRelationsTestManual.testDemo(MbpDatabaseRelationsTestManual.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.mmnaseri.utils.spring.data.error.QueryParserException: interface com.bee2c.platform.repository.FbpMbpPolicyRepositoryCustom: Could not find property `example` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.getPropertyDescriptor(MethodQueryDescriptionExtractor.java:264)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.parseExpression(MethodQueryDescriptionExtractor.java:206)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.extract(MethodQueryDescriptionExtractor.java:134)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.QueryMethodDataOperationResolver.resolve(QueryMethodDataOperationResolver.java:53)
    at com.mmnaseri.utils.spring.data.proxy.impl.resolvers.DefaultDataOperationResolver.resolve(DefaultDataOperationResolver.java:43)
    ... 29 more
Caused by: java.lang.IllegalStateException: Could not find property `example` on `class com.bee2c.platform.entity.FbpMbpPolicy`
    at com.mmnaseri.utils.spring.data.tools.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:217)
    at com.mmnaseri.utils.spring.data.domain.impl.MethodQueryDescriptionExtractor.getPropertyDescriptor(MethodQueryDescriptionExtractor.java:262)
    ... 33 more


Add logging to operations

Many operations require proper logging, which is neglected at the moment.

This might lead to some serious debugging headaches.

For instance, com.mmnaseri.utils.spring.data.commons.CrudRepositorySupport#save() might throw an exception complaining that the entity being inserted doesn't have a key (which is the way it should be), while not reporting the root cause as being the missing key generator. A warning statement would solve all of these.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.