FileDocCategorySizeDatePackage
SalesRankNPrice_ServiceTestCase.javaAPI DocApache Axis 1.46000Sat Apr 22 18:57:28 BST 2006test.wsdl.literal

SalesRankNPrice_ServiceTestCase

public class SalesRankNPrice_ServiceTestCase extends TestCase
SalesRankNPrice_ServiceTestCase.java This file was auto-generated from WSDL by the Apache Axis Wsdl2java emitter. Edited by hand to test a .NET web service on the internet.
author
Tom Jordahl (tomj@macromedia.com)

Fields Summary
public static URL
url
private static String[]
shouldExist
private static String[]
shouldNotExist
Constructors Summary
public SalesRankNPrice_ServiceTestCase(String name)

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        if (args.length == 1) {
            try {
                url = new URL(args[0]);
            } catch (Exception e) {
            }
        }

        junit.textui.TestRunner.run(new junit.framework.TestSuite(SalesRankNPrice_ServiceTestCase.class));
    
private voidprintit(java.lang.String result)

        System.out.println("Result: " + result);
    
private voidprintit(SalesRankNPrice1 r)

        System.out.println("price: " + r.getPrice());
        System.out.println("rank: " + r.getSalesRank());
    
private voidprintit(Prices p)

        System.out.println(
                " Amazon price:" + p.getAmazonPrice() + "\n" +
                " BN price:" + p.getBNPrice() );
    
private voidprintit(SalesRanks s)

        System.out.println(
                " Amazon rank:" + s.getAmazonSalesRank() + "\n" + 
                " BN rank:" + s.getBNSalesRank());
    
private voidprintit(All all)

        System.out.println(
                " Amazon price:" + all.getAmazonPrice() + "\n" +
                " Amazon rank:" + all.getAmazonSalesRank() + "\n" + 
                " BN price:" + all.getBNPrice() +  "\n" +
                " BN rank:" + all.getBNSalesRank());
        
    
public voidtestFileGen()


         
        String rootDir = "build"+ File.separator + "work" + File.separator + 
                "test" + File.separator + "wsdl" + File.separator + "literal";
        // open up the output directory and check what files exist.
        File outputDir = new File(rootDir);
        
        String[] files = outputDir.list();
        
        for (int i=0; i < shouldExist.length; i++) {
            File f = new File(rootDir, shouldExist[i]);
            assertTrue("File does not exist (and it should): " + shouldExist[i], f.exists()); 
        }
        
        for (int i=0; i < shouldNotExist.length; i++) {
            File f = new File(rootDir, shouldNotExist[i]);
            assertTrue("File exist (and it should NOT): " + shouldNotExist[i], !f.exists()); 
        }
    
public voidtestSalesRankNPriceSoap()

        // This is the book to look up...
        // "Building Web Services With Java" :)
        java.lang.String ISBN = "0672321815";
        
        boolean debug = true;
        
        SalesRankNPriceSoap binding;
        try {
            if (url != null)
                binding = new SalesRankNPriceLocator().getSalesRankNPriceSoap(url);
            else
                binding = new SalesRankNPriceLocator().getSalesRankNPriceSoap();
        } catch (javax.xml.rpc.ServiceException jre) {
            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre );
        }

        assertTrue("binding is null", binding != null);

        try {
            printit(binding.getAmazonSalesRank(ISBN));
            printit(binding.getAmazonUKSalesRank(ISBN));
            //printit(binding.getBNSalesRank(ISBN));
            printit(binding.getAmazonPrice(ISBN));
            printit(binding.getAmazonUKPrice(ISBN));
            printit(binding.getBNPrice(ISBN));
            printit(binding.getAmazonSalesRankNPrice(ISBN));
            printit(binding.getBNSalesRankNPrice(ISBN));
            printit(binding.getAmazonAndBNSalesRank(ISBN));
            printit(binding.getAmazonAndBNPrice(ISBN));
            printit(binding.getAll(ISBN));
        } catch (java.rmi.RemoteException re) {
            if (!(re instanceof AxisFault &&
                  ((((AxisFault) re).detail instanceof java.net.ConnectException)||
                   (((AxisFault) re).getFaultCode().getLocalPart().equals("HTTP"))))) {
                throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
            } else {
                // A connection exception has been detected so report this and make the test succeed.
                printit("Connect failure caused some of SalesRankNPrice_ServiceTestCase to be skipped.");
            }
        }