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));
}
Aggregations