示例#1
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"));
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    project = ensureProject("bart");
    // On build server, some tests are failing because mismatching grails version (default
    // install was modified by some other tests, since creating the bart project?)
    ensureDefaultGrailsVersion(GrailsVersion.getGrailsVersion(project));
  }
示例#3
0
  public void testOutputLimit() throws Exception {
    IProject proj = ensureProject(TEST_PROJECT_NAME);
    ensureDefaultGrailsVersion(GrailsVersion.getGrailsVersion(proj));

    GrailsCommand cmd = GrailsCommand.forTest("help");
    ILaunchResult result = cmd.synchExec();
    //		String allOutput = result.getOutput();

    int orgLimit = GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit();
    try {
      GrailsCoreActivator.getDefault().setGrailsCommandOutputLimit(100);
      result = cmd.synchExec();
      assertEquals(100, result.getOutput().length());

    } finally {
      GrailsCoreActivator.getDefault().setGrailsCommandOutputLimit(orgLimit);
    }
  }