Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-159

Plugins plugin should have a command to create a new blank forge test-harness class

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 1.0.0.Beta4
    • 1.0.0.Beta2
    • Builtin Plugins
    • None

    Description

      /*
       * JBoss, Home of Professional Open Source
       * Copyright 2011, Red Hat, Inc., and individual contributors
       * by the @authors tag. See the copyright.txt in the distribution for a
       * full listing of individual contributors.
       *
       * This is free software; you can redistribute it and/or modify it
       * under the terms of the GNU Lesser General Public License as
       * published by the Free Software Foundation; either version 2.1 of
       * the License, or (at your option) any later version.
       *
       * This software is distributed in the hope that it will be useful,
       * but WITHOUT ANY WARRANTY; without even the implied warranty of
       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       * Lesser General Public License for more details.
       *
       * You should have received a copy of the GNU Lesser General Public
       * License along with this software; if not, write to the Free
       * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
       * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
       */
      package com.example.plugin;
      
      import javax.inject.Inject;
      
      import org.jboss.arquillian.api.Deployment;
      import org.jboss.forge.project.Project;
      import org.jboss.forge.project.dependencies.DependencyResolver;
      import org.jboss.forge.test.AbstractShellTest;
      import org.jboss.shrinkwrap.api.spec.JavaArchive;
      import org.junit.Assert;
      import org.junit.Test;
      
      /**
       * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
       * 
       */
      public class ExamplePluginTest extends AbstractShellTest
      {
         // Notice that you may use injection to do verification of the internal state of the system. Or to perform additional
         // operations.
         @Inject
         private DependencyResolver resolver;
      
         @Deployment
         public static JavaArchive getDeployment()
         {
            // The deployment method is where you must add references to your classes, packages, and configuration files, via
            // Arquillian.
            return AbstractShellTest.getDeployment().addPackages(true, ExamplePlugin.class.getPackage());
         }
      
         @Test
         public void testInstallPrettyfaces() throws Exception
         {
            // Create a new barebones Java project
            Project p = initializeJavaProject();
      
            // Queue input lines to be read as the Shell executes.
            queueInputLines("y");
      
            // Execute a command. If any input is required, it will be read from queued input.
            getShell().execute("project add-dependency com.example:example-dependency");
      
            Assert.assertNotNull(resolver);
         }
      }
      

      Attachments

        Activity

          People

            lincolnthree Lincoln Baxter III (Inactive)
            lincolnthree Lincoln Baxter III (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: