Package com.jitlogic.zorka.core.spy

Examples of com.jitlogic.zorka.core.spy.SpyMatcher


public class ClassMethodMatchingUnitTest extends ZorkaFixture {

    @Test
    public void testSimpleClassOnlyMatch() {
        SpyMatcherSet sms = new SpyMatcherSet(new SpyMatcher(SpyMatcher.BY_CLASS_NAME, 0xFF, "com.jitlogic.zorka.core.spy.**", "*", null));

        Assert.assertTrue(sms.classMatch("com.jitlogic.zorka.core.spy.unittest.SomeClass"));
        Assert.assertTrue(sms.classMatch("com.jitlogic.zorka.core.spy.AClass"));
        Assert.assertFalse(sms.classMatch("comXjitlogicXzorkaXspyXAClass"));
    }
View Full Code Here


        Assert.assertFalse(sms.classMatch("comXjitlogicXzorkaXspyXAClass"));
    }

    @Test
    public void testClassMatchWithSingleLevelWildcard() {
        SpyMatcherSet sms = new SpyMatcherSet(new SpyMatcher(SpyMatcher.BY_CLASS_NAME, 0xFF, "com.jitlogic.zorka.core.spy.*", "*", null));
        Assert.assertFalse(sms.classMatch("com.jitlogic.zorka.core.spy.unittest.SomeClass"));
        Assert.assertTrue(sms.classMatch("com.jitlogic.zorka.core.spy.AClass"));
    }
View Full Code Here

    }

    @Test
    public void testClassMatchSignatureWithSimpleReturnAndArgumentType() {
        SpyMatcherSet sms = new SpyMatcherSet(spy.byMethod(0xff, "test.*", "frobnicate", "int", "int"));
        SpyMatcher cm = new SpyMatcher(0, 0xFF, "test.*", "frobnicate", "int", "int");
        Assert.assertTrue(sms.methodMatch("test.someClass", null, null, 1, "frobnicate", "(I)I", null));
        Assert.assertFalse(sms.methodMatch("test.someClass", null, null, 1, "frobnicate", "(J)I", null));
    }
View Full Code Here

    }


    @Test
    public void testSpyMatcherFromString() {
        SpyMatcher sm = SpyMatcher.fromString("com.jitlogic.**");
        assertEquals(SpyMatcher.DEFAULT_PRIORITY, sm.getPriority());
        assertEquals("com\\.jitlogic\\..+", sm.getClassPattern().toString());
        assertEquals("[a-zA-Z0-9_]+", sm.getMethodPattern().toString());
    }
View Full Code Here

    }


    @Test
    public void testSpyMatcherFromStringWithCustomPriorityAndMethodName() {
        SpyMatcher sm = SpyMatcher.fromString("999:com.jitlogic.**/myMethod");
        assertEquals(999, sm.getPriority());
        assertEquals("com\\.jitlogic\\..+", sm.getClassPattern().toString());
        assertEquals("myMethod", sm.getMethodPattern().toString());
    }
View Full Code Here

TOP

Related Classes of com.jitlogic.zorka.core.spy.SpyMatcher

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.