Package org.nanocontainer.aop

Examples of org.nanocontainer.aop.ComponentPointcut


    }

    public void testCustomComponentPointcut() {
        StringBuffer log = new StringBuffer();

        ComponentPointcut customCut = new ComponentPointcut() {
            public boolean picks(Object componentKey) {
                return true;
            }
        };
View Full Code Here


* @author Stephen Molitor
*/
public class KeyEqualsComponentPointcutTestCase extends TestCase {

    public void testPicks() {
        ComponentPointcut pointcutA = new KeyEqualsComponentPointcut("a");
        ComponentPointcut pointcutB = new KeyEqualsComponentPointcut("b");

        assertTrue(pointcutA.picks("a"));
        assertFalse(pointcutA.picks("b"));
        assertFalse(pointcutB.picks("a"));
        assertTrue(pointcutB.picks("b"));
    }
View Full Code Here

* @author Stephen Molitor
*/
public class NameMatchesComponentPointcutTestCase extends TestCase {

    public void testPicks() throws Exception {
        ComponentPointcut cut1 = new NameMatchesComponentPointcut("^foo$");
        assertTrue(cut1.picks("foo"));
        assertFalse(cut1.picks("barfoo"));
        assertFalse(cut1.picks("foobar"));

        ComponentPointcut cut2 = new NameMatchesComponentPointcut("foo*");
        assertTrue(cut2.picks("foo"));
        assertTrue(cut2.picks("barfoo"));
        assertTrue(cut2.picks("foobar"));
    }
View Full Code Here

        MethodInterceptor interceptor = (MethodInterceptor) attributes.remove("interceptor");
        Object interceptorKey = attributes.remove("interceptorKey");
        Class mixinClass = (Class) attributes.remove("mixinClass");
        List mixinInterfaces = (List) attributes.remove("mixinInterfaces");

        ComponentPointcut componentCut = (ComponentPointcut) attributes.remove("componentCut");
        if (componentCut == null && currentKey != null) {
            componentCut = currentPico.getPointcutsFactory().component(currentKey);
        }

        if (interceptor != null || interceptorKey != null) {
View Full Code Here

        assertTrue(cut2.picks("barfoo"));
        assertTrue(cut2.picks("foobar"));
    }

    public void testNotStringComponentKey() {
        ComponentPointcut cut = new NameMatchesComponentPointcut("foo");
        assertFalse(cut.picks(Dao.class));
    }
View Full Code Here

        assertFalse(cut.picks(setA));
        assertFalse(cut.picks(setB));
    }

    public void testComponent() {
        ComponentPointcut cut = cuts.component(Dao.class);
        assertTrue(cut.picks(Dao.class));
        assertFalse(cut.picks("Dao"));
    }
View Full Code Here

        assertTrue(cut.picks(Dao.class));
        assertFalse(cut.picks("Dao"));
    }

    public void testComponentName() {
        ComponentPointcut cut = cuts.componentName("foo*");
        assertTrue(cut.picks("foo"));
        assertTrue(cut.picks("foobar"));
        assertFalse(cut.picks("bar"));
    }
View Full Code Here

TOP

Related Classes of org.nanocontainer.aop.ComponentPointcut

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.