Search in sources :

Example 1 with DefaultSessionKey

use of org.apache.shiro.session.mgt.DefaultSessionKey in project shiro by apache.

the class SecureRemoteInvocationFactoryTest method testSessionManagerProxyNonStartRemoteInvocation.

@Test
public void testSessionManagerProxyNonStartRemoteInvocation() throws Exception {
    SecureRemoteInvocationFactory factory = new SecureRemoteInvocationFactory();
    MethodInvocation mi = createMock(MethodInvocation.class);
    Method method = getMethod("getSession", SessionManager.class);
    expect(mi.getMethod()).andReturn(method).anyTimes();
    String dummySessionId = UUID.randomUUID().toString();
    SessionKey sessionKey = new DefaultSessionKey(dummySessionId);
    Object[] args = { sessionKey };
    expect(mi.getArguments()).andReturn(args).anyTimes();
    replay(mi);
    RemoteInvocation ri = factory.createRemoteInvocation(mi);
    verify(mi);
    assertEquals(dummySessionId, ri.getAttribute(SecureRemoteInvocationFactory.SESSION_ID_KEY));
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation) DefaultSessionKey(org.apache.shiro.session.mgt.DefaultSessionKey) SessionKey(org.apache.shiro.session.mgt.SessionKey) MethodInvocation(org.aopalliance.intercept.MethodInvocation) Method(java.lang.reflect.Method) DefaultSessionKey(org.apache.shiro.session.mgt.DefaultSessionKey) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 MethodInvocation (org.aopalliance.intercept.MethodInvocation)1 DefaultSessionKey (org.apache.shiro.session.mgt.DefaultSessionKey)1 SessionKey (org.apache.shiro.session.mgt.SessionKey)1 Test (org.junit.Test)1 RemoteInvocation (org.springframework.remoting.support.RemoteInvocation)1