Examples of ActionInvocationFacetFactory


Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

    }


    public void testActionsPickedUpFromSuperclass() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);

        class Customer {
            @SuppressWarnings("unused")
            public void someAction(final int x, final long y) {}
        }

        class CustomerEx extends Customer {
        }

        Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });


        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);


        facetFactory.process(new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms));

        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
        assertNotNull(facet0);
    }
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
        assertNotNull(facet0);
    }

    public void testActionsPickedUpFromSuperclassButHelpersFromSubClass() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);

        ActionParameterChoicesFacetFactory facetFactoryForChoices = new ActionParameterChoicesFacetFactory();
        facetFactoryForChoices.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);

        DisabledFacetViaDisableMethodFacetFactory facetFactoryForDisable = new DisabledFacetViaDisableMethodFacetFactory();
        facetFactoryForDisable.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);

        class Customer {
            @SuppressWarnings("unused")
            public void someAction(final int x, final long y) {}

            @SuppressWarnings("unused")
            public int[] choices0SomeAction() {
                return new int[0];
            }
        }

        class CustomerEx extends Customer {
            @Override
            public int[] choices0SomeAction() {
                return new int[0];
            }

            @SuppressWarnings("unused")
            public long[] choices1SomeAction() {
                return new long[0];
            }

            @SuppressWarnings("unused")
            public String disableSomeAction() {
                return null;
            }
        }

        Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
        Method choices0Method = findMethod(CustomerEx.class, "choices0SomeAction", new Class[] {});
        Method choices1Method = findMethod(CustomerEx.class, "choices1SomeAction", new Class[] {});
        Method disableMethod = findMethod(CustomerEx.class, "disableSomeAction", new Class[] {});

        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);

        final ProcessMethodContext processMethodContext = new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms);
        facetFactory.process(processMethodContext);
        facetFactoryForChoices.process(processMethodContext);
        facetFactoryForDisable.process(processMethodContext);

        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
        assertNotNull(facet0);
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

    private final ObjectSpecification stringSpec = new TestProxySpecification("java.lang.String");
    private final ObjectSpecification customerSpec = new TestProxySpecification("Customer");

   
    public void testActionInvocationFacetIsInstalledAndMethodRemoved() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);

        class Customer {
            @SuppressWarnings("unused")
            public void someAction() {}
        }
        final Method actionMethod = findMethod(Customer.class, "someAction");

        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));

        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ActionInvocationFacetViaMethod);
        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(actionMethod));
    }

    public void testProvidesDefaultNameForActionButIgnoresAnyNamedAnnotation() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);
       
        class Customer {
            @SuppressWarnings("unused")
            @Named("Renamed an action with a named annotation")
            public void anActionWithNamedAnnotation() {}
        }
        final Method method = findMethod(Customer.class, "anActionWithNamedAnnotation");


        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));

        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof NamedFacet);
        final NamedFacet namedFacet = (NamedFacet) facet;
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

        final NamedFacet namedFacet = (NamedFacet) facet;
        assertEquals("An Action With Named Annotation", namedFacet.value());
    }

    public void testPicksUpDebugPrefixAndSetsNameAppropriatelyAlso() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);
       
        class Customer {
            @SuppressWarnings("unused")
            public void debugAnActionWithDebugPrefix() {}
        }
        final Method method = findMethod(Customer.class, "debugAnActionWithDebugPrefix");
        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));

        Facet facet = facetedMethod.getFacet(DebugFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof DebugFacet);
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

        final NamedFacet namedFacet = (NamedFacet) facet;
        assertEquals("An Action With Debug Prefix", namedFacet.value());
    }

    public void testPicksUpExplorationPrefixAndSetsNameAppropriatelyAlso() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);
       
        class Customer {
            @SuppressWarnings("unused")
            public void explorationAnActionWithExplorationPrefix() {}
        }
        final Method method = findMethod(Customer.class, "explorationAnActionWithExplorationPrefix");
        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));

        Facet facet = facetedMethod.getFacet(ExplorationFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ExplorationFacet);
View Full Code Here

Examples of org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory

        final NamedFacet namedFacet = (NamedFacet) facet;
        assertEquals("An Action With Exploration Prefix", namedFacet.value());
    }

    public void testCannotHaveBothDebugAndThenExplorationPrefix() {
        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
        facetFactory.setSpecificationLookup(reflector);
        reflector.setLoadSpecificationStringReturn(voidSpec);
       
        class Customer {
            @SuppressWarnings("unused")
            public void debugExplorationAnActionWithDebugAndExplorationPrefix() {}
        }
        final Method method = findMethod(Customer.class, "debugExplorationAnActionWithDebugAndExplorationPrefix");
        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));

        Facet facet = facetedMethod.getFacet(DebugFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof DebugFacet);
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.