Package org.apache.mina.statemachine.context

Examples of org.apache.mina.statemachine.context.AbstractStateContextLookup


*/
public class AbstractStateContextLookupTest extends TestCase {

    public void testLookup() throws Exception {
        Map<String, StateContext> map = new HashMap<String, StateContext>();
        AbstractStateContextLookup lookup = new AbstractStateContextLookup(
                                             new DefaultStateContextFactory()) {
            protected boolean supports(Class<?> c) {
                return Map.class.isAssignableFrom(c);
            }
            @SuppressWarnings("unchecked")
            protected StateContext lookup(Object eventArg) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                return map.get("context");
            }
            @SuppressWarnings("unchecked")
            protected void store(Object eventArg, StateContext context) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                map.put("context", context);
            }
        };
        Object[] args1 = new Object[] {new Object(), map, new Object()};
        Object[] args2 = new Object[] {map, new Object()};
        StateContext sc = lookup.lookup(args1);
        assertSame(map.get("context"), sc);
        assertSame(map.get("context"), lookup.lookup(args1));
        assertSame(map.get("context"), lookup.lookup(args2));
    }
View Full Code Here


*/
public class AbstractStateContextLookupTest extends TestCase {

    public void testLookup() throws Exception {
        Map<String, StateContext> map = new HashMap<String, StateContext>();
        AbstractStateContextLookup lookup = new AbstractStateContextLookup(
                                             new DefaultStateContextFactory()) {
            protected boolean supports(Class<?> c) {
                return Map.class.isAssignableFrom(c);
            }
            @SuppressWarnings("unchecked")
            protected StateContext lookup(Object eventArg) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                return map.get("context");
            }
            @SuppressWarnings("unchecked")
            protected void store(Object eventArg, StateContext context) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                map.put("context", context);
            }
        };
        Object[] args1 = new Object[] {new Object(), map, new Object()};
        Object[] args2 = new Object[] {map, new Object()};
        StateContext sc = lookup.lookup(args1);
        assertSame(map.get("context"), sc);
        assertSame(map.get("context"), lookup.lookup(args1));
        assertSame(map.get("context"), lookup.lookup(args2));
    }
View Full Code Here

*/
public class AbstractStateContextLookupTest extends TestCase {

    public void testLookup() throws Exception {
        Map<String, StateContext> map = new HashMap<String, StateContext>();
        AbstractStateContextLookup lookup = new AbstractStateContextLookup(
                                             new DefaultStateContextFactory()) {
            protected boolean supports(Class<?> c) {
                return Map.class.isAssignableFrom(c);
            }
            @SuppressWarnings("unchecked")
            protected StateContext lookup(Object eventArg) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                return map.get("context");
            }
            @SuppressWarnings("unchecked")
            protected void store(Object eventArg, StateContext context) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                map.put("context", context);
            }
        };
        Object[] args1 = new Object[] {new Object(), map, new Object()};
        Object[] args2 = new Object[] {map, new Object()};
        StateContext sc = lookup.lookup(args1);
        assertSame(map.get("context"), sc);
        assertSame(map.get("context"), lookup.lookup(args1));
        assertSame(map.get("context"), lookup.lookup(args2));
    }
View Full Code Here

*/
public class AbstractStateContextLookupTest extends TestCase {

    public void testLookup() throws Exception {
        Map<String, StateContext> map = new HashMap<String, StateContext>();
        AbstractStateContextLookup lookup = new AbstractStateContextLookup(
                                             new DefaultStateContextFactory()) {
            protected boolean supports(Class<?> c) {
                return Map.class.isAssignableFrom(c);
            }
            @SuppressWarnings("unchecked")
            protected StateContext lookup(Object eventArg) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                return map.get("context");
            }
            @SuppressWarnings("unchecked")
            protected void store(Object eventArg, StateContext context) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                map.put("context", context);
            }
        };
        Object[] args1 = new Object[] {new Object(), map, new Object()};
        Object[] args2 = new Object[] {map, new Object()};
        StateContext sc = lookup.lookup(args1);
        assertSame(map.get("context"), sc);
        assertSame(map.get("context"), lookup.lookup(args1));
        assertSame(map.get("context"), lookup.lookup(args2));
    }
View Full Code Here

*/
public class AbstractStateContextLookupTest extends TestCase {

    public void testLookup() throws Exception {
        Map<String, StateContext> map = new HashMap<String, StateContext>();
        AbstractStateContextLookup lookup = new AbstractStateContextLookup(
                                             new DefaultStateContextFactory()) {
            protected boolean supports(Class<?> c) {
                return Map.class.isAssignableFrom(c);
            }
            @SuppressWarnings("unchecked")
            protected StateContext lookup(Object eventArg) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                return map.get("context");
            }
            @SuppressWarnings("unchecked")
            protected void store(Object eventArg, StateContext context) {
                Map<String, StateContext> map = (Map<String, StateContext>) eventArg;
                map.put("context", context);
            }
        };
        Object[] args1 = new Object[] {new Object(), map, new Object()};
        Object[] args2 = new Object[] {map, new Object()};
        StateContext sc = lookup.lookup(args1);
        assertSame(map.get("context"), sc);
        assertSame(map.get("context"), lookup.lookup(args1));
        assertSame(map.get("context"), lookup.lookup(args2));
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.statemachine.context.AbstractStateContextLookup

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.