wsi-test-tools

16:54:44.324 INFO  jd.cli.Main - Decompiling wsi-test-tools.jar
package org.wsi.test.analyzer;

import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.Vector;
import org.wsi.WSIException;
import org.wsi.test.ToolInfo;
import org.wsi.test.analyzer.config.AnalyzerConfig;
import org.wsi.test.document.DocumentFactory;
import org.wsi.test.log.Log;
import org.wsi.test.profile.ProfileAssertions;
import org.wsi.test.profile.validator.ProfileValidatorFactory;
import org.wsi.test.report.Reporter;
import org.wsi.test.util.TestUtils;
import org.wsi.util.MessageList;

public abstract class Analyzer
{
  protected MessageList messageList = null;
  protected static final String RESOURCE_BUNDLE_NAME = "org.wsi.test.analyzer.Analyzer";
  public static final String USAGE_MESSAGE = "Usage: Analyzer -config <configFilename>";
  protected Reporter reporter = null;
  protected AnalyzerContext analyzerContext = null;
  protected CandidateInfo candidateInfo = null;
  protected ToolInfo toolInfo = null;
  protected ProfileValidatorFactory factory = null;
  protected DocumentFactory documentFactory = null;
  protected List analyzerConfigList = new Vector();
  protected int analyzerConfigIndex = 0;
  protected ProfileAssertions profileAssertions = null;
  protected Log log = null;
  
  public Analyzer(String[] paramArrayOfString, ToolInfo paramToolInfo)
    throws WSIException
  {
    init(paramToolInfo);
    analyzerConfigList.add(analyzerConfigIndex, documentFactory.newAnalyzerConfig());
    getAnalyzerConfig().init(messageList);
    getAnalyzerConfig().parseArgs(paramArrayOfString, true);
    TestUtils.printToolInfo(paramToolInfo);
    System.out.println(getAnalyzerConfig().toString());
    printMessage("progress01", null, "Please wait while the specified artifacts are analyzed...");
  }
  
  public Analyzer(String[] paramArrayOfString, ToolInfo paramToolInfo, boolean paramBoolean)
    throws WSIException
  {
    init(paramToolInfo);
    analyzerConfigList.add(analyzerConfigIndex, documentFactory.newAnalyzerConfig());
    getAnalyzerConfig().init(messageList);
    getAnalyzerConfig().parseArgs(paramArrayOfString, paramBoolean);
    TestUtils.printToolInfo(paramToolInfo);
    System.out.println(getAnalyzerConfig().toString());
    printMessage("progress01", null, "Please wait while the specified artifacts are analyzed...");
  }
  
  public Analyzer(List paramList, ToolInfo paramToolInfo)
    throws WSIException
  {
    init(paramToolInfo);
    analyzerConfigList = paramList;
  }
  
  protected void init(ToolInfo paramToolInfo)
    throws WSIException
  {
    toolInfo = paramToolInfo;
    messageList = new MessageList("org.wsi.test.analyzer.Analyzer");
    factory = ProfileValidatorFactory.newInstance();
    documentFactory = DocumentFactory.newInstance();
  }
  
  public int validateAll()
    throws WSIException
  {
    int i = 0;
    for (int k = 0; k < analyzerConfigList.size(); k++)
    {
      setAnalyzerConfig(k);
      int j;
      if ((j = validateConformance()) > i) {
        i = j;
      }
    }
    return i;
  }
  
  public abstract int validateConformance()
    throws WSIException;
  
  public ToolInfo getToolInfo()
  {
    return toolInfo;
  }
  
  protected void setAnalyzerConfig(int paramInt)
  {
    analyzerConfigIndex = paramInt;
  }
  
  public AnalyzerConfig getAnalyzerConfig()
  {
    return (AnalyzerConfig)analyzerConfigList.get(analyzerConfigIndex);
  }
  
  public void printMessage(String paramString1, String paramString2, String paramString3)
  {
    messageList.printMessage(paramString1, paramString2, paramString3);
  }
  
  public static void staticPrintMessage(String paramString1, String paramString2, String paramString3)
  {
    MessageList.printMessage("org.wsi.test.analyzer.Analyzer", paramString1, paramString2, paramString3);
  }
  
  public String toXMLString(String paramString)
  {
    StringWriter localStringWriter = new StringWriter();
    PrintWriter localPrintWriter = new PrintWriter(localStringWriter);
    localPrintWriter.print(toolInfo.getStartXMLString(paramString));
    localPrintWriter.print(getAnalyzerConfig().toXMLString("wsi-analyzerConfig"));
    localPrintWriter.println(toolInfo.getEndXMLString(paramString));
    return localStringWriter.toString();
  }
  
