Examples of MemcachedCacheResultInterceptor


Examples of com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor

        assertThat(MemcachedCacheResultInterceptor.class, notNullValue());
    }

    @Test
    public void instantiation() throws Exception {
        MemcachedCacheResultInterceptor target = new MemcachedCacheResultInterceptor();
        assertThat(target, notNullValue());
    }
View Full Code Here

Examples of com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor

        return null;
    }

    @Test
    public void getCacheKey_A$MethodInvocation$boolean_raw() throws Exception {
        MemcachedCacheResultInterceptor interceptor = new MemcachedCacheResultInterceptor();
        MethodInvocation invocation = mock(MethodInvocation.class);
        Method method = this.getClass().getMethod("getSomething", String.class, String.class);
        when(invocation.getMethod()).thenReturn(method);
        when(invocation.getArguments()).thenReturn(new Object[] { "foo", "bar" });
        String actual = interceptor.getCacheKey(invocation, true);
        String expected = "com.m3.methodcache.interceptor.MemcachedCacheResultInterceptorTest#getSomething" +
                "(java.lang.String,java.lang.String)" +
                " throws java.lang.Exception_$$_" +
                "foo_$_bar_$_";
        assertThat(actual, is(equalTo(expected)));
View Full Code Here

Examples of com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor

        assertThat(actual, is(equalTo(expected)));
    }

    @Test
    public void getCacheKey_A$MethodInvocation$boolean_hash() throws Exception {
        MemcachedCacheResultInterceptor interceptor = new MemcachedCacheResultInterceptor();
        MethodInvocation invocation = mock(MethodInvocation.class);
        Method method = this.getClass().getMethod("getSomething", String.class, String.class);
        when(invocation.getMethod()).thenReturn(method);
        when(invocation.getArguments()).thenReturn(new Object[] { "foo", "bar" });
        String actual = interceptor.getCacheKey(invocation, false);
        String expected = "c0fdd32fbd47bfc945c2404725172b6b";
        assertThat(actual, is(equalTo(expected)));
    }
View Full Code Here

Examples of com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor

        assertThat(actual, is(equalTo(expected)));
    }

  @Test
  public void getConfiguration_A$() throws Exception {
    MemcachedCacheResultInterceptor interceptor = new MemcachedCacheResultInterceptor();
    Configuration actual = interceptor.getConfiguration();
    assertThat(actual, is(nullValue()));
  }
View Full Code Here

Examples of com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor

        }
    }

  @Test
  public void invoke_A$MethodInvocation() throws Throwable {
    MemcachedCacheResultInterceptor interceptor = new MemcachedCacheResultInterceptor();
    MethodInvocation invocation = mock(MethodInvocation.class);
        when(invocation.getMethod()).thenReturn(Foo.class.getDeclaredMethod("doSomething"));
        when(invocation.proceed()).thenReturn("foo");
    Object result = interceptor.invoke(invocation);
    Object expected = "foo";
    assertThat(result, is(equalTo(expected)));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.