コード例 #1
0
  @Test
  @Ignore
  public void testNewLiferayModuleProjectDefaultValueServiceIsListeningToProjectTemplateName()
      throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();

    op.setProjectName("my.test.project");

    op.setProjectTemplateName("activator");

    assertEquals("MyTestProject", op.getComponentName().content(true));

    op.setProjectTemplateName("portlet");

    assertEquals("MyTestProject", op.getComponentName().content(true));

    op.setProjectTemplateName("mvc-portlet");

    assertEquals("MyTestProject", op.getComponentName().content(true));

    op.setProjectTemplateName("service");

    assertEquals("MyTestProject", op.getComponentName().content(true));

    op.setProjectTemplateName("service-wrapper");

    assertEquals("MyTestProject", op.getComponentName().content(true));

    op.setProjectTemplateName("service-builder");

    assertEquals("MyTestProject", op.getComponentName().content(true));
  }
コード例 #2
0
  @Test
  public void testNewLiferayModuleProjectNewProperties() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();

    op.setProjectName("test-properties-in-portlet");

    op.setProjectTemplateName("portlet");
    op.setComponentName("Test");

    PropertyKey pk = op.getPropertyKeys().insert();

    pk.setName("property-test-key");
    pk.setValue("property-test-value");

    Status exStatus =
        NewLiferayModuleProjectOpMethods.execute(
            op, ProgressMonitorBridge.create(new NullProgressMonitor()));

    assertEquals("OK", exStatus.message());

    IProject modPorject = CoreUtil.getProject(op.getProjectName().content());
    modPorject.open(new NullProgressMonitor());

    SearchFilesVisitor sv = new SearchFilesVisitor();
    List<IFile> searchFiles = sv.searchFiles(modPorject, "TestPortlet.java");
    IFile componentClassFile = searchFiles.get(0);

    assertEquals(componentClassFile.exists(), true);

    String actual = CoreUtil.readStreamToString(componentClassFile.getContents());

    assertTrue(actual, actual.contains("\"property-test-key=property-test-value\""));
  }
コード例 #3
0
  @Test
  @Ignore
  public void testNewLiferayModuleProjectDefaultValueServiceDots() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();

    op.setProjectName("my.test.project");

    op.setProjectTemplateName("portlet");

    assertEquals("MyTestProject", op.getComponentName().content(true));
  }
コード例 #4
0
  @Test
  @Ignore
  public void testNewLiferayModuleProjectPackageDefaultValueService() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();

    op.setProjectName("my-test-project");

    op.setProjectTemplateName("Portlet");

    assertEquals("my.test.project", op.getPackageName().content(true));

    op.setProjectName("my.test.foo");

    assertEquals("my.test.foo", op.getPackageName().content(true));

    op.setProjectName("my_test_foo1");

    op.setProjectTemplateName("ServiceWrapper");

    assertEquals("my.test.foo1", op.getPackageName().content(true));
  }