コード例 #1
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map,
  * String[])} method. <br>
  * <br>
  * Tests the argument map missing the {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute only
  *
  * @throws Exception
  */
 public void testConfigFromBuildCommandArgs2() throws Exception {
   Map<String, String> args = get20AntArgumentMap();
   ILaunchConfiguration config =
       BuilderCoreUtils.configFromBuildCommandArgs(
           getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1});
   assertNotNull("There should be a migrated configuration returned", config); // $NON-NLS-1$
 }
コード例 #2
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#isUnmigratedConfig(org.eclipse.debug.core.ILaunchConfiguration)} method
  *
  * @throws Exception
  */
 public void testIsUnmigratedConfig2() throws Exception {
   ILaunchConfiguration config =
       createExternalToolBuilder(getProject(), "testIsUnmigratedConfig2", null); // $NON-NLS-1$
   assertFalse(
       "Shoudl not be considered 'unmigrated'",
       BuilderCoreUtils.isUnmigratedConfig(config)); // $NON-NLS-1$
 }
コード例 #3
0
 /**
  * Tests the {@link BuilderCoreUtils#buildTypesToArray(String)} method
  *
  * @throws Exception
  */
 public void testBuildTypesToArray1() throws Exception {
   String kinds =
       IExternalToolConstants.BUILD_TYPE_CLEAN
           + ","
           + //$NON-NLS-1$
           IExternalToolConstants.BUILD_TYPE_INCREMENTAL
           + ","
           + //$NON-NLS-1$
           IExternalToolConstants.BUILD_TYPE_AUTO
           + ","
           + //$NON-NLS-1$
           IExternalToolConstants.BUILD_TYPE_FULL;
   int[] array = BuilderCoreUtils.buildTypesToArray(kinds);
   assertNotNull("The build kinds array cannot be null", array); // $NON-NLS-1$
   boolean contains = true;
   for (int i = 0; i < array.length; i++) {
     contains &=
         (array[i] == IncrementalProjectBuilder.AUTO_BUILD)
             | (array[i] == IncrementalProjectBuilder.CLEAN_BUILD)
             | (array[i] == IncrementalProjectBuilder.FULL_BUILD)
             | (array[i] == IncrementalProjectBuilder.INCREMENTAL_BUILD);
     if (!contains) {
       break;
     }
   }
   assertTrue("All of the build kinds should have been found", contains); // $NON-NLS-1$
 }
コード例 #4
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map,
  * String[])} method. <br>
  * <br>
  * Tests the argument map with an invalid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute
  *
  * @throws Exception
  */
 public void testConfigFromBuildCommandArgs3() throws Exception {
   Map<String, String> args = new HashMap<>();
   args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "foo"); // $NON-NLS-1$
   ILaunchConfiguration config =
       BuilderCoreUtils.configFromBuildCommandArgs(
           getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1});
   assertNull("There should be no configuration returned", config); // $NON-NLS-1$
 }
コード例 #5
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#isUnmigratedConfig(org.eclipse.debug.core.ILaunchConfiguration)} method
  *
  * @throws Exception
  */
 public void testIsUnmigratedConfig1() throws Exception {
   ILaunchConfigurationType type =
       AbstractAntUITest.getLaunchManager()
           .getLaunchConfigurationType(
               IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE);
   if (type != null) {
     ILaunchConfigurationWorkingCopy config =
         type.newInstance(
             BuilderCoreUtils.getBuilderFolder(getProject(), true),
             "testIsUnmigratedConfig1"); //$NON-NLS-1$
     assertTrue(
         "should be considered 'unmigrated'",
         BuilderCoreUtils.isUnmigratedConfig(config)); // $NON-NLS-1$
   } else {
     fail("could not find the Ant builder launch configuration type"); // $NON-NLS-1$
   }
 }
