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

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


    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();
                  prereqFailedList.addTestAssertionID(preReqId);
                }
              }

              if (prereqFailedList != null) {
                // Getting the highest pre-requisites' result
                Integer maxRes = (Integer)preReqResults.lastKey();
                String resString = (String)preReqResults.get(maxRes);
                if (resString.equals(AssertionResult.RESULT_FAILED)
                  ||resString.equals(AssertionResult.RESULT_WARNING)) {
                  resString = AssertionResult.RESULT_PREREQ_FAILED;
                }
                // Create assertion result based on pre-requisites which are not passed
                assertionResult = createAssertionResult(testAssertion, resString, prereqFailedList);
              }

              // Pre-requisites are passed, validate current assertion
              else {

                // Reset test assertion
                assertionProcess.reset();

                //  VERBOSE
                if (verboseOption)
                {
                  System.err.println(
                    "  Processing "
                      + testAssertion.getId()
                      + " for entry reference ID ["
                      + entry.getReferenceID()
                      + "] ...");
                  startTime = System.currentTimeMillis();
                }

                // Validate the target
View Full Code Here


    if (profileArtifact != null)
    {
      TestAssertion testAssertion;
 
      // Create entry
      Entry entry = this.reporter.getReport().createEntry();
      entry.setArtifactName(this.reportArtifact.getType().getTypeName());
 
      // Add entry to artifact
      this.reportArtifact.addEntry(entry);
 
      // Add entry to report
View Full Code Here

  protected void setMissingInput(EntryType entryType) throws WSIException
  {
    TestAssertion testAssertion;

    // Create entry
    Entry entry = this.reporter.getReport().createEntry();
    entry.setEntryType(entryType);
    entry.setReferenceID("[" + entryType.getTypeName() + "]");

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

    // Add entry to report
View Full Code Here

    // the assertion result is not found at the current entry, going through all the entries
    if (result == null)
    {
      for (int i = 0; i < entryList.size(); i ++)
      {
        Entry entry = (Entry) entryList.get(i);
        if ((result = entry.getAssertionResult(assertionId)) != null)
          break;
      }
    }
    return result;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.wsi.test.report.BuildReport#createEntry()
   */
  public Entry createEntry()
  {
    Entry entry = new EntryImpl();
    //entry.setAssertionResultsOption(reportContext.getAnalyzer().getAnalyzerConfig().getAssertionResultsOption());
    return entry;
  }
View Full Code Here

          if (!omitRequest(messageEntryRequest))
          {
            // Create entry
            // ADD: Need to create entry from report
            //Entry entry = this.reporter.getReport().createEntry();
            Entry entry = new EntryImpl();
            entry.setEntryType(
                  EntryType.getEntryType(MessageValidator.TYPE_MESSAGE_REQUEST));
            entry.setReferenceID(messageEntryRequest.getId());
            entry.setEntryDetail(messageEntryRequest);
 
            // Create the context for the request-response pair
            EntryContext requestTargetContext =
                 new EntryContext(
                      entry,
                      messageEntryRequest,
                      messageEntryResponse);
            if (requestTargetContext != null)
              processLogEntry(requestTargetContext);
 
            // Create entry
            // ADD: Need to create entry from report
            //Entry entry = this.reporter.getReport().createEntry();
            entry = new EntryImpl();
            entry.setEntryType(
              EntryType.getEntryType(MessageValidator.TYPE_MESSAGE_RESPONSE));
            entry.setReferenceID(messageEntryResponse.getId());
            entry.setEntryDetail(messageEntryResponse);
 
            EntryContext responseTargetContext =
                  new EntryContext(
                    entry,
                    messageEntryRequest,
View Full Code Here

        /* Process all remaining requests in the messageEntryList */
        for (int i = 0; i < messageEntryList.size(); i++) {
            MessageEntry logEntry = (MessageEntry) messageEntryList.get(i);
            if (!omitRequest(logEntry))
            {
              Entry entry = new EntryImpl();
              entry.setEntryType(EntryType.getEntryType(
                    MessageValidator.TYPE_MESSAGE_REQUEST));
              entry.setReferenceID(logEntry.getId());
              entry.setEntryDetail(logEntry);
              EntryContext requestTargetContext =
                new EntryContext(entry, logEntry, null);
              if (requestTargetContext != null)
                processLogEntry(requestTargetContext);
            }
View Full Code Here

  /* (non-Javadoc)
   * @see org.wsi.test.profile.validator.UDDIValidator#validate()
   */
  public void validateArtifact() throws WSIException
  {
    Entry entry = null;

    BindingTemplate bindingTemplate = null;
    TModel tModel = null;

    // it depricated after refactoring
    // now the inner classes moved out from validator
    //String classPrefix = this.getClass().getName() + "$";
    String classPrefix = this.getClass().getPackage().getName()+".";

    try
    {
      // Set up a reference to the UDDI registry
      uddiProxy = new UDDIProxy();

      //new Socket(new InetAddress(uddiReference.getInquiryURL()));
      uddiProxy.setInquiryURL(uddiReference.getInquiryURL());
      boolean wasEx = false;
      InputStream stream;
      try
      {
        URL url = StringUtils.getURL(null, uddiReference.getInquiryURL());
        stream = url.openStream();
        stream.close();
      }

      catch (UnknownHostException ex)
      {
        wasEx = true;
      }

      catch (IOException ex)
      {
      }

      if (!wasEx)
      {

        // If the UDDI reference is to a bindingTemplate then get it
        if (uddiReference.getKeyType().equals(UDDIReference.BINDING_KEY))
        {
          // Get binding detail which will contain the bindingTemplate
          BindingDetail bindingDetail =
            uddiProxy.get_bindingDetail(uddiReference.getKey());

          // Get bindingTemplate
          bindingTemplate =
            (BindingTemplate) bindingDetail
              .getBindingTemplateVector()
              .elementAt(
              0);

          if (verboseOption)
          {
            System.err.println(
              "    BindingTemplate - "
                + UDDIUtils.bindingTemplateToString(bindingTemplate));
          }

          // Get the wsdlSpec tModel
          tModel = UDDIUtils.findTModel(uddiProxy, bindingTemplate,
                  verboseOption);
        }

        // Else it has to be a tModel
        else
        {
          TModelDetail tModelDetail =
            uddiProxy.get_tModelDetail(uddiReference.getKey());
          tModel = (TModel) tModelDetail.getTModelVector().elementAt(0);
        }

        if (verboseOption)
        {
          System.err.println(
            "    TModel specified or found in bindingTemplate - "
              + UDDIUtils.tModelToString(tModel));
        }
      }

      if (bindingTemplate == null)
      {
        setMissingInput(
          EntryType.getEntryType(TYPE_DISCOVERY_BINDINGTEMPLATE));
      }

      // If there is a bindingTemplate, then process test assertions for it
      else
      {
        // Create entry
        entry = this.reporter.getReport().createEntry();
        entry.setEntryType(
          EntryType.getEntryType(TYPE_DISCOVERY_BINDINGTEMPLATE));
        entry.setReferenceID(bindingTemplate.getBindingKey());
        entry.setEntryDetail(bindingTemplate);

        // Process test assertions
        processAssertions(
          classPrefix,
          new EntryContext(entry, this.analyzerContext));
      }

      // NOTE: From this point forward, if a bindingTemplate does NOT have a wsdlSpec tModel,
      //       the tModel will be NULL.

      // Create entry
      entry = this.reporter.getReport().createEntry();
      entry.setEntryType(
        EntryType.getEntryType(TYPE_DISCOVERY_TMODEL));
      entry.setReferenceID(
        (tModel == null ? "[tModel]" : tModel.getTModelKey()));
      entry.setEntryDetail(tModel);

      // Process test assertions
      processAssertions(
        classPrefix,
        new EntryContext(entry, this.analyzerContext));
View Full Code Here

TOP

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

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.