Package org.jboss.as.clustering.web

Examples of org.jboss.as.clustering.web.OutgoingDistributableSessionData


    }

    @SuppressWarnings("unchecked")
    @Test
    public void storeSessionData() throws IOException {
        OutgoingDistributableSessionData data = mock(OutgoingDistributableSessionData.class);
        Map<Object, Object> map = mock(Map.class);
        @SuppressWarnings("rawtypes")
        ArgumentCaptor<CacheInvoker.Operation> capturedOperation = ArgumentCaptor.forClass(CacheInvoker.Operation.class);

        String sessionId = "abc";

        when(data.getRealId()).thenReturn(sessionId);
//        when(this.sessionCache.startBatch()).thenReturn(true);
        when(this.invoker.invoke(same(this.cache), capturedOperation.capture())).thenReturn(null);

        this.manager.storeSessionData(data);

//        verify(this.sessionCache).endBatch(true);

        CacheInvoker.Operation<String, Map<Object, Object>, Void> operation = capturedOperation.getValue();

        int version = 10;
        long timestamp = System.currentTimeMillis();
        DistributableSessionMetadata metadata = new DistributableSessionMetadata();

//        when(this.sessionCache.startBatch()).thenReturn(true);
        when(data.getVersion()).thenReturn(version);
        when(map.put(Byte.valueOf((byte) SessionMapEntry.VERSION.ordinal()), version)).thenReturn(null);
        when(data.getTimestamp()).thenReturn(timestamp);
        when(map.put(Byte.valueOf((byte) SessionMapEntry.TIMESTAMP.ordinal()), timestamp)).thenReturn(null);
        when(data.getMetadata()).thenReturn(metadata);
        when(map.put(Byte.valueOf((byte) SessionMapEntry.METADATA.ordinal()), metadata)).thenReturn(null);

        when(this.cache.putIfAbsent(eq(sessionId), Mockito.<Map<Object, Object>>anyObject())).thenReturn(map);

        operation.invoke(this.cache);
View Full Code Here

TOP

Related Classes of org.jboss.as.clustering.web.OutgoingDistributableSessionData

Copyright © 2018 www.massapicom. 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.