コード例 #6
0
 /**
  * Tests the {@link BuilderCoreUtils#toBuildCommand(org.eclipse.core.resources.IProject,
  * org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} method <br>
  * <br>
  * Tests the case of the working copy of an existing configuration
  *
  * @throws Exception
  */
 public void testToBuildCommand3() throws Exception {
   Map<String, String> args = new HashMap<>();
   ILaunchConfiguration copy =
       createExternalToolBuilder(getProject(), "testToBuildCommand3", args); // $NON-NLS-1$
   ICommand command =
       BuilderCoreUtils.toBuildCommand(
           getProject(), copy.getWorkingCopy(), getProject().getDescription().newCommand());
   assertNotNull("There should have been a new build command created", command); // $NON-NLS-1$
 }
コード例 #7
0
 /**
  * Tests the {@link BuilderCoreUtils#toBuildCommand(org.eclipse.core.resources.IProject,
  * org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} method <br>
  * <br>
  * Tests the case of a new un-saved {@link ILaunchConfiguration}
  *
  * @throws Exception
  */
 public void testToBuildCommand1() throws Exception {
   ILaunchConfigurationWorkingCopy copy =
       createExternalToolBuilderWorkingCopy(
           getProject(), "testToBuildCommand1", null); // $NON-NLS-1$
   ICommand command =
       BuilderCoreUtils.toBuildCommand(
           getProject(), copy, getProject().getDescription().newCommand());
   assertNotNull("There should have been a new build command created", command); // $NON-NLS-1$
 }
コード例 #8
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#migrateBuilderConfiguration(org.eclipse.core.resources.IProject,
  * org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)} method
  *
  * @throws Exception
  */
 public void testMigrateBuilderConfiguration2() throws Exception {
   ILaunchConfigurationWorkingCopy copy =
       createExternalToolBuilderWorkingCopy(
           getProject(), "testMigra/teBuilderConfi/guration2", null); // $NON-NLS-1$
   ILaunchConfiguration config = BuilderCoreUtils.migrateBuilderConfiguration(getProject(), copy);
   assertNotNull("The un-saved working copy should have been migrated", config); // $NON-NLS-1$
   assertTrue(
       "The name of the migrated configuration should be testMigra.teBuilderConfi.guration2",
       config.getName().equals("testMigra.teBuilderConfi.guration2")); // $NON-NLS-1$ //$NON-NLS-2$
 }
コード例 #9
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map,
  * String[])} method. <br>
  * <br>
  * Tests the argument map missing the {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute and
  * all other config arguments
  *
  * @throws Exception
  */
 public void testConfigFromBuildCommandArgs1() throws Exception {
   ILaunchConfiguration config =
       BuilderCoreUtils.configFromBuildCommandArgs(
           getProject(),
           new HashMap<String, String>(),
           new String[] {BuilderCoreUtils.VERSION_1_0});
   assertNull(
       "There should be no configuration returned without the config handle and arguments",
       config); //$NON-NLS-1$
 }
コード例 #10
0
 /**
  * Tests the {@link
  * BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map,
  * String[])} method. <br>
  * <br>
  * Tests the argument map with a valid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute
  * with the project prefix and a valid config path
  *
  * @throws Exception
  */
 public void testConfigFromBuildCommandArgs7() throws Exception {
   createExternalToolBuilder(getProject(), "testConfigFromBuildCommandArgs7", null); // $NON-NLS-1$
   Map<String, String> args = new HashMap<>();
   args.put(
       BuilderCoreUtils.LAUNCH_CONFIG_HANDLE,
       "<project>/.externalToolBuilders/testConfigFromBuildCommandArgs7.launch"); //$NON-NLS-1$
   ILaunchConfiguration config =
       BuilderCoreUtils.configFromBuildCommandArgs(
           getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1});
   assertNotNull("There should be a configuration returned", config); // $NON-NLS-1$
 }
コード例 #11
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest#setUp()
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   // create the external tool builder dir
   BuilderCoreUtils.getBuilderFolder(getProject(), true);
 }