Examples of MockMethodInvocation


Examples of org.springframework.osgi.internal.service.interceptor.MockMethodInvocation

  protected void setUp() throws Exception {
    Method m = ReflectionUtils.findMethod(Object.class, "hashCode");
    context = new MockBundleContext();
    interceptor = new LocalBundleContextAdvice(context);
   
    invocation = new MockMethodInvocation(m) {
      public Object proceed() throws Throwable {
        assertSame("bundle context not set", context, LocalBundleContext.getInvokerBundleContext());
        return null;
      }
    };
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    private MockMethodInvocation annotatedAtInterfaceLevel;
    private MockMethodInvocation annotatedAtMethodLevel;

    @Before
    public void setUpData() throws Exception {
        voidImpl1 = new MockMethodInvocation(new ReturnVoidImpl1(), ReturnVoid.class, "doSomething", List.class);
        voidImpl2 = new MockMethodInvocation(new ReturnVoidImpl2(), ReturnVoid.class, "doSomething", List.class);
        voidImpl3 = new MockMethodInvocation(new ReturnVoidImpl3(), ReturnVoid.class, "doSomething", List.class);
        listImpl1 = new MockMethodInvocation(new ReturnAListImpl1(), ReturnAList.class, "doSomething", List.class);
        notherListImpl1 = new MockMethodInvocation(new ReturnAnotherListImpl1(), ReturnAnotherList.class, "doSomething", List.class);
        notherListImpl2 = new MockMethodInvocation(new ReturnAnotherListImpl2(), ReturnAnotherList.class, "doSomething", List.class);
        annotatedAtClassLevel = new MockMethodInvocation(new CustomAnnotationAtClassLevel(), ReturnVoid.class, "doSomething", List.class);
        annotatedAtInterfaceLevel = new MockMethodInvocation(new CustomAnnotationAtInterfaceLevel(), ReturnVoid2.class, "doSomething", List.class);
        annotatedAtMethodLevel = new MockMethodInvocation(new CustomAnnotationAtMethodLevel(), ReturnVoid.class, "doSomething", List.class);
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

        assertEquals(1, attrs.length);
    }

    @Test
    public void proxyFactoryInterfaceAttributesFound() throws Exception {
        MockMethodInvocation mi = MethodInvocationFactory.createSec2150MethodInvocation();
        Collection<ConfigAttribute> attributes = mds.getAttributes(mi);
        assertThat(attributes.size()).isEqualTo(1);
        Expression expression = (Expression) ReflectionTestUtils.getField(attributes.iterator().next(),"authorizeExpression");
        assertThat(expression.getExpressionString()).isEqualTo("hasRole('ROLE_PERSON')");
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

     * @throws Exception
     */
    @Test
    public void classLevelAnnotationsOnlyAffectTheClassTheyAnnotateAndTheirMembers() throws Exception {
        Child target = new Child();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "notOverriden");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertThat(accessAttributes).isNull();
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    }

    @Test
    public void classLevelAnnotationsOnlyAffectTheClassTheyAnnotateAndTheirMembersOverriden() throws Exception {
        Child target = new Child();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "overriden");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertEquals(1, accessAttributes.size());
        assertEquals("DERIVED", accessAttributes.toArray()[0].toString());
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    }

    @Test
    public void classLevelAnnotationsImpactMemberLevel() throws Exception {
        Child target = new Child();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "defaults");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertEquals(1, accessAttributes.size());
        assertEquals("DERIVED", accessAttributes.toArray()[0].toString());
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    }

    @Test
    public void classLevelAnnotationsIgnoredByExplicitMemberAnnotation() throws Exception {
        Child target = new Child();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "explicitMethod");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertEquals(1, accessAttributes.size());
        assertEquals("EXPLICIT", accessAttributes.toArray()[0].toString());
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

     * @throws Exception
     */
    @Test
    public void interfacesNeverContributeAnnotationsMethodLevel() throws Exception {
        Parent target = new Parent();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "interfaceMethod");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertThat(accessAttributes).isEmpty();
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    }

    @Test
    public void interfacesNeverContributeAnnotationsClassLevel() throws Exception {
        Parent target = new Parent();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "notOverriden");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertThat(accessAttributes).isEmpty();
    }
View Full Code Here

Examples of org.springframework.security.access.intercept.method.MockMethodInvocation

    }

    @Test
    public void annotationsOnOverriddenMemberIgnored() throws Exception {
        Child target = new Child();
        MockMethodInvocation mi = new MockMethodInvocation(target, target.getClass(), "overridenIgnored");

        Collection<ConfigAttribute> accessAttributes = mds.getAttributes(mi);
        assertEquals(1, accessAttributes.size());
        assertEquals("DERIVED", accessAttributes.toArray()[0].toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.