Package org.jboss.forge.addon.ui.controller

Examples of org.jboss.forge.addon.ui.controller.WizardCommandController


   public void testProjectTypeWithNoBuildSystemRequirements() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "norequirements");
         Assert.assertEquals("norequirements", InputComponents.getValueFor(wizard.getInputs().get("type")).toString());
      }
      finally
      {
         tempDir.delete();
      }
View Full Code Here


   public void testProjectTypeWithNullBuildSystemRequirements() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "nullrequirements");
         Assert.assertEquals("nullrequirements", InputComponents.getValueFor(wizard.getInputs().get("type"))
                  .toString());
      }
      finally
      {
         tempDir.delete();
View Full Code Here

   public void testProjectTypeSwitching() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "mock");
         Assert.assertEquals("buildsystem", InputComponents.getValueFor(wizard.getInputs().get("buildSystem"))
                  .toString());

         wizard.setValueFor("type", "mock2");
         Assert.assertEquals("buildsystem2", InputComponents.getValueFor(wizard.getInputs().get("buildSystem"))
                  .toString());
         UISelectOne<ProjectProvider> buildSystems = (UISelectOne<ProjectProvider>) wizard.getInputs().get("buildSystem");
         List<ProjectProvider> choices = Iterators.asList(buildSystems.getValueChoices());
         Assert.assertEquals(1, choices.size());

         wizard.setValueFor("type", "mock3");
         choices = Iterators.asList(buildSystems.getValueChoices());
         Assert.assertEquals(2, choices.size());

         wizard.setValueFor("type", "mock2");
         choices = Iterators.asList(buildSystems.getValueChoices());
         Assert.assertEquals(1, choices.size());
      }
      finally
      {
View Full Code Here

   public void testProjectTypeRestrictedByBuildSystem() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "unsatisfied");
         Assert.assertNotEquals("unsatisfied", InputComponents.getValueFor(wizard.getInputs().get("type")).toString());
      }
      finally
      {
         tempDir.delete();
      }
View Full Code Here

      File tempDir = OperatingSystemUtils.createTempDir();
      File something = new File(tempDir, "test/something");
      something.mkdirs();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         Assert.assertFalse(wizard.getInputs().get("overwrite").isEnabled());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "mock");
         Assert.assertFalse(wizard.isValid());
         Assert.assertTrue(wizard.getInputs().get("overwrite").isEnabled());
         Assert.assertFalse(wizard.canMoveToNextStep());
         Assert.assertFalse(wizard.canExecute());
      }
      finally
      {
         something.delete();
         tempDir.delete();
View Full Code Here

   @Test
   public void testCreateEJB() throws Exception
   {
      Project project = projectHelper.createJavaLibraryProject();
      facetFactory.install(project, JavaSourceFacet.class);
      WizardCommandController controller = testHarness.createWizardController(NewEJBCommand.class, project.getRoot());
      controller.initialize();
      controller.setValueFor("named", "TestEJB");
      controller.setValueFor("targetPackage", "org.jboss.forge.test");
      controller.setValueFor("serializable", "true");
      Assert.assertFalse(controller.canMoveToNextStep());
      Assert.assertTrue(controller.isValid());
      Assert.assertTrue(controller.canExecute());
      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      Assert.assertTrue(project.hasFacet(EJBFacet.class));
      Assert.assertFalse(project.hasFacet(JMSFacet.class));
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.TestEJB");
View Full Code Here

   @Test
   public void testCreateMDB() throws Exception
   {
      Project project = projectHelper.createJavaLibraryProject();
      facetFactory.install(project, JavaSourceFacet.class);
      WizardCommandController controller = testHarness.createWizardController(NewEJBCommand.class,
               project.getRoot());
      controller.initialize();
      controller.setValueFor("named", "TestEJB");
      controller.setValueFor("type", EJBType.MESSAGEDRIVEN);
      controller.setValueFor("targetPackage", "org.jboss.forge.test");
      controller.setValueFor("serializable", "false");
      Assert.assertTrue(controller.isValid());
      Assert.assertFalse(controller.canExecute());

      Assert.assertTrue(controller.canMoveToNextStep());
      controller.next();
      Assert.assertFalse(controller.canExecute());

      controller.setValueFor("destType", JMSDestinationType.TOPIC);
      controller.setValueFor("destName", "destination");

      Assert.assertTrue(controller.canExecute());

      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));

      project = projectHelper.refreshProject(project);
      Assert.assertTrue(project.hasFacet(EJBFacet.class));
      Assert.assertTrue(project.hasFacet(JMSFacet.class));
View Full Code Here

   @Test
   public void testSetTransactionAttributeOnEJB() throws Exception
   {
      Project project = projectHelper.createJavaLibraryProject();
      facetFactory.install(project, JavaSourceFacet.class);
      WizardCommandController controller = testHarness.createWizardController(NewEJBCommand.class, project.getRoot());
      controller.initialize();
      controller.setValueFor("named", "TestEJB");
      controller.setValueFor("type", EJBType.MESSAGEDRIVEN);
      controller.setValueFor("targetPackage", "org.jboss.forge.test");
      controller.setValueFor("serializable", "true");
      Assert.assertTrue(controller.isValid());
      Assert.assertFalse(controller.canExecute());

      Assert.assertTrue(controller.canMoveToNextStep());
      controller.next();
      Assert.assertFalse(controller.canExecute());

      controller.setValueFor("destType", JMSDestinationType.TOPIC);
      controller.setValueFor("destName", "destination");

      Assert.assertTrue(controller.canExecute());

      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));

      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.TestEJB");
      Assert.assertNotNull(javaResource);
View Full Code Here

   public void testInvokeCommand() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());
         wizard.setValueFor("named", "test");
         wizard.setValueFor("targetLocation", tempDir);
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "mock");
         Assert.assertTrue(wizard.isValid());
         Assert.assertTrue(wizard.canExecute());
         File targetDirectory = new File(tempDir, "test");
         Assert.assertFalse(targetDirectory.exists());
         wizard.execute();

         Assert.assertTrue(targetDirectory.exists());
      }
      finally
      {
View Full Code Here

   public void testTargetDirHasDefaultValue() throws Exception
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      try
      {
         WizardCommandController wizard = testHarness.createWizardController(NewProjectWizard.class);
         wizard.initialize();
         Assert.assertFalse(wizard.canMoveToNextStep());

         Resource<?> targetLocation = (Resource<?>) wizard.getValueFor("targetLocation");
         Assert.assertNotNull(targetLocation);

         wizard.setValueFor("named", "test");
         wizard.setValueFor("topLevelPackage", "org.example");
         wizard.setValueFor("type", "mock");
         Assert.assertTrue(wizard.isValid());
         Assert.assertTrue(wizard.canExecute());

         wizard.execute();
         Assert.assertTrue(targetLocation.exists());
      }
      finally
      {
         tempDir.delete();
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.ui.controller.WizardCommandController

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.