コード例 #1
0
  public void testDeployment() throws IOException {
    final String CONTROL_TEXT = "ControlTextABC";
    Node openFile =
        new Node(
            new ProjectsTabOperator().getProjectRootNode(EJBValidation.EJB_PROJECT_NAME),
            Bundle.getStringTrimmed(
                    "org.netbeans.modules.j2ee.ejbjar.project.ui.Bundle", "LBL_node")
                + "|TestingSession");
    new OpenAction().performAPI(openFile);
    EditorOperator editorOper = new EditorOperator("TestingSessionBean.java");
    editorOper.replace("return null;", "return \"" + CONTROL_TEXT + "\";");

    openFile =
        new Node(new SourcePackagesNode(EJBValidation.WEB_PROJECT_NAME), "test|TestingServlet");
    new OpenAction().performAPI(openFile);
    editorOper = new EditorOperator("TestingServlet.java");
    editorOper.replace(
        "out.println(\"</body>\");",
        "out.println(lookupTestingSessionBeanLocal().testBusinessMethod1());");

    // select in Files view to prevent unstable scrolling in low display resolution
    openFile =
        new Node(
            FilesTabOperator.invoke().getProjectNode(EJBValidation.EJB_PROJECT_NAME),
            "src|java|test|TestingEntityRemote.java");
    new OpenAction().performAPI(openFile);
    editorOper = new EditorOperator("TestingEntityRemote.java");
    editorOper.replace("int getCmpTestField2x();", "int getCmpTestField2x() throws Exception;");
    editorOper.replace(
        "void setCmpTestField2x(int cmpTestField2x);",
        "void setCmpTestField2x(int cmpTestField2x) throws Exception;");

    String page =
        Utils.deploy(
            EAR_PROJECT_NAME, "http://localhost:8080/TestingEntApp-WebModule/TestingServlet", true);
    log(page);
    assertTrue(
        "TestingServlet doesn't contain expected text '"
            + CONTROL_TEXT
            + "'. See log for page content.",
        page.contains(CONTROL_TEXT));
  }