  public void printMessage(String paramString)
  {
    if (getAnalyzerConfig().getVerboseOption()) {
      System.err.println(paramString);
    }
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.Analyzer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

import org.wsi.xml.XMLDocumentCache;

public class AnalyzerContext
{
  protected ServiceReference serviceReference = null;
  protected CandidateInfo candidateInfo = null;
  protected XMLDocumentCache documentList = new XMLDocumentCache();
  
  private AnalyzerContext() {}
  
  public AnalyzerContext(ServiceReference paramServiceReference)
  {
    serviceReference = paramServiceReference;
  }
  
  public ServiceReference getServiceReference()
  {
    return serviceReference;
  }
  
  public void setServiceReference(ServiceReference paramServiceReference)
  {
    serviceReference = paramServiceReference;
  }
  
  public CandidateInfo getCandidateInfo()
  {
    return candidateInfo;
  }
  
  public void setCandidateInfo(CandidateInfo paramCandidateInfo)
  {
    candidateInfo = paramCandidateInfo;
  }
  
  public XMLDocumentCache getDocumentList()
  {
    return documentList;
  }
  
  public void setDocumentList(XMLDocumentCache paramXMLDocumentCache)
  {
    documentList = paramXMLDocumentCache;
  }
  
  public void addDocument(Object paramObject1, Object paramObject2)
  {
    documentList.put(paramObject1, paramObject2);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.AnalyzerContext
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

public class AssertionFailException
  extends Exception
{
  private static final long serialVersionUID = 3257007635743258933L;
  
  public AssertionFailException() {}
  
  public AssertionFailException(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.AssertionFailException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

public class AssertionNotApplicableException
  extends Exception
{
  private static final long serialVersionUID = 3905523782994112564L;
  
  public AssertionNotApplicableException() {}
  
  public AssertionNotApplicableException(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.AssertionNotApplicableException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

public class AssertionPassException
  extends Exception
{
  private static final long serialVersionUID = 3257285842283541810L;
  
  public AssertionPassException() {}
  
  public AssertionPassException(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.AssertionPassException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

public class AssertionResultException
  extends Exception
{
  private static final long serialVersionUID = 3256720684700152632L;
  private String detailMessage;
  
  public AssertionResultException()
  {
    detailMessage = null;
  }
  
  public AssertionResultException(String paramString)
  {
    super(paramString);
    detailMessage = null;
  }
  
  public AssertionResultException(String paramString1, String paramString2)
  {
    super(paramString1);
    detailMessage = paramString2;
  }
  
  public String getDetailMessage()
  {
    return detailMessage;
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.AssertionResultException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

import org.wsi.WSIException;
import org.wsi.test.log.MessageEntryHandler;
import org.wsi.test.profile.validator.EntryContext;
import org.wsi.test.profile.validator.EnvelopeValidator;
import org.wsi.test.report.ArtifactReference;
import org.wsi.test.report.Reporter;

class BasicProfileAnalyzer$EnvelopeProcessor
  implements MessageEntryHandler
{
  EnvelopeValidator envelopeValidator;
  private final BasicProfileAnalyzer this$0;
  
  BasicProfileAnalyzer$EnvelopeProcessor(BasicProfileAnalyzer paramBasicProfileAnalyzer, EnvelopeValidator paramEnvelopeValidator)
  {
    this$0 = paramBasicProfileAnalyzer;
    envelopeValidator = null;
    envelopeValidator = paramEnvelopeValidator;
  }
  
  public void processArtifactReference(ArtifactReference paramArtifactReference)
    throws WSIException
  {
    this$0.reporter.addArtifactReference(paramArtifactReference);
  }
  
  public void processLogEntry(EntryContext paramEntryContext)
    throws WSIException
  {
    envelopeValidator.validate(paramEntryContext);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.BasicProfileAnalyzer.EnvelopeProcessor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

import org.wsi.WSIException;
import org.wsi.test.log.MessageEntryHandler;
import org.wsi.test.profile.validator.EntryContext;
import org.wsi.test.profile.validator.MessageValidator;
import org.wsi.test.report.ArtifactReference;
import org.wsi.test.report.Reporter;

class BasicProfileAnalyzer$MessageProcessor
  implements MessageEntryHandler
{
  MessageValidator messageValidator;
  private final BasicProfileAnalyzer this$0;
  
  BasicProfileAnalyzer$MessageProcessor(BasicProfileAnalyzer paramBasicProfileAnalyzer, MessageValidator paramMessageValidator)
  {
    this$0 = paramBasicProfileAnalyzer;
    messageValidator = null;
    messageValidator = paramMessageValidator;
  }
  
  public void processArtifactReference(ArtifactReference paramArtifactReference)
    throws WSIException
  {
    this$0.reporter.addArtifactReference(paramArtifactReference);
  }
  
  public void processLogEntry(EntryContext paramEntryContext)
    throws WSIException
  {
    messageValidator.validate(paramEntryContext);
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.BasicProfileAnalyzer.MessageProcessor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.List;
import javax.wsdl.WSDLException;
import org.wsi.WSIException;
import org.wsi.WSIFileNotFoundException;
import org.wsi.test.ToolInfo;
import org.wsi.test.analyzer.config.AnalyzerConfig;
import org.wsi.test.document.DocumentFactory;
import org.wsi.test.log.LogReader;
import org.wsi.test.log.MessageEntryHandler;
import org.wsi.test.profile.ProfileAssertions;
import org.wsi.test.profile.ProfileAssertionsReader;
import org.wsi.test.profile.validator.EntryContext;
import org.wsi.test.profile.validator.EnvelopeValidator;
import org.wsi.test.profile.validator.MessageValidator;
import org.wsi.test.profile.validator.ProfileValidatorFactory;
import org.wsi.test.profile.validator.UDDIValidator;
import org.wsi.test.profile.validator.WSDLValidator;
import org.wsi.test.report.ArtifactReference;
import org.wsi.test.report.Report;
import org.wsi.test.report.ReportArtifact;
import org.wsi.test.report.ReportContext;
import org.wsi.test.report.ReportWriter;
import org.wsi.test.report.Reporter;
import org.wsi.test.report.impl.DefaultReporter;
import org.wsi.test.util.ArtifactType;
import org.wsi.util.MessageList;
import org.wsi.util.WSIProperties;
import org.wsi.wsdl.WSDLDocument;

public class BasicProfileAnalyzer
  extends Analyzer
{
  public static final String TOOL_NAME = "Analyzer";
  protected WSDLDocument wsdlDocument = null;
  
  public BasicProfileAnalyzer(String[] paramArrayOfString)
    throws WSIException
  {
    super(paramArrayOfString, new ToolInfo("Analyzer"));
  }
  
  public BasicProfileAnalyzer(String[] paramArrayOfString, boolean paramBoolean)
    throws WSIException
  {
    super(paramArrayOfString, new ToolInfo("Analyzer"), paramBoolean);
  }
  
  public BasicProfileAnalyzer(List paramList)
    throws WSIException
  {
    super(paramList, new ToolInfo("Analyzer"));
  }
  
  public BasicProfileAnalyzer(List paramList, String paramString)
    throws WSIException
  {
    super(paramList, new ToolInfo("Analyzer"));
    try
    {
      if (paramString != null) {
        wsdlDocument = new WSDLDocument(paramString);
      }
    }
    catch (WSDLException localWSDLException)
    {
      throw new WSIException(localWSDLException.getMessage(), localWSDLException);
    }
  }
  
  public int validateConformance()
    throws WSIException
  {
    int i = 0;
    Report localReport = null;
    ReportArtifact localReportArtifact = null;
    String str1 = null;
    analyzerContext = new AnalyzerContext(new ServiceReference(getAnalyzerConfig()));
    try
    {
      ProfileAssertionsReader localProfileAssertionsReader = documentFactory.newProfileAssertionsReader();
      profileAssertions = localProfileAssertionsReader.readProfileAssertions(getAnalyzerConfig().getTestAssertionsDocumentLocation());
      localReport = documentFactory.newReport();
      localReport.setLocation(getAnalyzerConfig().getReportLocation());
      localObject1 = new ReportContext("WS-I Basic Profile Conformance Report.", profileAssertions, this);
      localReport.setReportContext((ReportContext)localObject1);
      localObject2 = documentFactory.newReportWriter();
      ((ReportWriter)localObject2).setWriter(getAnalyzerConfig().getReportLocation());
      reporter = new DefaultReporter(localReport, (ReportWriter)localObject2);
      reporter.startReport();
      localReportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_DISCOVERY);
      if (((str1 = validateUDDI(localReportArtifact, factory.newUDDIValidator())) == null) && (getAnalyzerConfig().isWSDLReferenceSet())) {
        str1 = getAnalyzerConfig().getWSDLLocation();
      }
      reporter.endCurrentArtifact();
      localReportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_DESCRIPTION);
      wsdlDocument = validateWSDL(localReportArtifact, factory.newWSDLValidator(), str1, wsdlDocument);
      if ((wsdlDocument == null) && (getAnalyzerConfig().isWSDLReferenceSet())) {
        throw new WSIException(messageList.getMessage("config05", "WSDL document was either not found or could not be processed."));
      }
      reporter.endCurrentArtifact();
      localReportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_MESSAGE);
      validateMessages(localReportArtifact, factory.newMessageValidator(), wsdlDocument);
      reporter.endCurrentArtifact();
      if (!profileAssertions.getTADName().equals("Basic Profile Test Assertions"))
      {
        localReportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_ENVELOPE);
        validateEnvelopes(localReportArtifact, factory.newEnvelopeValidator(), wsdlDocument);
        reporter.endCurrentArtifact();
      }
      reporter.finishReport();
    }
    catch (Exception localException)
    {
      Object localObject1 = new StringWriter();
      Object localObject2 = new PrintWriter((Writer)localObject1);
      String str2 = messageList.getMessage("error03", "The conformance validation process failed.");
      if (reporter != null)
      {
        ((PrintWriter)localObject2).println(str2);
        ((PrintWriter)localObject2).println(messageList.getMessage("exception01", "Exception: ") + localException.getClass().getName());
        localException.printStackTrace((PrintWriter)localObject2);
        reporter.finishReportWithError(((StringWriter)localObject1).toString());
      }
      if ((localException instanceof WSIException)) {
        throw ((WSIException)localException);
      }
      throw new WSIException(str2, localException);
    }
    if (localReport != null) {
      i = localReport.getSummaryResult().equals("passed") ? 0 : 1;
    }
    return i;
  }
  
  private String validateUDDI(ReportArtifact paramReportArtifact, UDDIValidator paramUDDIValidator)
    throws WSIException
  {
    String str = null;
    paramUDDIValidator.init(analyzerContext, profileAssertions.getArtifact("discovery"), paramReportArtifact, getAnalyzerConfig().getUDDIReference(), reporter);
    if (getAnalyzerConfig().isUDDIReferenceSet())
    {
      str = paramUDDIValidator.validate();
      paramUDDIValidator.cleanup();
    }
    else
    {
      paramUDDIValidator.setAllMissingInput();
    }
    return str;
  }
  
  private WSDLDocument validateWSDL(ReportArtifact paramReportArtifact, WSDLValidator paramWSDLValidator, String paramString, WSDLDocument paramWSDLDocument)
    throws WSIException
  {
    WSDLDocument localWSDLDocument = null;
    paramWSDLValidator.init(analyzerContext, profileAssertions.getArtifact("description"), paramReportArtifact, paramString, paramWSDLDocument, reporter);
    if ((paramString != null) || (paramWSDLDocument != null))
    {
      localWSDLDocument = paramWSDLValidator.validate();
      paramWSDLValidator.cleanup();
    }
    else
    {
      paramWSDLValidator.setAllMissingInput();
    }
    return localWSDLDocument;
  }
  
  private void validateMessages(ReportArtifact paramReportArtifact, MessageValidator paramMessageValidator, WSDLDocument paramWSDLDocument)
    throws WSIException
  {
    paramMessageValidator.init(analyzerContext, profileAssertions.getArtifact("message"), paramReportArtifact, paramWSDLDocument, reporter);
    if (getAnalyzerConfig().getLogLocation() != null)
    {
      LogReader localLogReader = documentFactory.newLogReader();
      MessageProcessor localMessageProcessor = new MessageProcessor(paramMessageValidator);
      localLogReader.readLog(getAnalyzerConfig().getLogLocation(), localMessageProcessor);
      paramMessageValidator.cleanup();
    }
    else
    {
      paramMessageValidator.setAllMissingInput();
    }
  }
  
  private void validateEnvelopes(ReportArtifact paramReportArtifact, EnvelopeValidator paramEnvelopeValidator, WSDLDocument paramWSDLDocument)
    throws WSIException
  {
    paramEnvelopeValidator.init(analyzerContext, profileAssertions.getArtifact("envelope"), paramReportArtifact, paramWSDLDocument, reporter);
    if (getAnalyzerConfig().getLogLocation() != null)
    {
      LogReader localLogReader = documentFactory.newLogReader();
      EnvelopeProcessor localEnvelopeProcessor = new EnvelopeProcessor(paramEnvelopeValidator);
      localLogReader.readLog(getAnalyzerConfig().getLogLocation(), localEnvelopeProcessor);
      paramEnvelopeValidator.cleanup();
    }
    else
    {
      paramEnvelopeValidator.setAllMissingInput();
    }
  }
  
  public static void main(String[] paramArrayOfString)
    throws IOException
  {
    int i = 0;
    BasicProfileAnalyzer localBasicProfileAnalyzer = null;
    try
    {
      System.setProperty("javax.xml.parsers.DocumentBuilderFactory", WSIProperties.getProperty("javax.xml.parsers.DocumentBuilderFactory"));
      System.setProperty("org.uddi4j.TransportClassName", WSIProperties.getProperty("org.uddi4j.TransportClassName"));
      localBasicProfileAnalyzer = new BasicProfileAnalyzer(paramArrayOfString);
      i = localBasicProfileAnalyzer.validateConformance();
      localBasicProfileAnalyzer.printMessage("created01", null, "Conformance report has been created.");
    }
    catch (Exception localException)
    {
      i = 1;
      int j = 1;
      String str1;
      String str2;
      String str3;
      if (((localException instanceof WSIFileNotFoundException)) || ((localException instanceof IllegalArgumentException)))
      {
        str1 = "error01";
        str2 = "Analyzer Error:";
        str3 = localException.getMessage();
      }
      else
      {
        str1 = "error02";
        str2 = "Analyzer Stopped By Exception:";
        str3 = localException.toString();
      }
      if (localBasicProfileAnalyzer != null) {
        localBasicProfileAnalyzer.printMessage(str1, str3, str2);
      } else {
        Analyzer.staticPrintMessage(str1, str3, str2);
      }
      if ((localBasicProfileAnalyzer != null) && (localBasicProfileAnalyzer.getAnalyzerConfig() != null) && (localBasicProfileAnalyzer.getAnalyzerConfig().getVerboseOption())) {
        dump(localException);
      }
    }
    System.exit(i);
  }
  
  protected ReportArtifact setCurrentArtifact(ArtifactType paramArtifactType)
    throws WSIException
  {
    ReportArtifact localReportArtifact = reporter.createArtifact();
    localReportArtifact.setType(paramArtifactType);
    reporter.setCurrentArtifact(localReportArtifact);
    return localReportArtifact;
  }
  
  public static void dump(Throwable paramThrowable)
  {
    while ((paramThrowable instanceof WSIException))
    {
      Throwable localThrowable = ((WSIException)paramThrowable).getTargetException();
      if (localThrowable == null) {
        break;
      }
      paramThrowable = localThrowable;
    }
    paramThrowable.printStackTrace();
  }
  
  class EnvelopeProcessor
    implements MessageEntryHandler
  {
    EnvelopeValidator envelopeValidator = null;
    
    EnvelopeProcessor(EnvelopeValidator paramEnvelopeValidator)
    {
      envelopeValidator = paramEnvelopeValidator;
    }
    
    public void processArtifactReference(ArtifactReference paramArtifactReference)
      throws WSIException
    {
      reporter.addArtifactReference(paramArtifactReference);
    }
    
    public void processLogEntry(EntryContext paramEntryContext)
      throws WSIException
    {
      envelopeValidator.validate(paramEntryContext);
    }
  }
  
  class MessageProcessor
    implements MessageEntryHandler
  {
    MessageValidator messageValidator = null;
    
    MessageProcessor(MessageValidator paramMessageValidator)
    {
      messageValidator = paramMessageValidator;
    }
    
    public void processArtifactReference(ArtifactReference paramArtifactReference)
      throws WSIException
    {
      reporter.addArtifactReference(paramArtifactReference);
    }
    
    public void processLogEntry(EntryContext paramEntryContext)
      throws WSIException
    {
      messageValidator.validate(paramEntryContext);
    }
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.BasicProfileAnalyzer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Fault;
import javax.wsdl.Import;
import javax.wsdl.Input;
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.Output;
import javax.wsdl.Port;
import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.wsdl.Types;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.xml.namespace.QName;
import org.apache.xerces.util.URI;
import org.wsi.WSIException;
import org.wsi.test.analyzer.config.WSDLElement;
import org.wsi.wsdl.WSDLDocument;
import org.wsi.wsdl.WSDLUtils;

public class CandidateInfo
{
  private Definition[] definitions = null;
  private Import[] imports = null;
  private Types[] types = null;
  private Message[] messages = null;
  private Operation[] operations = null;
  private PortType[] portTypes = null;
  private Binding[] bindings = null;
  private Port[] ports = null;
  private URI[] endPoints = null;
  private WSDLDocument wsdlDocument;
  
  public CandidateInfo(ServiceReference paramServiceReference, WSDLDocument paramWSDLDocument)
    throws WSIException
  {
    WSDLElement localWSDLElement = paramServiceReference.getWSDLElement();
    wsdlDocument = paramWSDLDocument;
    imports = ((Import[])getAllImports(paramWSDLDocument.getDefinitions()).toArray(new Import[0]));
    definitions = new Definition[imports.length + 1];
    definitions[0] = paramWSDLDocument.getDefinitions();
    Types[] arrayOfTypes = new Types[definitions.length];
    int i = 0;
    if (definitions[0].getTypes() != null)
    {
      arrayOfTypes[0] = definitions[0].getTypes();
      i++;
    }
    for (int j = 0; j < imports.length; j++) {
      if (((definitions[(j + 1)] = imports[j].getDefinition()) != null) && (definitions[(j + 1)].getTypes() != null))
      {
        arrayOfTypes[i] = definitions[(j + 1)].getTypes();
        i++;
      }
    }
    if (i > 0)
    {
      types = new Types[i];
      for (j = 0; j < i; j++) {
        types[j] = arrayOfTypes[j];
      }
    }
    Object localObject1;
    Object localObject2;
    Object localObject3;
    Object localObject4;
    int k;
    if (localWSDLElement.isPort())
    {
      localObject1 = null;
      localObject2 = localWSDLElement.getParentElementQName();
      localObject3 = paramWSDLDocument.getServices();
      localObject4 = localWSDLElement.getName();
      for (k = 0; (k < localObject3.length) && (localObject1 == null); k++) {
        if (localObject3[k].getQName().equals(localObject2)) {
          localObject1 = localObject3[k].getPort((String)localObject4);
        }
      }
      if (localObject1 == null) {
        throw new WSIException("WSDL Port '" + (String)localObject4 + "' for Service '" + localObject2 + "' not found in service description");
      }
      ports = new Port[] { localObject1 };
      descendents((Port)localObject1);
    }
    else if (localWSDLElement.isBinding())
    {
      if ((localWSDLElement.getQName() != null) && (localWSDLElement.getQName().getLocalPart() != null) && (localWSDLElement.getQName().getLocalPart().length() > 0))
      {
        localObject1 = paramWSDLDocument.getDefinitions().getBinding(localWSDLElement.getQName());
        if (localObject1 == null) {
          throw new WSIException("WSDL Binding named '" + localWSDLElement.getQName() + "' not found in service description");
        }
        bindings = new Binding[] { localObject1 };
        descendents((Binding)localObject1);
      }
    }
    else if (localWSDLElement.isPortType())
    {
      localObject1 = paramWSDLDocument.getDefinitions().getPortType(localWSDLElement.getQName());
      portTypes = new PortType[] { localObject1 };
      if (localObject1 == null) {
        throw new WSIException("WSDL PortType named '" + localWSDLElement.getQName() + "' not found in service description");
      }
      portTypes = new PortType[] { localObject1 };
      descendents((PortType)localObject1);
    }
    else if (localWSDLElement.isOperation())
    {
      localObject1 = null;
      localObject2 = localWSDLElement.getName();
      localObject3 = localWSDLElement.getParentElementQName();
      localObject4 = paramWSDLDocument.getPortTypes();
      for (k = 0; (k < localObject4.length) && (localObject1 == null); k++) {
        if (localObject4[k].getQName().equals(localObject3))
        {
          Iterator localIterator = localObject4[k].getOperations().iterator();
          Operation localOperation = null;
          while ((localIterator.hasNext()) && (localObject1 == null))
          {
            localOperation = (Operation)localIterator.next();
            if (((String)localObject2).equals(localOperation.getName())) {
              localObject1 = localOperation;
            }
          }
        }
      }
      if (localObject1 == null) {
        throw new WSIException("No WSDL Operation named '" + localWSDLElement.getQName() + "' found in service description");
      }
      operations = new Operation[] { localObject1 };
      descendents((Operation)localObject1);
    }
    else if (localWSDLElement.isMessage())
    {
      localObject1 = paramWSDLDocument.getDefinitions().getMessage(localWSDLElement.getQName());
      if (localObject1 == null) {
        throw new WSIException("No WSDL Message named '" + localWSDLElement.getQName() + "' found in service description");
      }
      messages = new Message[] { localObject1 };
    }
    else
    {
      throw new WSIException("Unrecognised <WSDLElement type> in config: " + localWSDLElement.getType());
    }
    endPoints = deriveEndpoints(paramServiceReference, ports, definitions);
  }
  
  protected void descendents(Port paramPort)
    throws WSIException
  {
    if (paramPort == null) {
      throw new WSIException("Internal error: expected a Port value");
    }
    bindings = new Binding[] { paramPort.getBinding() };
    if (bindings[0] != null) {
      descendents(bindings[0]);
    }
  }
  
  protected void descendents(Binding paramBinding)
    throws WSIException
  {
    if (paramBinding == null) {
      throw new WSIException("Internal error: expected a Binding value");
    }
    portTypes = new PortType[] { paramBinding.getPortType() };
    if (portTypes[0] != null)
    {
      descendents(portTypes[0]);
      Definition localDefinition = definitions[0];
      HashSet localHashSet1 = new HashSet();
      if (messages != null) {
        for (int i = 0; i < messages.length; i++) {
          localHashSet1.add(messages[i]);
        }
      }
      HashSet localHashSet2 = WSDLUtils.findMessages(localDefinition, paramBinding);
      localHashSet1.addAll(localHashSet2);
      messages = ((Message[])localHashSet1.toArray(messages = new Message[0]));
    }
  }
  
  protected void descendents(PortType paramPortType)
    throws WSIException
  {
    if (paramPortType == null) {
      throw new WSIException("Internal error: expected a PortType value");
    }
    operations = ((Operation[])paramPortType.getOperations().toArray(operations = new Operation[0]));
    if (operations.length > 0) {
      descendents(operations);
    }
  }
  
  protected void descendents(Operation paramOperation)
    throws WSIException
  {
    if (paramOperation == null) {
      throw new WSIException("Internal error: expected an Operation value");
    }
    descendents(new Operation[] { paramOperation });
  }
  
  protected void descendents(Operation[] paramArrayOfOperation)
    throws WSIException
  {
    if (paramArrayOfOperation == null) {
      throw new WSIException("Internal error: expected an Operation[] value");
    }
    HashSet localHashSet = new HashSet();
    for (int i = 0; i < paramArrayOfOperation.length; i++)
    {
      if (paramArrayOfOperation[i].getInput() != null) {
        localHashSet.add(paramArrayOfOperation[i].getInput().getMessage());
      }
      if (paramArrayOfOperation[i].getOutput() != null) {
        localHashSet.add(paramArrayOfOperation[i].getOutput().getMessage());
      }
      Iterator localIterator = paramArrayOfOperation[i].getFaults().values().iterator();
      while (localIterator.hasNext()) {
        localHashSet.add(((Fault)localIterator.next()).getMessage());
      }
    }
    messages = ((Message[])localHashSet.toArray(messages = new Message[0]));
  }
  
  private HashSet getAllImports(Definition paramDefinition)
    throws WSIException
  {
    HashSet localHashSet1 = new HashSet();
    Map localMap = paramDefinition.getImports();
    Iterator localIterator1 = localMap.values().iterator();
    label28:
    if (localIterator1.hasNext())
    {
      List localList = (List)localIterator1.next();
      Iterator localIterator2 = localList.iterator();
      for (;;)
      {
        if (!localIterator2.hasNext()) {
          break label28;
        }
        Import localImport = (Import)localIterator2.next();
        if (localImport == null) {
          break;
        }
        localHashSet1.add(localImport);
        if (localImport.getDefinition() == null) {
          break;
        }
        HashSet localHashSet2 = getAllImports(localImport.getDefinition());
        Iterator localIterator3 = localHashSet2.iterator();
        while (localIterator3.hasNext()) {
          localHashSet1.add((Import)localIterator3.next());
        }
      }
    }
    return localHashSet1;
  }
  
  private URI[] deriveEndpoints(ServiceReference paramServiceReference, Port[] paramArrayOfPort, Definition[] paramArrayOfDefinition)
  {
    URI[] arrayOfURI = null;
    try
    {
      String str = null;
      if ((str = paramServiceReference.getServiceLocation()) != null)
      {
        arrayOfURI = new URI[] { new URI(str) };
      }
      else
      {
        if (paramServiceReference.getWSDLElement().isPort())
        {
          if (paramArrayOfPort.length != 1) {
            throw new WSIException("Internal error - expected 1-element Port array");
          }
          localObject1 = paramArrayOfPort[0].getExtensibilityElements().iterator();
          while ((((Iterator)localObject1).hasNext()) && (str == null))
          {
            localObject2 = (ExtensibilityElement)((Iterator)localObject1).next();
            if ((localObject2 instanceof SOAPAddress))
            {
              str = ((SOAPAddress)localObject2).getLocationURI();
              arrayOfURI = new URI[] { new URI(str) };
            }
          }
        }
        Object localObject1 = new HashSet();
        Object localObject2 = paramArrayOfDefinition[0].getExtensibilityElements().iterator();
        while (((Iterator)localObject2).hasNext())
        {
          ExtensibilityElement localExtensibilityElement = (ExtensibilityElement)((Iterator)localObject2).next();
          if ((localExtensibilityElement instanceof SOAPAddress)) {
            ((HashSet)localObject1).add(((SOAPAddress)localExtensibilityElement).getLocationURI());
          }
        }
        arrayOfURI = (URI[])((HashSet)localObject1).toArray(arrayOfURI = new URI[0]);
      }
    }
    catch (Exception localException) {}
    return arrayOfURI;
  }
  
  public Binding[] getBindings()
  {
    return bindings;
  }
  
  public URI[] getEndPoints()
  {
    return endPoints;
  }
  
  public URI[] getEndPoints(String paramString)
  {
    Vector localVector = new Vector();
    for (int i = 0; i < endPoints.length; i++)
    {
      String str = endPoints[i].getPort() == -1 ? "80" : String.valueOf(endPoints[i].getPort());
      if (paramString.equals(endPoints[i].getHost() + ":" + str)) {
        localVector.add(endPoints[i]);
      }
    }
    return (URI[])localVector.toArray(new URI[0]);
  }
  
  public Operation[] getOperations()
  {
    return operations;
  }
  
  public PortType[] getPortType()
  {
    return portTypes;
  }
  
  public boolean hasHostAndPort(String paramString)
    throws WSIException
  {
    URI localURI;
    try
    {
      localURI = new URI(paramString);
    }
    catch (Exception localException)
    {
      throw new WSIException("Could not convert string to URI: " + paramString);
    }
    String str = localURI.getHost();
    int i = localURI.getPort();
    for (int j = 0; j < endPoints.length; j++) {
      if ((endPoints[j].getHost().equals(str)) && (endPoints[j].getPort() == i)) {
        return true;
      }
    }
    return false;
  }
  
  public Definition[] getDefinitions()
  {
    return definitions;
  }
  
  public Import[] getImports()
  {
    return imports;
  }
  
  public Message[] getMessages()
  {
    return messages;
  }
  
  public Port[] getPorts()
  {
    return ports;
  }
  
  public PortType[] getPortTypes()
  {
    return portTypes;
  }
  
  public Types[] getTypes()
  {
    return types;
  }
  
  public WSDLDocument getWsdlDocument()
  {
    return wsdlDocument;
  }
  
  public Definition getDefinition(Types paramTypes)
  {
    Definition localDefinition = null;
    for (int i = 0; (i < definitions.length) && (localDefinition == null); i++)
    {
      Types localTypes;
      if (((localTypes = definitions[i].getTypes()) != null) && (localTypes.equals(paramTypes))) {
        localDefinition = definitions[i];
      }
    }
    return localDefinition;
  }
  
  public Definition getDefinition(Binding paramBinding)
  {
    Definition localDefinition = null;
    for (int i = 0; (i < definitions.length) && (localDefinition == null); i++) {
      if (definitions[i].getBinding(paramBinding.getQName()) != null) {
        localDefinition = definitions[i];
      }
    }
    return localDefinition;
  }
  
  public Definition getDefinition(PortType paramPortType)
  {
    Definition localDefinition = null;
    for (int i = 0; (i < definitions.length) && (localDefinition == null); i++) {
      if (definitions[i].getPortType(paramPortType.getQName()) != null) {
        localDefinition = definitions[i];
      }
    }
    return localDefinition;
  }
  
  public Definition getDefinition(Message paramMessage)
  {
    Definition localDefinition = null;
    for (int i = 0; (i < definitions.length) && (localDefinition == null); i++) {
      if (definitions[i].getMessage(paramMessage.getQName()) != null) {
        localDefinition = definitions[i];
      }
    }
    return localDefinition;
  }
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.CandidateInfo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer.config;

import javax.xml.namespace.QName;
import org.wsi.WSIException;
import org.wsi.test.common.AddStyleSheet;
import org.wsi.test.document.WSIDocument;
import org.wsi.util.MessageList;

public abstract interface AnalyzerConfig
  extends WSIDocument
{
  public static final String ELEM_NAME = "configuration";
  public static final QName QNAME = new QName("http://www.ws-i.org/testing/2004/07/analyzerConfig/", "configuration");
  public static final String CORRELATION_TYPE_OPERATION = "operation";
  public static final String CORRELATION_TYPE_NAMESPACE = "namespace";
  public static final String CORRELATION_TYPE_ENDPOINT = "endpoint";
  
  public abstract void init(MessageList paramMessageList);
  
  public abstract String getDescription();
  
  public abstract void setDescription(String paramString);
  
  public abstract boolean getVerboseOption();
  
  public abstract void setVerboseOption(boolean paramBoolean);
  
  public abstract AssertionResultsOption getAssertionResultsOption();
  
  public abstract void setAssertionResultsOption(AssertionResultsOption paramAssertionResultsOption);
  
  public abstract boolean getReplaceReport();
  
  public abstract void setReplaceReport(boolean paramBoolean);
  
  public abstract String getReportLocation();
  
  public abstract void setReportLocation(String paramString);
  
  public abstract AddStyleSheet getAddStyleSheet();
  
  public abstract void setAddStyleSheet(AddStyleSheet paramAddStyleSheet);
  
  public abstract String getTestAssertionsDocumentLocation();
  
  public abstract void setTestAssertionsDocumentLocation(String paramString);
  
  public abstract String getLogLocation();
  
  public abstract void setLogLocation(String paramString);
  
  public abstract boolean isLogSet();
  
  public abstract String getCorrelationType();
  
  public abstract void setCorrelationType(String paramString);
  
  public abstract boolean isWSDLReferenceSet();
  
  public abstract WSDLReference getWSDLReference();
  
  public abstract void setWSDLReference(WSDLReference paramWSDLReference);
  
  public abstract WSDLElement getWSDLElement();
  
  public abstract String getWSDLLocation();
  
  public abstract String getServiceLocation();
  
  public abstract boolean isUDDIReferenceSet();
  
  public abstract UDDIReference getUDDIReference();
  
  public abstract void setUDDIReference(UDDIReference paramUDDIReference);
  
  public abstract void parseArgs(String[] paramArrayOfString, boolean paramBoolean)
    throws WSIException;
  
  public abstract String toString();
}

/* Location:
 * Qualified Name:     org.wsi.test.analyzer.config.AnalyzerConfig
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.wsi.test.analyzer.config;

import java.io.Reader;
import org.wsi.WSIException;
import org.wsi.test.document.DocumentReader;
import org.wsi.util.MessageList;

public abstract interface AnalyzerConfigReader
  extends DocumentReader
{
  public abstract void init(
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd