KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > functional > TestIF3SOAP


1 package test.functional;
2
3 import junit.framework.TestCase;
4 import test.rpc.IF1;
5 import test.rpc.IF2SOAP;
6 import test.rpc.IF3SOAP;
7 import test.rpc.IF3SOAPProxy;
8
9 import java.util.Calendar JavaDoc;
10 import java.util.GregorianCalendar JavaDoc;
11
12 public final class TestIF3SOAP extends TestCase {
13     private static final String JavaDoc URL = "http://localhost:8080/axis/services/IF3SOAP";
14     private static final String JavaDoc Service = "IF3SOAP";
15     
16     private IF3SOAPProxy m_soap;
17     
18     public TestIF3SOAP(String JavaDoc name) {
19         super(name);
20     }
21     
22     protected void setUp() {
23         if (m_soap == null)
24             m_soap = new IF3SOAPProxy(Service, URL);
25     } // setUp
26

27     
28     protected void tearDown() {
29     } // tearDown
30

31     public void testGetBeanById() throws Exception JavaDoc {
32         IF2SOAP soap = m_soap;
33         IF1 bean = soap.getBeanById("42042042042");
34         assertNotNull("bean is null", bean);
35         System.out.println("beanById:");
36         System.out.println("id: " + bean.getId());
37     }
38     
39     public void testGetAllBeans() throws Exception JavaDoc {
40         IF2SOAP soap = m_soap;
41         IF1[] beans = soap.getAllBeans();
42         assertNotNull("beans is null", beans);
43         System.out.println("allBeans:");
44         for (int i = 0; i < beans.length; i++)
45             System.out.println("id[" + i + "]: " + beans[i].getId());
46     }
47     
48     public void testGetAllBeansFiltered() throws Exception JavaDoc {
49         IF2SOAP soap = m_soap;
50         String JavaDoc[] filter = new String JavaDoc[1];
51         filter[0] = "11011011011";
52         IF1[] beans = soap.getAllBeans(filter);
53         assertNotNull("beans is null", beans);
54         System.out.println("allBeansFiltered:");
55         for (int i = 0; i < beans.length; i++)
56             System.out.println("id[" + i + "]: " + beans[i].getId());
57     }
58     
59     public void testGetAllCategories() throws Exception JavaDoc {
60         IF2SOAP soap = m_soap;
61         String JavaDoc[] categories = soap.getAllCategories();
62         assertNotNull("categories is null", categories);
63         System.out.println("allCategories:");
64         for (int i = 0; i < categories.length; i++)
65             System.out.println("cat[" + i + "]: " + categories[i]);
66     }
67     
68     public void testGetBeansByCategory() throws Exception JavaDoc {
69         IF2SOAP soap = m_soap;
70         IF1[] beans = soap.getBeansByCategory("Test");
71         assertNotNull("beans is null", beans);
72         System.out.println("beansByCategory:");
73         for (int i = 0; i < beans.length; i++)
74             System.out.println("id[" + i + "]: " + beans[i].getId());
75     }
76     
77     public void testGetBeansByCategoryFiltered() throws Exception JavaDoc {
78         IF2SOAP soap = m_soap;
79         String JavaDoc[] filter = new String JavaDoc[1];
80         filter[0] = "11011011011";
81         IF1[] beans = soap.getBeansByCategory("Test", filter);
82         assertNotNull("beans is null", beans);
83         System.out.println("beansByCategoryFiltered:");
84         for (int i = 0; i < beans.length; i++)
85             System.out.println("id[" + i + "]: " + beans[i].getId());
86     }
87     
88     public void testGetBeansByDate() throws Exception JavaDoc {
89         IF2SOAP soap = m_soap;
90         Calendar JavaDoc[] dates = new Calendar JavaDoc[1];
91         dates[0] = new GregorianCalendar JavaDoc();
92         IF1[] beans = soap.getBeansByDate(dates);
93         assertNotNull("beans is null", beans);
94         System.out.println("beansByDate:");
95         for (int i = 0; i < beans.length; i++)
96             System.out.println("id[" + i + "]: " + beans[i].getId());
97     }
98     
99     public void testGetBeansByDateFiltered() throws Exception JavaDoc {
100         IF2SOAP soap = m_soap;
101         String JavaDoc[] filter = new String JavaDoc[1];
102         filter[0] = "11011011011";
103         Calendar JavaDoc[] dates = new Calendar JavaDoc[1];
104         dates[0] = new GregorianCalendar JavaDoc();
105         IF1[] beans = soap.getBeansByDate(dates, filter);
106         assertNotNull("beans is null", beans);
107         System.out.println("beansByDateFiltered:");
108         for (int i = 0; i < beans.length; i++)
109             System.out.println("id[" + i + "]: " + beans[i].getId());
110     }
111     
112     public void testGetBeansByExpression() throws Exception JavaDoc {
113         IF2SOAP soap = m_soap;
114         IF1[] beans = soap.getBeansByExpression(IF2SOAP.KEYWORD_EXP, "keyword");
115         assertNotNull("beans is null", beans);
116         System.out.println("beansByExpression:");
117         for (int i = 0; i < beans.length; i++)
118             System.out.println("id[" + i + "]: " + beans[i].getId());
119     }
120     
121     public void testGetBeansByExpressionFiltered() throws Exception JavaDoc {
122         IF2SOAP soap = m_soap;
123         String JavaDoc[] filter = new String JavaDoc[1];
124         filter[0] = "11011011011";
125         IF1[] beans = soap.getBeansByExpression(IF2SOAP.KEYWORD_EXP, "keyword", filter);
126         assertNotNull("beans is null", beans);
127         System.out.println("beansByExpressionFiltered:");
128         for (int i = 0; i < beans.length; i++)
129             System.out.println("id[" + i + "]: " + beans[i].getId());
130     }
131     
132     public void testGetXMLForBean() throws Exception JavaDoc {
133         IF2SOAP soap = m_soap;
134         IF1 bean = soap.getBeanById("42042042042");
135         String JavaDoc xml = soap.getXMLForBean(bean);
136         assertNotNull("xml is null", xml);
137         System.out.println("xmlForBean:");
138         System.out.println("xml: " + xml);
139     }
140     
141     public void testGetBeansForIFByCategory() throws Exception JavaDoc {
142         IF3SOAP soap = m_soap;
143         IF1[] beans = soap.getBeansByCategory("if", "Test");
144         assertNotNull("beans is null", beans);
145         System.out.println("beansForIFByCategory:");
146         for (int i = 0; i < beans.length; i++)
147             System.out.println("id[" + i + "]: " + beans[i].getId());
148     }
149     
150     public void testGetBeansForIFByCategoryFiltered() throws Exception JavaDoc {
151         IF3SOAP soap = m_soap;
152         String JavaDoc[] filter = new String JavaDoc[1];
153         filter[0] = "11011011011";
154         IF1[] beans = soap.getBeansByCategory("if", "Test", filter);
155         assertNotNull("beans is null", beans);
156         System.out.println("beansForIFByCategoryFiltered:");
157         for (int i = 0; i < beans.length; i++)
158             System.out.println("id[" + i + "]: " + beans[i].getId());
159     }
160     
161     public void testGetBeansForIFByDate() throws Exception JavaDoc {
162         IF3SOAP soap = m_soap;
163         Calendar JavaDoc[] dates = new Calendar JavaDoc[1];
164         dates[0] = new GregorianCalendar JavaDoc();
165         IF1[] beans = soap.getBeansByDate("if", dates);
166         assertNotNull("beans is null", beans);
167         System.out.println("beansForIFByDate:");
168         for (int i = 0; i < beans.length; i++)
169             System.out.println("id[" + i + "]: " + beans[i].getId());
170     }
171     
172     public void testGetBeansForIFByDateFiltered() throws Exception JavaDoc {
173         IF3SOAP soap = m_soap;
174         String JavaDoc[] filter = new String JavaDoc[1];
175         filter[0] = "11011011011";
176         Calendar JavaDoc[] dates = new Calendar JavaDoc[1];
177         dates[0] = new GregorianCalendar JavaDoc();
178         IF1[] beans = soap.getBeansByDate("if", dates, filter);
179         assertNotNull("beans is null", beans);
180         System.out.println("beansForIFByDateFiltered:");
181         for (int i = 0; i < beans.length; i++)
182             System.out.println("id[" + i + "]: " + beans[i].getId());
183     }
184     
185     public void testGetBeansForIFByExpression() throws Exception JavaDoc {
186         IF3SOAP soap = m_soap;
187         IF1[] beans = soap.getBeansByExpression("if", IF2SOAP.KEYWORD_EXP, "keyword");
188         assertNotNull("beans is null", beans);
189         System.out.println("beansForIFByExpression:");
190         for (int i = 0; i < beans.length; i++)
191             System.out.println("id[" + i + "]: " + beans[i].getId());
192     }
193     
194     public void testGetBeansForIFByExpressionFiltered() throws Exception JavaDoc {
195         IF3SOAP soap = m_soap;
196         String JavaDoc[] filter = new String JavaDoc[1];
197         filter[0] = "11011011011";
198         IF1[] beans = soap.getBeansByExpression("if", IF2SOAP.KEYWORD_EXP, "keyword", filter);
199         assertNotNull("beans is null", beans);
200         System.out.println("beansForIFByExpressionFiltered:");
201         for (int i = 0; i < beans.length; i++)
202             System.out.println("id[" + i + "]: " + beans[i].getId());
203     }
204 }
205
206
Popular Tags