コード例 #1
0
  public void testEditedBuildConfig() throws Exception {
    // only test in 2.3 and greater
    if (GrailsVersion.V_2_3_.compareTo(GrailsVersion.MOST_RECENT) > 0) {
      return;
    }
    ensureDefaultGrailsVersion(GrailsVersion.MOST_RECENT);

    final IProject proj = ensureProject(TEST_PROJECT_NAME);
    IFile buildConfig = proj.getFile("grails-app/conf/BuildConfig.groovy");
    String origContents = GrailsTest.getContents(buildConfig);
    //        System.out.println("=== BuildConfig.groovy ====");
    //        System.out.println(origContents);
    //        System.out.println("=== BuildConfig.groovy ====");

    // Modify the props file add two plugins
    // A bit of a hack, but this is a simple way to add plugins to the build
    String newContents =
        origContents.replace("plugins {\n", "plugins {" + "\n\t\tcompile \":feeds:1.6\"\n");
    GrailsTest.setContents(buildConfig, newContents);

    refreshDependencies(proj);

    // Check that the plugins linked source folders are now there.
    new ACondition("installed feeds-1.6") {
      @Override
      public boolean test() throws Exception {
        assertPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");
        return true;
      }
    }.waitFor(60000);

    // /////////////////////////////////////////////////////////////
    // Now remove the plugins and try this again

    //	        props.remove("plugins.feeds");
    //	        props.remove("plugins.spring-security-core");
    GrailsTest.setContents(buildConfig, origContents);

    // Refresh dependencies
    refreshDependencies(proj);

    // Check that the linked source folders of the replaced version are no
    // longer there.
    new ACondition("removed feeds") {
      @Override
      public boolean test() throws Exception {
        // Check that the linked source folders of the plugin are no
        // longer there.
        assertAbsentPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");

        return true;
      }
    }.waitFor(10000);
  }
コード例 #2
0
  public void testTagLibsFromPlugin() throws Exception {

    IProject proj = ensureProject(TEST_PROJECT_NAME);
    ensureDefaultGrailsVersion(GrailsVersion.getGrailsVersion(proj));

    if (GrailsVersion.V_2_3_.compareTo(GrailsVersion.MOST_RECENT) > 0) {
      // below 2.3 install-plugin command works
      GrailsCommand cmd =
          GrailsCommand.forTest(proj, "install-plugin").addArgument("feeds").addArgument("1.6");
      cmd.synchExec();
    } else {
      // after 2.3, must edit build config
      IFile buildConfig = proj.getFile("grails-app/conf/BuildConfig.groovy");
      String origContents = GrailsTest.getContents(buildConfig);

      // Modify the props file add two plugins
      // A bit of a hack, but this is a simple way to add plugins to the build
      String newContents =
          origContents.replace("plugins {\n", "plugins {\n\t\tcompile \":feeds:1.6\"\n");
      GrailsTest.setContents(buildConfig, newContents);
    }
    refreshDependencies(proj);

    assertPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");

    // now also check to see that the tag is available
    PerProjectTagProvider provider = GrailsCore.get().connect(proj, PerProjectTagProvider.class);
    assertNotNull("feeds:meta tag not installed", provider.getDocumentForTagName("feed:meta"));
  }
コード例 #3
0
  public void testEditedBuildConfig() throws Exception {
    // only test in 2.3 and greater
    if (GrailsVersion.V_2_3_.compareTo(GrailsVersion.MOST_RECENT) > 0) {
      return;
    }
    ensureDefaultGrailsVersion(GrailsVersion.MOST_RECENT);

    IProject proj = ensureProject(TEST_PROJECT_NAME);
    IFile buildConfig = proj.getFile("grails-app/conf/BuildConfig.groovy");
    String origContents = GrailsTest.getContents(buildConfig);

    // Modify the props file add two plugins
    // A bit of a hack, but this is a simple way to add plugins to the build
    String newContents =
        origContents.replace(
            "plugins {\n",
            "plugins {\n\t\tcompile \":feeds:1.6\"\n\t\tcompile \":spring-security-core:1.2.7.3\"\n");
    GrailsTest.setContents(buildConfig, newContents);
    refreshDependencies(proj);

    // Check that the plugins linked source folders are now there.
    assertPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");
    assertPluginSourceFolder(proj, "spring-security-core-1.2.7.3", "src", "groovy");

    // /////////////////////////////////////////////////////////////
    // Now modify the version of the plugins and try this again

    String newContents2 =
        origContents.replace(
            "plugins {\n",
            "plugins {\n\t\tcompile \":feeds:1.6\"\n\t\tcompile \":spring-security-core:1.2.7.2\"\n");
    GrailsTest.setContents(buildConfig, newContents2);
    refreshDependencies(proj);

    // Check that the linked source folders of the replaced version are no
    // longer there.
    assertAbsentPluginSourceFolder(proj, "spring-security-core-1.2.7.3", "src", "groovy");

    // Check that the linked source folders of the new versions are there.
    assertPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");
    assertPluginSourceFolder(proj, "spring-security-core-1.2.7.2", "src", "groovy");

    // /////////////////////////////////////////////////////////////
    // Now remove the plugins and try this again

    //	        props.remove("plugins.feeds");
    //	        props.remove("plugins.spring-security-core");
    GrailsTest.setContents(buildConfig, origContents);

    // Refresh dependencies
    refreshDependencies(proj);

    // Check that the linked source folders of the replaced version are no
    // longer there.
    assertAbsentPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");
    assertAbsentPluginSourceFolder(proj, "spring-security-core-1.2.7.3", "src", "groovy");

    // Check that the linked source folders of the new versions are also no
    // longer there.
    assertAbsentPluginSourceFolder(proj, "feeds-1.6", "src", "groovy");
    assertAbsentPluginSourceFolder(proj, "spring-security-core-1.2.7.2", "src", "groovy");
  }