Package org.eclipse.wst.wsi.internal.core.report

Examples of org.eclipse.wst.wsi.internal.core.report.AssertionResult


            {
              Iterator iassertionResults = assertionResults.values().iterator();

              while (iassertionResults.hasNext())
              {
                AssertionResult ar = (AssertionResult) iassertionResults.next();
                TestAssertion ta = ar.getAssertion();
                // add in to skip errors for assertions that are reporting incorrect problems.
                // This allows us to not report incorrect errors reported in the tools without disabling them
                //              String assertionId = ta.getId();
                //              boolean ignoreAssertion = false;
                //              for(int i = ignoreAssertions.length-1; i >=0;i--)
                //              {
                //                if(ignoreAssertions[i].equalsIgnoreCase(assertionId))
                //                {
                //                  ignoreAssertion = true;
                //                }
                //              }
                //              if(ignoreAssertion)
                //              {
                //                continue;
                //              }
                if (ar.getResult().equalsIgnoreCase(FAILED) &&
                  wsiPreferences.getComplianceLevel().equals(WSITestToolsProperties.STOP_NON_WSI))
                {
                  if (ta.isEnabled())
                  {
                    List errorMessageList = ar.getFailureDetailList();
                    if (errorMessageList != null)
                    {
                      Iterator errorMessages = errorMessageList.iterator();

                      while (errorMessages.hasNext())
                      {
                        FailureDetailImpl fdi = (FailureDetailImpl) errorMessages.next();
                        int lineNumber = 0;
                        int columnNumber = 0;

                        ElementLocation el = fdi.getElementLocation();

                        if (el != null)
                        {
                          lineNumber = el.getLineNumber();
                          columnNumber = el.getColumnNumber();
                        }

                        assertionerrors.add(
                          new AssertionError(ta.getId(), ta.getFailureMessage(), lineNumber, columnNumber));
                      }
                    }
                    // the errorMessageList is null but there is an error so assign it to line 0 for now
                    else
                    {
                      assertionerrors.add(new AssertionError(ta.getId(), ta.getFailureMessage(), 0, 0));
                    }
                  }
                }
                else if (ar.getResult().equalsIgnoreCase(FAILED) &&
                         wsiPreferences.getComplianceLevel().equals(WSITestToolsProperties.WARN_NON_WSI))
                {
                  if (ta.isEnabled())
                  {
                    List errorMessageList = ar.getFailureDetailList();
                    if (errorMessageList != null)
                    {
                      Iterator errorMessages = errorMessageList.iterator();
                      while (errorMessages.hasNext())
                      {
View Full Code Here


            {
              Iterator iassertionResults = assertionResults.values().iterator();

              while (iassertionResults.hasNext())
              {
                AssertionResult ar = (AssertionResult) iassertionResults.next();

                if (ar.getResult().equalsIgnoreCase(FAILED) &&
                  wsiPreferences.getComplianceLevel().equals(WSITestToolsEclipseProperties.STOP_NON_WSI))
                {
                  TestAssertion ta = ar.getAssertion();
                  if (ta.isEnabled())
                  {
                    Iterator errorMessages = ar.getFailureDetailList().iterator();
                    while (errorMessages.hasNext())
                    {
                      FailureDetailImpl fdi = (FailureDetailImpl)errorMessages.next();
                      int lineNumber = 0;
                      int columnNumber = 0;
                   
                      ElementLocation el = fdi.getElementLocation();

                      if (el != null)
                      {
                        lineNumber = el.getLineNumber();
                        columnNumber = el.getColumnNumber();
                      }

                      //TODO: get assertion locations in the log file
                      assertionerrors.add(
                        new AssertionError(
                        ta.getId(),
                        "Message ID " + entry.getReferenceID() + ":" + ta.getFailureMessage(),
                        lineNumber,
                        columnNumber));
                    }
                  }
                }
                else if (ar.getResult().equalsIgnoreCase(FAILED) &&
                         wsiPreferences.getComplianceLevel().equals(WSITestToolsEclipseProperties.WARN_NON_WSI))
                {
                  TestAssertion ta = ar.getAssertion();
                  if (ta.isEnabled())
                  {
                    Iterator errorMessages = ar.getFailureDetailList().iterator();
                    while (errorMessages.hasNext())
                    {
                      FailureDetailImpl fdi = (FailureDetailImpl)errorMessages.next();
                      int lineNumber = 0;
                      int columnNumber = 0;
View Full Code Here

    long startTime = 0;

    HashMap processList = new HashMap();
    TestAssertion testAssertion = null;
    AssertionProcess assertionProcess;
    AssertionResult assertionResult;

    TreeMap preReqResults;
    PrereqFailedList prereqFailedList;
    String preReqId;

    Class[] paramTypes = new Class[1];
    // If this is an instance of MessageValidator or EnvelopeValidator
    // then use BaseMessageValidator as a param type of assertions constructor
    paramTypes[0] = this instanceof BaseMessageValidator ?
      BaseMessageValidator.class : this.getClass();

    Object[] params = new Object[1];
    params[0] = this;

    // Get entry from context
    Entry entry = entryContext.getEntry();

    // Add entry to artifact
    this.reportArtifact.addEntry(entry);

    // Add entry to report
    if (this instanceof EnvelopeValidator)
       this.reporter.setCurrentEnvelopeEntry(entry);
  else this.reporter.setCurrentEntry(entry);

    try
    {
      // Go through the list of test assertions for the artifact
      Iterator iterator = profileArtifact.getTestAssertionList().iterator();
      while (iterator.hasNext())
      {
        // Get next test assertion
        testAssertion = (TestAssertion) iterator.next();

        // Reset variables
        assertionResult = null;

        // If the test assertion is enabled, then continue
        //        if ((testAssertion.isEnabled()) &&
        //            testAssertion.getEntryTypeName().equals(targetContext.getEntry().getEntryType().getTypeName())) {
        if (testAssertion.isEnabled()
          && isPrimaryEntryTypeMatch(testAssertion, entryContext))
        {
          try
          {
            // Add 1 to assertion processed count
            assertionCount++;

            // If the assertion process hasn't been created yet, then create it
            if ((assertionProcess =
              (AssertionProcess) processList.get(testAssertion.getId()))
              == null)
            {

              // Create a new assertion process
              Class assertionClass =
                Class.forName(classPrefix + testAssertion.getId());

              assertionProcess =
                (AssertionProcess) assertionClass.getConstructor(
                  paramTypes).newInstance(
                  params);

              // Add it to the list
              processList.put(testAssertion.getId(), assertionProcess);
            }

            // Check whether entry is null
            if (entry.getEntryDetail() == null)
            {
              assertionResult =
                createAssertionResult(
                  testAssertion,
                  AssertionResult.RESULT_MISSING_INPUT,
                  (String) null);
            }

            // Check to see if the test assertion should be run
            //if (isNotApplicable(testAssertion, entryContext)) {
            else if (isNotApplicable(testAssertion))
            {
              assertionResult =
                createAssertionResult(
                  testAssertion,
                  AssertionResult.RESULT_NOT_APPLICABLE,
                  (String) null);
            }
            else
            {
              // Processing all the assertion pre-requisites

              preReqResults = null;
              prereqFailedList = null;
              // Get list of pre-reqs for specified assertion
              Iterator i = testAssertion.getPrereqIdList().iterator();
              while (i.hasNext())
              {
                if (preReqResults == null)
                  preReqResults = new TreeMap();
                // Get next id
                preReqId = (String) i.next();
                // Get the prereq result
                AssertionResult preReqResult = reporter.getAssertionResult(preReqId);

                // Adding a result priority value to preReqResults
                preReqResults.put(
                  resultPriority.get(preReqResult.getResult()),
                  preReqResult.getResult());

                // If the prereq failed, then add it to the list
                if (((Integer)resultPriority.get(preReqResult.getResult())).intValue()
                  > MAX_VALID_PRIORITY)
                {
                  // Adding failed prereq ID to the list
                  if (prereqFailedList == null)
                    prereqFailedList = new PrereqFailedListImpl();
View Full Code Here

    TestAssertion testAssertion,
    String result,
    Vector failureDetailList)
  {
    // Create assertion result
    AssertionResult assertionResult = reporter.createAssertionResult();

    // Set values in assertion result
    assertionResult.setAssertion(testAssertion);
    assertionResult.setResult(result);
    assertionResult.setEntry(reporter.getReport().getCurrentEntry());

    // Set failure detail list
    assertionResult.setFailureDetailList(failureDetailList);

    return assertionResult;
  }
View Full Code Here

    TestAssertion testAssertion,
    String result,
    PrereqFailedList prereqFailedList)
  {
    // Create assertion result
    AssertionResult assertionResult = reporter.createAssertionResult();

    // Set values in assertion result
    assertionResult.setAssertion(testAssertion);
    assertionResult.setResult(result);
    assertionResult.setEntry(reporter.getReport().getCurrentEntry());
    assertionResult.setPrereqFailedList(prereqFailedList);

    return assertionResult;
  }
View Full Code Here

   */
  protected void addAssertionResult(String assertionId, String result)
    throws WSIException
  {
    // Create test assertion result
    AssertionResult assertionResult = reporter.createAssertionResult();

    // Set assertion, result and target
    assertionResult.setAssertion(profileArtifact.getTestAssertion(assertionId));
    assertionResult.setResult(result);
    assertionResult.setEntry(reporter.getReport().getCurrentEntry());

    // Add it to the report
    reporter.addAssertionResult(assertionResult);
  }
View Full Code Here

    String result,
    Vector failureDetailList)
    throws WSIException
  {
    // Create test assertion result
    AssertionResult assertionResult = reporter.createAssertionResult();

    // Set assertion, result and target
    assertionResult.setAssertion(profileArtifact.getTestAssertion(assertionId));
    assertionResult.setResult(result);
    assertionResult.setEntry(reporter.getReport().getCurrentEntry());
    assertionResult.setFailureDetailList(failureDetailList);

    // Add it to the report
    reporter.addAssertionResult(assertionResult);
  }
View Full Code Here

   */
  protected void addMissingInputResult(TestAssertion testAssertion)
    throws WSIException
  {
    // Create test assertion result
    AssertionResult assertionResult = reporter.createAssertionResult();

    // Set assertion, result and target
    assertionResult.setAssertion(testAssertion);
    assertionResult.setResult(AssertionResult.RESULT_MISSING_INPUT);
    assertionResult.setEntry(reporter.getReport().getCurrentEntry());

    // Add it to the report
    reporter.addAssertionResult(assertionResult);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.wsi.test.report.BuildReport#getAssertionResult(java.lang.String)
   */
  public AssertionResult getAssertionResult(String assertionId)
  {
    AssertionResult result = null;

    // Determine where to get the assertion result from
    if (this.prereqType.equals(PREREQ_TYPE_ENTRY))
      result = currentEntry.getAssertionResult(assertionId);
    else
View Full Code Here

  /* (non-Javadoc)
   * @see org.wsi.test.report.BuildReport#createAssertionResult()
   */
  public AssertionResult createAssertionResult()
  {
    AssertionResult assertionResult = new AssertionResultImpl();
    assertionResult.setAssertionResultsOption(
      reportContext
        .getAnalyzer()
        .getAnalyzerConfig()
        .getAssertionResultsOption());
    return assertionResult;
View Full Code Here

TOP

Related Classes of org.eclipse.wst.wsi.internal.core.report.AssertionResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.