public ProcessResult processSms(Sms sms, Map<String, Object> accumulatedData) { if (sms.getType() != Sms.SMS_TYPE_SENT) { return null; } ProcessResult ret = new ProcessResult(); ret.price = smsPrice; ret.type = Type.INSIDE_PLAN; return ret; }
@Test public void whenAppBuckFileRemovedThenRebuildFails() throws IOException, InterruptedException { AssumeAndroidPlatform.assumeSdkIsAvailable(); final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "file_watching", tmp); workspace.setUp(); ProcessResult result = workspace.runBuckdCommand("build", "app"); result.assertSuccess(); String fileName = "apps/myapp/BUCK"; Files.delete(workspace.getPath(fileName)); workspace.runBuckdCommand("build", "app").assertFailure(); }
/** @param exitValue The exit value */ public InvalidExitValueException(ProcessResult result, Collection<Integer> allowedExitValues) { super( "Unexpected exit value: " + result.exitValue() + ", allowed exit values: " + allowedExitValues); this.result = result; }
public ProcessResult processCall(Call call, Map<String, Object> accumulatedData) { if (call.getType() != Call.CALL_TYPE_SENT) { return null; } Long secondsTotal = (Long) accumulatedData.get(ACCUMULATED_DATA_SECONDS); if (secondsTotal == null) { secondsTotal = new Long(0); } secondsTotal += call.getDuration(); accumulatedData.put(ACCUMULATED_DATA_SECONDS, secondsTotal); ProcessResult ret = new ProcessResult(); if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) { ret.price = 0.0; ret.type = Type.ZERO; } else { boolean insidePlan = secondsTotal <= maxSecondsMonth; if (insidePlan) { ret.price = 0.0; ret.type = Type.INSIDE_PLAN; } else { long duration = (secondsTotal > maxSecondsMonth) && (secondsTotal - call.getDuration() <= maxSecondsMonth) ? secondsTotal - maxSecondsMonth : call.getDuration(); ret.price = initialPrice + (duration * pricePerSecond); ret.type = Type.OUTSIDE_PLAN; } } return ret; }
@Test public void whenAppBuckFileInvalidatedThenRebuildFails() throws IOException, InterruptedException { AssumeAndroidPlatform.assumeSdkIsAvailable(); final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "file_watching", tmp); workspace.setUp(); workspace.runBuckdCommand("build", "app").assertSuccess(); String fileName = "apps/myapp/BUCK"; Files.write(workspace.getPath(fileName), "Some Illegal Python".getBytes(Charsets.US_ASCII)); ProcessResult result = workspace.runBuckdCommand("build", "app"); assertThat( "Failure should be due to syntax error.", result.getStderr(), containsString("SyntaxError: invalid syntax")); result.assertFailure(); }
private void execProcess(String process, ProcessResult processresult) throws KettleException { Process p = null; try { String errorMsg = null; // execute process try { p = data.runtime.exec(process); } catch (Exception e) { errorMsg = e.getMessage(); } if (p == null) { processresult.setErrorStream(errorMsg); } else { // get output stream processresult.setOutputStream( getOutputString(new BufferedReader(new InputStreamReader(p.getInputStream())))); // get error message processresult.setErrorStream( getOutputString(new BufferedReader(new InputStreamReader(p.getErrorStream())))); // Wait until end p.waitFor(); // get exit status processresult.setExistStatus(p.exitValue()); } } catch (IOException ioe) { throw new KettleException("IO exception while running the process " + process + "!", ioe); } catch (InterruptedException ie) { throw new KettleException( "Interrupted exception while running the process " + process + "!", ie); } catch (Exception e) { throw new KettleException(e); } finally { if (p != null) { p.destroy(); } } }
@Test public void whenBuckBuiltTwiceLogIsPresent() throws IOException, InterruptedException { AssumeAndroidPlatform.assumeSdkIsAvailable(); final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "file_watching", tmp); workspace.setUp(); workspace.runBuckdCommand("build", "//java/com/example/activity:activity").assertSuccess(); Path buildLogFile = workspace.getPath("buck-out/bin/build.log"); assertTrue(Files.isRegularFile(buildLogFile)); Files.delete(buildLogFile); ProcessResult rebuild = workspace.runBuckdCommand("build", "//java/com/example/activity:activity"); rebuild.assertSuccess(); buildLogFile = workspace.getPath("buck-out/bin/build.log"); assertTrue(Files.isRegularFile(buildLogFile)); }
/** * This verifies that a client disconnection will be detected by a Nailgun NGInputStream reading * from an empty heartbeat stream and that the generated InterruptedException will interrupt * command execution causing it to fail. */ @Test public void whenClientDisconnectionDetectedThenTestIsInterrupted() throws InterruptedException, IOException { // Sub process interruption not supported on Windows. assumeTrue(Platform.detect() != Platform.WINDOWS); final long timeoutMillis = 2000; // Stream timeout > test timeout. final long disconnectMillis = 100; // Disconnect before test timeout. final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "exclusive_execution", tmp); workspace.setUp(); // Start with an input stream that sends heartbeats at a regular rate. final DelegatingInputStream inputStream = new DelegatingInputStream(TestContext.createHeartBeatStream(timeoutMillis / 10)); // Build an NGContext connected to an NGInputStream reading from stream that will timeout. try (TestContext context = new TestContext(ImmutableMap.copyOf(System.getenv()), inputStream, timeoutMillis)) { BuckEventListener listener = new BuckEventListener() { @Subscribe @SuppressWarnings("unused") public void onEvent(TestRunEvent.Started event) { // When tests start running, make the heartbeat stream simulate a disconnection. inputStream.setDelegate(TestContext.createDisconnectionStream(disconnectMillis)); } @Override public void outputTrace(BuildId buildId) throws InterruptedException { // do nothing } }; ProcessResult result = workspace.runBuckdCommand(context, listener, "test", "//:test"); result.assertFailure(); assertThat(result.getStderr(), containsString("InterruptedException")); } }
/** * This verifies that a client timeout will be detected by a Nailgun NGInputStream reading from an * empty heartbeat stream and that the generated InterruptedException will cause command execution * to fail after timeout. */ @Test public void whenClientDisconnectionDetectedThenBuildIsInterrupted() throws InterruptedException, IOException { // Sub process interruption not supported on Windows. assumeTrue(Platform.detect() != Platform.WINDOWS); final long timeoutMillis = 2000; // Stream timeout > test timeout. final long disconnectMillis = 100; // Disconnect before test timeout. final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "exclusive_execution", tmp); workspace.setUp(); // Build an NGContext connected to an NGInputStream reading from stream that will timeout. try (TestContext context = new TestContext( ImmutableMap.copyOf(System.getenv()), TestContext.createDisconnectionStream(disconnectMillis), timeoutMillis)) { ProcessResult result = workspace.runBuckdCommand(context, "build", "//:sleep"); result.assertFailure(); assertThat(result.getStderr(), containsString("InterruptedException")); } }
@Override protected void setProcess() { // ---------------------------------------------------------------------- // ------------------------------2Failed-01------------------------------ // ---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.5.2.1-2Failed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.NOT_PERTINENT_SUMMARY_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); EvidenceElement ee = processRemark.getElementList().iterator().next(); assertEquals("", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-2Failed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.NOT_PERTINENT_SUMMARY_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("#^;:/", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-2Failed-03"); // check number of elements in the page assertEquals(3, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(3, processResult.getRemarkSet().size()); Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator(); processRemark = (SourceCodeRemark) iter.next(); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.NOT_PERTINENT_SUMMARY_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) iter.next(); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals( RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_SUMMARY_PERTINENCE_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("Summary of table without marker", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) iter.next(); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals( RemarkMessageStore.CHECK_NATURE_OF_TABLE_FOR_NOT_PERTINENT_SUMMARY_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("$$##''''", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-01-------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-3NMI-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals( RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_SUMMARY_PERTINENCE_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("Summary of not identified table", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-02-------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-3NMI-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals( RemarkMessageStore.CHECK_SUMMARY_PERTINENCE_FOR_DATA_TABLE_MSG, processRemark.getMessageCode()); assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT)); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals("Summary of data table", ee.getValue()); assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------4NA-01---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-02---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-4NA-02"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-03---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.5.2.1-4NA-03"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); }
/** Processes the HTTP request, */ protected void processRequest( HttpServletRequest request, HttpServletResponse response, String request_type) throws ServletException, IOException { try { // Is this a dispatch? Object consume_status_key = request.getAttribute(AsyncServletProcessUtil.CONSUME_STATUS_KEY); // Make a process client, PlatformContext ctx = PlatformContextFactory.getPlatformContext(); ProcessInputMessage result; ProcessResult result_ob; // Is this the continuation init? if (consume_status_key == null) { Cookie pid_cookie = null; // The process id cookie, Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie c : cookies) { String cname = c.getName(); if (cname.equals("pid")) { pid_cookie = c; } } } if (pid_cookie == null) { // Give a friendlier error message here? response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Session cookie not found"); return; } // Get the cookie's value, String process_id_str = pid_cookie.getValue(); AppServiceProcessClient process_client = ctx.getAppServiceProcessClient(); ProcessId process_id = ProcessId.fromString(process_id_str); String ip_addr = request.getRemoteAddr(); // Check if the process is valid, ProcessMessage msg_to_send = ByteArrayProcessMessage.encodeArgs("?", null, null, ip_addr); // Invoke the function on the process id, result_ob = process_client.invokeFunction(process_id, msg_to_send, true); request.setAttribute(getClass().getName(), result_ob); result = result_ob.getResult(AsyncServletProcessUtil.createNotifier(request)); if (result == null) { // Set timeout to 30 seconds, request.getAsyncContext().setTimeout(30 * 1000); return; } } // Not initial, else { result_ob = (ProcessResult) request.getAttribute(getClass().getName()); result = result_ob.getResult(); } // This would be a timeout, if (result == null) { response.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Timed out waiting for response"); return; } if (result.getType() == ProcessInputMessage.Type.RETURN_EXCEPTION) { throw new ServletException(result.getError()); } // Ok, we now have our result from the process, Object[] args = ByteArrayProcessMessage.decodeArgsList(result.getMessage(), 0); String resp = (String) args[0]; if (!resp.equals("OK")) { throw new RuntimeException("Invalid response from process: " + resp); } // The user of the process, String username = (String) args[1]; // Ok, everything looks good to go, String location; String html_body; // Context info, String context_path = request.getContextPath(); if (context_path == null) context_path = ""; if (context_path.equals("/")) context_path = ""; String servlet_path = request.getServletPath(); String path_info = request.getPathInfo(); if (path_info == null) path_info = "/"; // Create the response, DDBResourceAccess mckoi_access = ctx.getDDBResourceAccess(); // Parse the link, StringBuilder request_link = new StringBuilder(); request_link.append(context_path); request_link.append(servlet_path); request_link.append(path_info); // Sub-part, int delim = path_info.lastIndexOf("/"); String path_p = path_info.substring(0, delim); if (path_p.startsWith("/")) { path_p = path_p.substring(1); } // 'path_p' now contains the path we are looking at, // If no path_p, if (path_p.equals("")) { String link_prepend = context_path + servlet_path + "/"; location = "Path List"; html_body = pathListSummary(mckoi_access, link_prepend); } else { ODBTransaction t = mckoi_access.createODBTransaction(path_p); // Extract the location, delim = request_link.lastIndexOf("/"); location = request_link.substring(delim + 1); String link_prepend = request_link.substring(0, delim + 1); // Get the 'pos' and 'size' vars if they exist, String pos = request.getParameter("pos"); String size = request.getParameter("size"); if (pos != null) { location = location + "?pos=" + pos + "&size=" + size; } if (location.equals("")) { location = "Path: " + path_p; html_body = ODBPathSummary(t, path_p, link_prepend); } else { // Get the formatter, ODBHTMLFormatter formatter = new ODBHTMLFormatter(t, link_prepend); // Format it, html_body = formatter.format(location); } } response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title>DBBrowser - " + HTMLWriter.toHTMLEntity(location) + "</title>"); out.println("<style type=\"text/css\">"); out.println(" table { border: 1px solid #000000; border-collapse: collapse; }"); out.println( " td { border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0px 6px 0px 6px; }"); out.println(" th { background: #000000; color: #FFFFFF; }"); out.println(" table.oblist { font-family:monospace; }"); out.println(" table.data { border: none; border-collapse: collapse; }"); out.println( " table.data td { border-left: none; border-right: none; padding: 2px 12px 2px 12px; }"); out.println("</style>"); out.println("</head>"); out.println("<body>"); out.println(html_body); out.println("</body>"); out.println("</html>"); } finally { out.close(); } } catch (Throwable e) { // Output the error message, response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title>DBBrowser - error when producing page.</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>" + HTMLWriter.toHTMLEntity(e.getMessage()) + "</h1>"); out.print("<pre>"); StringWriter str_out = new StringWriter(); PrintWriter pout = new PrintWriter(str_out); e.printStackTrace(pout); pout.flush(); out.print(HTMLWriter.toHTMLEntity(str_out.toString())); out.println("</pre>"); out.println("</body>"); out.println("</html>"); } finally { out.close(); } } }
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (ExecProcessMeta) smi; data = (ExecProcessData) sdi; Object[] r = getRow(); // Get row from input rowset & set row busy! if (r == null) { // no more input to be expected... setOutputDone(); return false; } if (first) { first = false; // get the RowMeta data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; meta.getFields(data.outputRowMeta, getStepname(), null, null, this, repository, metaStore); // Check is process field is provided if (Const.isEmpty(meta.getProcessField())) { logError(BaseMessages.getString(PKG, "ExecProcess.Error.ProcessFieldMissing")); throw new KettleException( BaseMessages.getString(PKG, "ExecProcess.Error.ProcessFieldMissing")); } // cache the position of the field if (data.indexOfProcess < 0) { data.indexOfProcess = data.previousRowMeta.indexOfValue(meta.getProcessField()); if (data.indexOfProcess < 0) { // The field is unreachable ! logError( BaseMessages.getString(PKG, "ExecProcess.Exception.CouldnotFindField") + "[" + meta.getProcessField() + "]"); throw new KettleException( BaseMessages.getString( PKG, "ExecProcess.Exception.CouldnotFindField", meta.getProcessField())); } } } // End If first Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size()); for (int i = 0; i < data.NrPrevFields; i++) { outputRow[i] = r[i]; } // get process to execute String processString = data.previousRowMeta.getString(r, data.indexOfProcess); ProcessResult processResult = new ProcessResult(); try { if (Const.isEmpty(processString)) { throw new KettleException(BaseMessages.getString(PKG, "ExecProcess.ProcessEmpty")); } // execute and return result execProcess(processString, processResult); if (meta.isFailWhenNotSuccess()) { if (processResult.getExistStatus() != 0) { String errorString = processResult.getErrorStream(); if (Const.isEmpty(errorString)) { errorString = processResult.getOutputStream(); } throw new KettleException(errorString); } } // Add result field to input stream int rowIndex = data.NrPrevFields; outputRow[rowIndex++] = processResult.getOutputStream(); // Add result field to input stream outputRow[rowIndex++] = processResult.getErrorStream(); // Add result field to input stream outputRow[rowIndex++] = processResult.getExistStatus(); // add new values to the row. putRow(data.outputRowMeta, outputRow); // copy row to output rowset(s); if (log.isRowLevel()) { logRowlevel( BaseMessages.getString( PKG, "ExecProcess.LineNumber", getLinesRead() + " : " + getInputRowMeta().getString(r))); } } catch (KettleException e) { boolean sendToErrorRow = false; String errorMessage = null; if (getStepMeta().isDoingErrorHandling()) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError(BaseMessages.getString(PKG, "ExecProcess.ErrorInStepRunning") + e.getMessage()); setErrors(1); stopAll(); setOutputDone(); // signal end to receiver(s) return false; } if (sendToErrorRow) { // Simply add this row to the error row putError( getInputRowMeta(), r, 1, errorMessage, meta.getResultFieldName(), "ExecProcess001"); } } return true; }
@Override protected void setProcess() { // ---------------------------------------------------------------------- // ------------------------------1Passed-01------------------------------ // ---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.06.06.01-1Passed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------1Passed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-1Passed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------1Passed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-1Passed-03"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------1Passed-04------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-1Passed-04"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------1Passed-05------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-1Passed-05"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------2Failed-01------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-2Failed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.EMPTY_LINK_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.A_ELEMENT, processRemark.getTarget()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); assertTrue( processRemark.getElementList().iterator().next().getValue().contains("my-link.html")); assertEquals( AttributeStore.HREF_ATTR, processRemark.getElementList().iterator().next().getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-2Failed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.EMPTY_LINK_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.A_ELEMENT, processRemark.getTarget()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); assertTrue( processRemark.getElementList().iterator().next().getValue().contains("my-link.html")); assertEquals( AttributeStore.HREF_ATTR, processRemark.getElementList().iterator().next().getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-2Failed-03"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.EMPTY_LINK_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.A_ELEMENT, processRemark.getTarget()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); assertTrue( processRemark.getElementList().iterator().next().getValue().contains("my-link.html")); assertEquals( AttributeStore.HREF_ATTR, processRemark.getElementList().iterator().next().getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-04------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-2Failed-04"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.EMPTY_LINK_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.A_ELEMENT, processRemark.getTarget()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); assertTrue( processRemark.getElementList().iterator().next().getValue().contains("my-link.html")); assertEquals( AttributeStore.HREF_ATTR, processRemark.getElementList().iterator().next().getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-05------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-2Failed-05"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.EMPTY_LINK_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.A_ELEMENT, processRemark.getTarget()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); assertTrue( processRemark.getElementList().iterator().next().getValue().contains("my-link.html")); assertEquals( AttributeStore.HREF_ATTR, processRemark.getElementList().iterator().next().getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------4NA-01---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.06.06.01-4NA-01"); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); }
@Override protected void setProcess() { // ---------------------------------------------------------------------- // ------------------------------1Passed-01------------------------------ // ---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.2.2-1Passed-01"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------1Passed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-1Passed-02"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------1Passed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-1Passed-03"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------1Passed-04------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-1Passed-04"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(3, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------1Passed-05------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-1Passed-05"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------2Failed-01------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-2Failed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); Iterator<EvidenceElement> iter = processRemark.getElementList().iterator(); EvidenceElement ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-2Failed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-2Failed-03"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-04------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-2Failed-04"); // check number of elements in the page assertEquals(3, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(3, processResult.getRemarkSet().size()); Iterator<ProcessRemark> pIter = processResult.getRemarkSet().iterator(); processRemark = (SourceCodeRemark) pIter.next(); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) pIter.next(); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) pIter.next(); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-05------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-2Failed-05"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-01--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-02--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-03--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-03"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-04--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-04"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-05--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-05"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------3NMI-06--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-3NMI-06"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals( RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------4NA-01---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-02---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-02"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-03---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-03"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-04---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-04"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-05---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-05"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-06---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-06"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-07---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-07"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-08---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-08"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-09---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-09"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); // ---------------------------------------------------------------------- // ------------------------------4NA-10---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-10"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); }
/** @return the exit value of the finished process. */ public int exitValue() { return result.exitValue(); }
public synchronized boolean equals(Object obj) { if (!(obj instanceof ProcessResult)) return false; ProcessResult other = (ProcessResult) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.actorIds == null && other.getActorIds() == null) || (this.actorIds != null && java.util.Arrays.equals(this.actorIds, other.getActorIds()))) && ((this.entityId == null && other.getEntityId() == null) || (this.entityId != null && this.entityId.equals(other.getEntityId()))) && ((this.errors == null && other.getErrors() == null) || (this.errors != null && java.util.Arrays.equals(this.errors, other.getErrors()))) && ((this.instanceId == null && other.getInstanceId() == null) || (this.instanceId != null && this.instanceId.equals(other.getInstanceId()))) && ((this.instanceStatus == null && other.getInstanceStatus() == null) || (this.instanceStatus != null && this.instanceStatus.equals(other.getInstanceStatus()))) && ((this.newWorkitemIds == null && other.getNewWorkitemIds() == null) || (this.newWorkitemIds != null && java.util.Arrays.equals(this.newWorkitemIds, other.getNewWorkitemIds()))) && this.success == other.isSuccess(); __equalsCalc = null; return _equals; }
@Override protected void setProcess() { // ---------------------------------------------------------------------- // ---------------------------1Passed-01--------------------------------- // ---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.8.8.1-1Passed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ---------------------------1Passed-02--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-1Passed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ---------------------------1Passed-03--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-1Passed-03"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ---------------------------1Passed-04--------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-1Passed-04"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check number of remarks and their value assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------2Failed-01------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-2Failed-01"); assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals( RemarkMessageStore.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); Iterator<EvidenceElement> pIter = processRemark.getElementList().iterator(); EvidenceElement ee = pIter.next(); assertEquals("fren-FR", ee.getValue()); assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-02------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-2Failed-02"); assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(RemarkMessageStore.WRONG_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); pIter = processRemark.getElementList().iterator(); ee = pIter.next(); assertEquals("aq", ee.getValue()); assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-03------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-2Failed-03"); assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals( RemarkMessageStore.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); pIter = processRemark.getElementList().iterator(); ee = pIter.next(); assertEquals("french", ee.getValue()); assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-04------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-2Failed-04"); assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals( RemarkMessageStore.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); pIter = processRemark.getElementList().iterator(); ee = pIter.next(); assertEquals("fr-F", ee.getValue()); assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------2Failed-05------------------------------ // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-2Failed-05"); assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals( RemarkMessageStore.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode()); assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); pIter = processRemark.getElementList().iterator(); ee = pIter.next(); assertEquals("fr/FR", ee.getValue()); assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------4NA-01---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------4NA-02---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.8.8.1-4NA-02"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); }
@Override protected void setProcess() { // ---------------------------------------------------------------------- // ------------------------------3NMI-01------------------------------ // ---------------------------------------------------------------------- ProcessResult processResult = processPageTest("Rgaa22.Test.3.12-3NMI-01"); // check number of elements in the page assertEquals(3, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(3, processResult.getRemarkSet().size()); Iterator<ProcessRemark> pIter = processResult.getRemarkSet().iterator(); SourceCodeRemark processRemark = (SourceCodeRemark) pIter.next(); assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(2, processRemark.getElementList().size()); Iterator<EvidenceElement> iter = processRemark.getElementList().iterator(); EvidenceElement ee = iter.next(); assertEquals("", ee.getValue()); assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode()); ee = iter.next(); assertEquals("attribute-absent", ee.getValue()); assertEquals(TITLE_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) pIter.next(); assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(2, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertEquals("Input label", ee.getValue()); assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode()); ee = iter.next(); assertEquals("", ee.getValue()); assertEquals(TITLE_ATTR, ee.getEvidence().getCode()); processRemark = (SourceCodeRemark) pIter.next(); assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode()); assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue()); assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(2, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertEquals("", ee.getValue()); assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode()); ee = iter.next(); assertEquals("Input label", ee.getValue()); assertEquals(TITLE_ATTR, ee.getEvidence().getCode()); // ---------------------------------------------------------------------- // ------------------------------4NA-01---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("Rgaa22.Test.3.12-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // ---------------------------------------------------------------------- // ------------------------------4NA-02---------------------------------- // ---------------------------------------------------------------------- processResult = processPageTest("Rgaa22.Test.3.12-4NA-02"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); }