Examples of CommandTransformation


Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * Tests a standard case: 2 arguments in the trigger command, both of them
     * represented as placeholders in the target
     */
    @Test
    public void testReplaceVars() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "project --topLevelPackage com.foo.sample --projectName test --domain otherdomainname");
        final String result = TailorHelper
                .replaceVars(rooCommand,
                        "module create --moduleName ${domain} --topLevelPackage ${topLevelPackage}");
        final String expectedResult = "module create --moduleName otherdomainname --topLevelPackage com.foo.sample";
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * Test replaceVars when there is more than one occurence of the same
     * placeholder in the target
     */
    @Test
    public void testReplaceVarsDuplicatePlaceholders() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "project --topLevelPackage com.foo.sample --projectName test --domain otherdomainname");
        final String result = TailorHelper
                .replaceVars(
                        rooCommand,
                        "module create --moduleName ${domain} --topLevelPackage ${topLevelPackage}.${domain}");
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * replacing it with the last fragment of the trigger command, i.e. the
     * first "unnamed" argument.
     */
    @Test
    public void testReplaceVarsForUnnamedArgument() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "cd test-data");
        final String result = TailorHelper.replaceVars(rooCommand,
                "module focus --moduleName ${*}");
        Assert.assertTrue("* was not replaced: " + result,
                result.endsWith("test-data"));
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * Test makes sure that the regex used by TailorHelper does not match
     * placeholders that are similar, but different. (Prefix and suffix)
     */
    @Test
    public void testReplaceVarsSimilarPlaceholders() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "project --topLevelPackage com.foo.sample --projectName test --domain otherdomainname");
        final String result = TailorHelper
                .replaceVars(rooCommand,
                        "module create --moduleName ${xdomain} --topLevelPackage ${topLevelPackagex}");
        final String expectedResult = "module create --moduleName ${xdomain} --topLevelPackage ${topLevelPackagex}";
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

    public void testList() {

        final Focus action = createTestActionObject();
        final ActionConfig config = ActionConfigFactory
                .focusModuleAction("data,it");
        final CommandTransformation trafo = new CommandTransformation(
                "command not relevant for this test");
        action.execute(trafo, config);
        // Test data: "data" module is first, "data-it" second.
        // Expected that action will discard "data" and choose "data-it"
        Assert.assertTrue(trafo.getOutputCommands().contains(
                "module focus --moduleName data-it"));
    }
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

    @Test
    public void testListWithout() {
        final Focus action = createTestActionObject();
        final ActionConfig config = ActionConfigFactory
                .focusModuleAction("domain,/it");
        final CommandTransformation trafo = new CommandTransformation(
                "command not relevant for this test");
        action.execute(trafo, config);
        // Test data: "domain-it" module is first, "domain" second.
        // Expected that action will discard "domain-it" because it contains
        // "it", and choose "domain"
        Assert.assertTrue(trafo.getOutputCommands().contains(
                "module focus --moduleName domain"));
    }
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

        final Focus action = new Focus();
        action.projectOperations = new MockProjectOperationsEmpty();

        final ActionConfig config = ActionConfigFactory
                .focusModuleAction("domain");
        final CommandTransformation trafo = new CommandTransformation(
                "command not relevant for this test");

        try {
            action.execute(trafo, config);
            Assert.fail("Should throw exception (is caught by DefaultTailorImpl, but this test goes directly to the action)");
        }
        catch (final IllegalStateException e) {
            Assert.assertTrue(trafo.getOutputCommands().isEmpty());
        }

    }
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

    @Test
    public void testStandard() {
        final Focus action = createTestActionObject();
        final ActionConfig config = ActionConfigFactory
                .focusModuleAction("domain");
        final CommandTransformation trafo = new CommandTransformation(
                "command not relevant for this test");
        action.execute(trafo, config);
        // Test data: "domain-it" module is first, "domain" second.
        // Expected that action will choose "domain-it" as the first positive
        // match
        Assert.assertTrue(trafo.getOutputCommands().contains(
                "module focus --moduleName domain-it"));
    }
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * Tests a standard case: 2 arguments in the trigger command, both of them
     * represented as placeholders in the target
     */
    @Test
    public void testReplaceVars() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "project --topLevelPackage com.foo.sample --projectName test --domain otherdomainname");
        final String result = TailorHelper
                .replaceVars(rooCommand,
                        "module create --moduleName ${domain} --topLevelPackage ${topLevelPackage}");
        final String expectedResult = "module create --moduleName otherdomainname --topLevelPackage com.foo.sample";
View Full Code Here

Examples of org.springframework.roo.addon.tailor.CommandTransformation

     * Test replaceVars when there is more than one occurence of the same
     * placeholder in the target
     */
    @Test
    public void testReplaceVarsDuplicatePlaceholders() {
        final CommandTransformation rooCommand = new CommandTransformation(
                "project --topLevelPackage com.foo.sample --projectName test --domain otherdomainname");
        final String result = TailorHelper
                .replaceVars(
                        rooCommand,
                        "module create --moduleName ${domain} --topLevelPackage ${topLevelPackage}.${domain}");
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.