Announcement Announcement Module
Collapse
No announcement yet.
Spring Data Redis Mock? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Redis Mock?

    Is there a Redis mock available which can be used with the java spring framework? I see ruby and python mocks out there, but don't see one for java.

    Thanks

  • #2
    I'm not aware of any. And frankly did not have the need - Redis is extremely fast and that's why our integration tests run directly against it. The setup is minimal (as oppose to a mock) and one has the advantage of running against the real thing.
    To put things in perspective, checking out Spring Redis, compiling and running the test suite (over 2700 tests) takes ~1 minute.
    Considering the amount of IO involved, clearly the test suite does not take more then 20-30 seconds.

    Comment


    • #3
      Thanks. The reason I ask about a mock is because starting up and stopping Redis dynamically in different development environments as part of the build lifecycle is tricky. For example, to run integration tests against a service using Redis and using Maven, we would probably have to start up Redis in the pre-integration-test phase and bring it down in the post-integration-test phase. How do you accomplish that?

      Also, there are native dependencies because of which certain compile time flags may have to be changed depending on the host which you run this on. A platform independent mock would be ideal since it would run within the java framework.

      Comment


      • #4
        We do this automatically inside our CI server using pre/post phase. As for Maven, I would recommend Gradle (that's what we're using anyway) - I know it doesn't answer your question but with Gradle a lot of things are much more easier and intuitive.
        As for development, I start Redis and just leave it there - it takes less then 10 MB of memory and it's really fast. You can bind various instances per port if you need to.
        Not sure what you mean by native dependencies - you can compile Redis in whatever form you want and there's always RPM and the like.

        I understand how a mocking library might make things easier for a Java developer but I think long term the short investment in getting Redis setup is highly preferable to a mocking library.

        Comment


        • #5
          Well, not necessarily native dependencies, but I meant different compilation flags. I had only one instance of this, but I have tried it only on two systems. https://groups.google.com/forum/?fro...db/NI_d00he39o

          Thanks for the input.

          Comment

          Working...
          X