This project has retired. For details please refer to its
Attic page.
UDDI_141_JIRAIntegrationTest xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.apache.juddi.v3.tck;
16
17 import java.net.InetAddress;
18 import java.rmi.RemoteException;
19 import java.util.ArrayList;
20 import java.util.Calendar;
21 import java.util.GregorianCalendar;
22 import java.util.List;
23 import java.util.UUID;
24 import javax.xml.bind.JAXB;
25 import javax.xml.datatype.DatatypeFactory;
26 import javax.xml.soap.SOAPFault;
27 import javax.xml.ws.BindingProvider;
28 import javax.xml.ws.Endpoint;
29 import javax.xml.ws.Holder;
30 import javax.xml.ws.soap.SOAPFaultException;
31 import org.apache.commons.configuration.ConfigurationException;
32 import org.apache.commons.logging.Log;
33 import org.apache.commons.logging.LogFactory;
34 import org.apache.juddi.v3.client.UDDIConstants;
35 import org.apache.juddi.v3.client.config.UDDIClient;
36 import org.apache.juddi.v3.client.transport.Transport;
37 import org.junit.AfterClass;
38 import org.junit.Assert;
39 import org.junit.Assume;
40 import org.junit.BeforeClass;
41 import org.junit.Test;
42 import org.uddi.api_v3.*;
43 import org.uddi.sub_v3.Subscription;
44 import org.uddi.sub_v3.SubscriptionFilter;
45 import org.uddi.v3_service.UDDIInquiryPortType;
46 import org.uddi.v3_service.UDDIPublicationPortType;
47 import org.uddi.v3_service.UDDISecurityPortType;
48 import org.uddi.v3_service.UDDISubscriptionPortType;
49
50
51
52
53
54
55
56
57
58 public class UDDI_141_JIRAIntegrationTest {
59
60 public UDDI_141_JIRAIntegrationTest() throws RemoteException {
61 }
62 private static Log logger = LogFactory.getLog(UDDI_141_JIRAIntegrationTest.class);
63 static UDDISecurityPortType security = null;
64 static UDDISubscriptionPortType subscriptionJoe = null;
65 static UDDIInquiryPortType inquiryJoe = null;
66 static UDDIPublicationPortType publicationJoe = null;
67 static TckTModel tckTModelJoe = null;
68 static TckBusiness tckBusinessJoe = null;
69 static UDDISubscriptionPortType subscriptionSam = null;
70 static UDDIInquiryPortType inquiryJoeSam = null;
71 static UDDIPublicationPortType publicationSam = null;
72 static TckTModel tckTModelSam = null;
73 static TckTModel tckTmodelUddi = null;
74 static TckBusiness tckBusinessSam = null;
75 protected static String authInfoJoe = null;
76 protected static String authInfoSam = null;
77 protected static String authInfoUddi = null;
78 private static UDDIClient manager;
79 static final String str256 = "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
80 static final String str255 = "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
81 static final String strkey256 = "uddi:11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
82 static final String strkey256_1 = "uddi:org.apache:omething.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.somethi.com";
83 static final String str26 = "11111111111111111111111111";
84 static final String str27 = "111111111111111111111111110";
85 static final String str10 = "0123456789";
86 static final String str11 = "01234567890";
87 static final String str80 = "01234567890123456789012345678901234567890123456789012345678901234567890123456789";
88 static final String str81 = "012345678901234567890123456789012345678901234567890123456789012345678901234567891";
89 static final String TRANS = "The transaction has been rolled back";
90 static final String str4096 = "12345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000XXXXXXXX";
91 static final String str4097 = "12345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000XXXXXXXXZ";
92 static final String str51 = "111111111111111111111111111111111111111111111111111";
93 static final String str50 = "11111111111111111111111111111111111111111111111111";
94 static final String MISSING_RESOURCE = "Can't find resource for bundle";
95
96 @AfterClass
97 public static void stopManager() throws ConfigurationException {
98 if (!TckPublisher.isEnabled()) {
99 return;
100 }
101 tckTModelJoe.deleteCreatedTModels(authInfoJoe);
102 tckTModelSam.deleteCreatedTModels(authInfoSam);
103 manager.stop();
104 }
105
106 @BeforeClass
107 public static void startManager() throws ConfigurationException {
108 if (!TckPublisher.isEnabled()) {
109 return;
110 }
111 logger.info("UDDI_141_JIRAIntegrationTest");
112 manager = new UDDIClient();
113 manager.start();
114
115 logger.debug("Getting auth tokens..");
116 try {
117 Transport transport = manager.getTransport("uddiv3");
118 security = transport.getUDDISecurityService();
119
120 publicationJoe = transport.getUDDIPublishService();
121 inquiryJoe = transport.getUDDIInquiryService();
122
123 subscriptionJoe = transport.getUDDISubscriptionService();
124
125 authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
126 authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
127 authInfoUddi = TckSecurity.getAuthToken(security, TckPublisher.getUDDIPublisherId(), TckPublisher.getUDDIPassword());
128
129
130 if (!TckPublisher.isUDDIAuthMode()) {
131 TckSecurity.setCredentials((BindingProvider) publicationJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
132 TckSecurity.setCredentials((BindingProvider) inquiryJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
133 TckSecurity.setCredentials((BindingProvider) subscriptionJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
134
135 }
136 tckTModelJoe = new TckTModel(publicationJoe, inquiryJoe);
137 tckBusinessJoe = new TckBusiness(publicationJoe, inquiryJoe);
138
139 transport = manager.getTransport("uddiv3");
140
141 publicationSam = transport.getUDDIPublishService();
142 inquiryJoeSam = transport.getUDDIInquiryService();
143 if (!TckPublisher.isUDDIAuthMode()) {
144 TckSecurity.setCredentials((BindingProvider) publicationSam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
145 TckSecurity.setCredentials((BindingProvider) inquiryJoeSam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
146 TckSecurity.setCredentials((BindingProvider) subscriptionSam, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
147 }
148 subscriptionSam = transport.getUDDISubscriptionService();
149 tckTModelSam = new TckTModel(publicationSam, inquiryJoeSam);
150 tckBusinessSam = new TckBusiness(publicationSam, inquiryJoeSam);
151
152 transport = manager.getTransport("uddiv3");
153
154 UDDIPublicationPortType uddiPublishService = transport.getUDDIPublishService();
155 UDDIInquiryPortType uddiInquiryService = transport.getUDDIInquiryService();
156
157 tckTmodelUddi = new TckTModel(uddiPublishService, uddiInquiryService);
158 tckTmodelUddi.saveUDDIPublisherTmodel(authInfoUddi);
159
160 if (!TckPublisher.isUDDIAuthMode()) {
161 TckSecurity.setCredentials((BindingProvider) uddiPublishService, TckPublisher.getUDDIPublisherId(), TckPublisher.getUDDIPassword());
162 TckSecurity.setCredentials((BindingProvider) uddiInquiryService, TckPublisher.getUDDIPublisherId(), TckPublisher.getUDDIPassword());
163
164 }
165
166 } catch (Exception e) {
167 logger.error(e.getMessage(), e);
168 Assert.fail("Could not obtain authInfo token.");
169 }
170 JUDDI_300_MultiNodeIntegrationTest.testSetupReplicationConfig();
171 }
172
173 static void HandleException(Exception ex) {
174 logger.error("Error caught of type " + ex.getClass().getCanonicalName(),ex);
175 if (ex.getMessage() != null) {
176 Assert.assertFalse(ex.getMessage().contains(TRANS));
177 Assert.assertFalse(ex.getMessage().contains(MISSING_RESOURCE));
178 }
179 if (ex instanceof SOAPFault) {
180 SOAPFault sf = (SOAPFault) ex;
181 if (!sf.getTextContent().contains("org.apache.juddi.v3.error.ValueNotAllowedException")) {
182 Assert.fail();
183 }
184 }
185 }
186
187 @Test
188 public void JUDDI_JIRA_571_Part1_Test() {
189 Assume.assumeTrue(TckPublisher.isEnabled());
190
191
192
193
194 List<String> businesskeysToDelete = new ArrayList<String>();
195 String failuremsg = "";
196 logger.info("JUDDI_JIRA_571_Part1_Test");
197 SaveBusiness sb = new SaveBusiness();
198 sb.setAuthInfo(authInfoJoe);
199 BusinessEntity be = new BusinessEntity();
200 Name n = new Name();
201 n.setValue("JUDDI_JIRA_571_Part1_Test no lang");
202 be.getName().add(n);
203 sb.getBusinessEntity().add(be);
204
205 be = new BusinessEntity();
206 n = new Name();
207 n.setValue("JUDDI_JIRA_571_Part1_Test with lang");
208 n.setLang("en");
209 be.getName().add(n);
210 sb.getBusinessEntity().add(be);
211 try {
212 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
213 businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
214 businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(1).getBusinessKey());
215
216 } catch (Exception ex) {
217 HandleException(ex);
218 Assert.fail("unexpected failure");
219 }
220
221 int found1 = 0;
222 FindBusiness fb = new FindBusiness();
223 fb.setAuthInfo(authInfoJoe);
224 n = new Name();
225 n.setValue("%");
226 fb.getName().add(n);
227 fb.setFindQualifiers(new FindQualifiers());
228 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
229 try {
230 BusinessList findBusiness = inquiryJoe.findBusiness(fb);
231 if (findBusiness.getBusinessInfos() != null) {
232 for (int i = 0; i < findBusiness.getBusinessInfos().getBusinessInfo().size(); i++) {
233 if (businesskeysToDelete.contains(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey())) {
234 found1++;
235 }
236 }
237 }
238 } catch (Exception ex) {
239 HandleException(ex);
240 Assert.fail("unexpected failure");
241 }
242 if (found1 != 2) {
243 failuremsg += "No lang defined, " + found1 + " records found instead of 2";
244 }
245
246 found1 = 0;
247 fb = new FindBusiness();
248 fb.setAuthInfo(authInfoJoe);
249 n = new Name();
250 n.setLang("en");
251 n.setValue("%");
252 fb.getName().add(n);
253 fb.setFindQualifiers(new FindQualifiers());
254 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
255 try {
256 BusinessList findBusiness = inquiryJoe.findBusiness(fb);
257 if (findBusiness.getBusinessInfos() != null) {
258 for (int i = 0; i < findBusiness.getBusinessInfos().getBusinessInfo().size(); i++) {
259 if (businesskeysToDelete.contains(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey())) {
260 found1++;
261 }
262 }
263 }
264 } catch (Exception ex) {
265 HandleException(ex);
266 Assert.fail("unexpected failure");
267 }
268 if (found1 != 1) {
269 failuremsg += "Lang defined, " + found1 + " records found instead of 1";
270 }
271
272 DeleteBusinesses(businesskeysToDelete, authInfoJoe, publicationJoe);
273 if (failuremsg.length() > 0) {
274 Assert.fail(failuremsg);
275 }
276 logger.info("Pass");
277
278 }
279
280 @Test
281 public void JUDDI_JIRA_571_Part2_Test() {
282 Assume.assumeTrue(TckPublisher.isEnabled());
283
284
285
286
287
288 List<String> businesskeysToDelete = new ArrayList<String>();
289 List<String> targetServiceKeys = new ArrayList<String>();
290 String failuremsg = "";
291 logger.info("JUDDI_JIRA_571_Part2_Test");
292 SaveBusiness sb = new SaveBusiness();
293 sb.setAuthInfo(authInfoJoe);
294 BusinessEntity be = new BusinessEntity();
295 Name n = new Name();
296 n.setValue("JUDDI_JIRA_571_Part2_Test no lang");
297 be.getName().add(n);
298 sb.getBusinessEntity().add(be);
299
300 BusinessService bs = new BusinessService();
301 n = new Name();
302 n.setValue("Service1 No Lang");
303 bs.getName().add(n);
304 be.setBusinessServices(new BusinessServices());
305 be.getBusinessServices().getBusinessService().add(bs);
306
307 bs = new BusinessService();
308 n = new Name();
309 n.setValue("Service2 Lang");
310 n.setLang("en");
311 bs.getName().add(n);
312 be.getBusinessServices().getBusinessService().add(bs);
313 try {
314 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
315 businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
316 targetServiceKeys.add(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey());
317 targetServiceKeys.add(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(1).getServiceKey());
318
319 } catch (Exception ex) {
320 HandleException(ex);
321 Assert.fail("unexpected failure");
322 }
323
324 int found1 = 0;
325 FindService fb = new FindService();
326 fb.setAuthInfo(authInfoJoe);
327 n = new Name();
328 n.setValue("%");
329 fb.getName().add(n);
330 fb.setFindQualifiers(new FindQualifiers());
331 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
332 try {
333 ServiceList findBusiness = inquiryJoe.findService(fb);
334 if (findBusiness.getServiceInfos() != null) {
335 for (int i = 0; i < findBusiness.getServiceInfos().getServiceInfo().size(); i++) {
336 if (targetServiceKeys.contains(findBusiness.getServiceInfos().getServiceInfo().get(i).getServiceKey())) {
337 found1++;
338 }
339 }
340 }
341 } catch (Exception ex) {
342 HandleException(ex);
343 Assert.fail("unexpected failure");
344 }
345 if (found1 != 2) {
346 failuremsg += "No lang defined, " + found1 + " records found instead of 2";
347 }
348
349 found1 = 0;
350 fb = new FindService();
351 fb.setAuthInfo(authInfoJoe);
352 n = new Name();
353 n.setLang("en");
354 n.setValue("%");
355 fb.getName().add(n);
356 fb.setFindQualifiers(new FindQualifiers());
357 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
358 try {
359 ServiceList findBusiness = inquiryJoe.findService(fb);
360 if (findBusiness.getServiceInfos() != null) {
361 for (int i = 0; i < findBusiness.getServiceInfos().getServiceInfo().size(); i++) {
362 if (businesskeysToDelete.contains(findBusiness.getServiceInfos().getServiceInfo().get(i).getBusinessKey())) {
363 found1++;
364 }
365 }
366 }
367 } catch (Exception ex) {
368 HandleException(ex);
369 Assert.fail("unexpected failure");
370 }
371 if (found1 != 1) {
372 failuremsg += "Lang defined, " + found1 + " records found instead of 1";
373 }
374
375 DeleteBusinesses(businesskeysToDelete, authInfoJoe, publicationJoe);
376 if (failuremsg.length() > 0) {
377 Assert.fail(failuremsg);
378 }
379 logger.info("Pass");
380
381 }
382
383 @Test
384 public void JUDDI_571_Part3_Test() {
385 Assume.assumeTrue(TckPublisher.isEnabled());
386
387
388
389
390
391 List<String> businesskeysToDelete = new ArrayList<String>();
392
393 String failuremsg = "";
394 logger.info("JUDDI_571_Part3_Test");
395 SaveTModel sb = new SaveTModel();
396 sb.setAuthInfo(authInfoJoe);
397 TModel be = new TModel();
398 Name n = new Name();
399 n.setValue("JUDDI_571_Part3_Test no lang");
400 be.setName(n);
401 sb.getTModel().add(be);
402
403 be = new TModel();
404 n = new Name();
405 n.setValue("JUDDI_571_Part3_Test lang");
406 n.setLang("en");
407 be.setName(n);
408 sb.getTModel().add(be);
409
410 try {
411 TModelDetail saveTModel = publicationJoe.saveTModel(sb);
412 businesskeysToDelete.add(saveTModel.getTModel().get(0).getTModelKey());
413 businesskeysToDelete.add(saveTModel.getTModel().get(1).getTModelKey());
414 } catch (Exception ex) {
415 HandleException(ex);
416 Assert.fail("unexpected failure");
417 }
418
419 int found1 = 0;
420 FindTModel fb = new FindTModel();
421 fb.setAuthInfo(authInfoJoe);
422 n = new Name();
423 n.setValue("%JUDDI_571_Part3_Test%");
424 fb.setName(n);
425 fb.setFindQualifiers(new FindQualifiers());
426 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
427 try {
428 TModelList findTModel = inquiryJoe.findTModel(fb);
429 if (findTModel.getTModelInfos() != null) {
430 for (int i = 0; i < findTModel.getTModelInfos().getTModelInfo().size(); i++) {
431 if (businesskeysToDelete.contains(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey())) {
432 found1++;
433 }
434 }
435 }
436 } catch (Exception ex) {
437 HandleException(ex);
438 Assert.fail("unexpected failure");
439 }
440 if (found1 != 2) {
441 failuremsg += "No lang defined, " + found1 + " records found instead of 2";
442 }
443
444 found1 = 0;
445 fb = new FindTModel();
446 fb.setAuthInfo(authInfoJoe);
447 n = new Name();
448 n.setLang("en");
449 n.setValue("%JUDDI_571_Part3_Test%");
450 fb.setName(n);
451 fb.setFindQualifiers(new FindQualifiers());
452 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
453 try {
454 TModelList findTModel = inquiryJoe.findTModel(fb);
455 if (findTModel.getTModelInfos() != null) {
456 for (int i = 0; i < findTModel.getTModelInfos().getTModelInfo().size(); i++) {
457 if (businesskeysToDelete.contains(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey())) {
458 found1++;
459 }
460 }
461 }
462 } catch (Exception ex) {
463 HandleException(ex);
464 Assert.fail("unexpected failure");
465 }
466 if (found1 != 1) {
467 failuremsg += "Lang defined, " + found1 + " records found instead of 1";
468 }
469
470 DeleteTModels(businesskeysToDelete);
471 if (failuremsg.length() > 0) {
472 Assert.fail(failuremsg);
473 }
474 logger.info("Pass");
475
476 }
477
478 @Test
479 public void JUDDI_574() {
480 Assume.assumeTrue(TckPublisher.isEnabled());
481
482
483
484
485 List<String> businesskeysToDelete = new ArrayList<String>();
486
487 String failuremsg = "";
488 logger.info("JUDDI_574");
489 SaveTModel sb = new SaveTModel();
490 sb.setAuthInfo(authInfoJoe);
491 TModel be = new TModel();
492 Name n = new Name();
493 n.setValue("JUDDI_574");
494 n.setLang("en");
495 be.setName(n);
496 sb.getTModel().add(be);
497
498 try {
499 TModelDetail saveTModel = publicationJoe.saveTModel(sb);
500 businesskeysToDelete.add(saveTModel.getTModel().get(0).getTModelKey());
501 logger.info("tmodel created with key " + saveTModel.getTModel().get(0).getTModelKey());
502 } catch (Exception ex) {
503 HandleException(ex);
504 Assert.fail("unexpected failure");
505 }
506 int found1 = 0;
507 FindTModel fb = new FindTModel();
508 fb.setAuthInfo(authInfoJoe);
509 n = new Name();
510 n.setValue("JUDDI_574");
511 fb.setName(n);
512 fb.setFindQualifiers(new FindQualifiers());
513 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
514 try {
515 TModelList findTModel = inquiryJoe.findTModel(fb);
516 if (findTModel.getTModelInfos() != null) {
517 for (int i = 0; i < findTModel.getTModelInfos().getTModelInfo().size(); i++) {
518 if (businesskeysToDelete.contains(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey())) {
519 found1++;
520 if (findTModel.getTModelInfos().getTModelInfo().get(i).getName() == null
521 || findTModel.getTModelInfos().getTModelInfo().get(i).getName().getLang() == null
522 || findTModel.getTModelInfos().getTModelInfo().get(i).getName().getLang().length() == 0) {
523 failuremsg += "Tmodel key " + findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey()
524 + " has a null or empty lang";
525 }
526 }
527
528 }
529 }
530 } catch (Exception ex) {
531 HandleException(ex);
532 Assert.fail("unexpected failure");
533 }
534 if (found1 != 1) {
535 failuremsg += "found " + found1 + " records found instead of 1";
536 }
537
538 DeleteTModels(businesskeysToDelete);
539 if (failuremsg.length() > 0) {
540 Assert.fail(failuremsg);
541 }
542 logger.info("Pass");
543
544 }
545
546
547
548
549
550
551 @Test
552 public void JUDDI_590() throws Exception {
553 Assume.assumeTrue(TckPublisher.isEnabled());
554
555 logger.info("JUDDI_590");
556
557 SaveBusiness sb = new SaveBusiness();
558 sb.setAuthInfo(authInfoJoe);
559 BusinessEntity be = new BusinessEntity();
560 Name n = new Name();
561 n.setValue("JUDDI_590 Joe");
562 be.getName().add(n);
563 sb.getBusinessEntity().add(be);
564 String joeBiz = null;
565 try {
566 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
567 joeBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey();
568
569
570
571
572
573 } catch (SOAPFaultException ex) {
574 HandleException(ex);
575 }
576
577 sb = new SaveBusiness();
578 sb.setAuthInfo(authInfoSam);
579 be = new BusinessEntity();
580 n = new Name();
581 n.setValue("JUDDI_590 Sam");
582 be.getName().add(n);
583 sb.getBusinessEntity().add(be);
584 String samBiz = null;
585 try {
586 BusinessDetail saveBusiness = publicationSam.saveBusiness(sb);
587 samBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey();
588
589
590
591
592
593 } catch (SOAPFaultException ex) {
594 HandleException(ex);
595 }
596
597
598 AddPublisherAssertions apa = new AddPublisherAssertions();
599 apa.setAuthInfo(authInfoJoe);
600 apa.getPublisherAssertion().add(new PublisherAssertion());
601 apa.getPublisherAssertion().get(0).setFromKey(joeBiz);
602 apa.getPublisherAssertion().get(0).setToKey(samBiz);
603 KeyedReference kr = new KeyedReference();
604 kr.setKeyName("Subsidiary");
605 kr.setKeyValue("parent-child");
606 kr.setTModelKey("uddi:uddi.org:relationships");
607 apa.getPublisherAssertion().get(0).setKeyedReference(kr);
608 publicationJoe.addPublisherAssertions(apa);
609
610 boolean ok = true;
611 String msg = "";
612 try {
613 List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE);
614 if (assertionStatusReport.isEmpty()) {
615 msg = "Stage1: no result returned, expected at least 1";
616 ok = false;
617 }
618 for (int i = 0; i < assertionStatusReport.size(); i++) {
619 JAXB.marshal(assertionStatusReport.get(i), System.out);
620 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
621 if (!assertionStatusReport.get(i).getCompletionStatus().equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) {
622 ok = false;
623 msg = "Stage1: status type mismatch";
624 }
625 }
626 }
627 } catch (Exception ex) {
628 ok = false;
629 ex.printStackTrace();
630 }
631
632
633 apa = new AddPublisherAssertions();
634 apa.setAuthInfo(authInfoSam);
635 apa.getPublisherAssertion().add(new PublisherAssertion());
636 apa.getPublisherAssertion().get(0).setFromKey(joeBiz);
637 apa.getPublisherAssertion().get(0).setToKey(samBiz);
638 kr = new KeyedReference();
639 kr.setKeyName("Subsidiary");
640 kr.setKeyValue("parent-child");
641 kr.setTModelKey("uddi:uddi.org:relationships");
642 apa.getPublisherAssertion().get(0).setKeyedReference(kr);
643 publicationSam.addPublisherAssertions(apa);
644 try {
645 List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_COMPLETE);
646 if (assertionStatusReport.isEmpty()) {
647 msg = "Stage2: no result returned, expected at least 1";
648 ok = false;
649 }
650 for (int i = 0; i < assertionStatusReport.size(); i++) {
651 JAXB.marshal(assertionStatusReport.get(i), System.out);
652 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
653 if (!assertionStatusReport.get(i).getCompletionStatus().equals(CompletionStatus.STATUS_COMPLETE)) {
654 ok = false;
655 msg = "Stage2: status type mismatch";
656 }
657 }
658 }
659
660 if (!ok) {
661 assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_FROM_KEY_INCOMPLETE);
662 for (int i = 0; i < assertionStatusReport.size(); i++) {
663 JAXB.marshal(assertionStatusReport.get(i), System.out);
664 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
665 msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete";
666 }
667 }
668
669 assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE);
670 for (int i = 0; i < assertionStatusReport.size(); i++) {
671 JAXB.marshal(assertionStatusReport.get(i), System.out);
672 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
673 msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete";
674 }
675 }
676 assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_BOTH_INCOMPLETE);
677 for (int i = 0; i < assertionStatusReport.size(); i++) {
678 JAXB.marshal(assertionStatusReport.get(i), System.out);
679 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
680 msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete";
681 }
682 }
683
684 }
685 } catch (Exception ex) {
686 ok = false;
687 ex.printStackTrace();
688 }
689 List<String> biz = new ArrayList<String>();
690 biz.add(samBiz);
691 DeleteBusinesses(biz, authInfoSam, publicationSam);
692
693 biz = new ArrayList<String>();
694 biz.add(joeBiz);
695 DeleteBusinesses(biz, authInfoJoe, publicationJoe);
696 Assert.assertTrue(msg, ok);
697
698 }
699
700
701
702
703
704
705 @Test
706 public void JUDDI_590_1() throws Exception {
707 Assume.assumeTrue(TckPublisher.isEnabled());
708
709 logger.info("JUDDI_590_1");
710
711 SaveBusiness sb = new SaveBusiness();
712 sb.setAuthInfo(authInfoJoe);
713 BusinessEntity be = new BusinessEntity();
714 Name n = new Name();
715 n.setValue("JUDDI_590 Joe");
716 be.getName().add(n);
717 sb.getBusinessEntity().add(be);
718 String joeBiz = null;
719 try {
720 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
721 joeBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey();
722
723
724
725
726
727 } catch (SOAPFaultException ex) {
728 HandleException(ex);
729 }
730
731 sb = new SaveBusiness();
732 sb.setAuthInfo(authInfoSam);
733 be = new BusinessEntity();
734 n = new Name();
735 n.setValue("JUDDI_590 Sam");
736 be.getName().add(n);
737 sb.getBusinessEntity().add(be);
738 String samBiz = null;
739 try {
740 BusinessDetail saveBusiness = publicationSam.saveBusiness(sb);
741 samBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey();
742
743
744
745
746
747 } catch (SOAPFaultException ex) {
748 HandleException(ex);
749 }
750
751
752 AddPublisherAssertions apa = new AddPublisherAssertions();
753 apa.setAuthInfo(authInfoJoe);
754 apa.getPublisherAssertion().add(new PublisherAssertion());
755 apa.getPublisherAssertion().get(0).setFromKey(joeBiz);
756 apa.getPublisherAssertion().get(0).setToKey(samBiz);
757 KeyedReference kr = new KeyedReference();
758 kr.setKeyName("Subsidiary");
759 kr.setKeyValue("parent-child");
760 kr.setTModelKey("uddi:uddi.org:relationships");
761 apa.getPublisherAssertion().get(0).setKeyedReference(kr);
762 publicationJoe.addPublisherAssertions(apa);
763
764
765
766 boolean ok = true;
767 String msg = "";
768 try {
769 List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE);
770 if (assertionStatusReport.isEmpty()) {
771 msg = "Stage1: no result returned, expected at least 1";
772 ok = false;
773 }
774 for (int i = 0; i < assertionStatusReport.size(); i++) {
775 if (TckCommon.isDebug()) {
776 JAXB.marshal(assertionStatusReport.get(i), System.out);
777 }
778 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
779 if (!assertionStatusReport.get(i).getCompletionStatus().equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) {
780 ok = false;
781 msg = "Stage1: status type mismatch";
782 }
783 }
784 }
785 } catch (Exception ex) {
786 ok = false;
787 ex.printStackTrace();
788 }
789
790
791 try {
792 List<AssertionStatusItem> assertionStatusReport = publicationSam.getAssertionStatusReport(authInfoSam, CompletionStatus.STATUS_TO_KEY_INCOMPLETE);
793 if (assertionStatusReport.isEmpty()) {
794 msg = "Stage2: no result returned, expected at least 1";
795 ok = false;
796 }
797 for (int i = 0; i < assertionStatusReport.size(); i++) {
798 if (TckCommon.isDebug()) {
799 JAXB.marshal(assertionStatusReport.get(i), System.out);
800 }
801 if (assertionStatusReport.get(i).getToKey().equals(samBiz)) {
802 if (!assertionStatusReport.get(i).getCompletionStatus().equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) {
803 ok = false;
804 msg = "Stage2: status type mismatch";
805 }
806 }
807 }
808 } catch (Exception ex) {
809 ok = false;
810 ex.printStackTrace();
811 }
812
813 List<String> biz = new ArrayList<String>();
814 biz.add(samBiz);
815 DeleteBusinesses(biz, authInfoSam, publicationSam);
816
817 biz = new ArrayList<String>();
818 biz.add(joeBiz);
819 DeleteBusinesses(biz, authInfoJoe, publicationJoe);
820 Assert.assertTrue(msg, ok);
821
822 }
823 UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl();
824
825
826
827
828
829
830 @Test
831 public void JIRA_597() throws Exception {
832 Assume.assumeTrue(TckPublisher.isEnabled());
833 logger.info("JIRA_597");
834
835 int port = 7000;
836 String hostname = TckPublisher.getProperties().getProperty("bindaddress");
837 if (hostname == null) {
838 hostname = InetAddress.getLocalHost().getHostName();
839 }
840
841 TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
842 UDDISubscriptionListenerImpl.notifcationMap.clear();
843 UDDISubscriptionListenerImpl.notificationCount = 0;
844 Endpoint ep = null;
845 boolean ok = false;
846 do {
847 try {
848 logger.info("Attempting to bring up endpoint at " + "http://" + hostname + ":" + port + "/UDDI_CALLBACK");
849 ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl);
850 ok = true;
851 } catch (Exception ex) {
852 logger.warn("Trouble starting endpoint: " + ex.getMessage());
853 port++;
854 }
855 } while (!ok);
856 SaveBusiness sb = new SaveBusiness();
857 sb.setAuthInfo(authInfoJoe);
858 BusinessEntity be = new BusinessEntity();
859 be.getName().add(new Name());
860 be.getName().get(0).setValue("Joe's callback business");
861 be.setBusinessServices(new BusinessServices());
862 BusinessService bs = new BusinessService();
863 bs.getName().add(new Name());
864 bs.getName().get(0).setValue("Joe's callback service");
865 bs.setBindingTemplates(new BindingTemplates());
866 BindingTemplate bt = new BindingTemplate();
867 bt.setAccessPoint(new AccessPoint());
868 bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
869 bt.getAccessPoint().setUseType("endPoint");
870
871 TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
872 instanceInfo.setTModelKey("uddi:uddi.org:transport:http");
873 bt.setTModelInstanceDetails(new TModelInstanceDetails());
874 bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
875
876 bs.getBindingTemplates().getBindingTemplate().add(bt);
877
878 bs.getBindingTemplates().getBindingTemplate().add(bt);
879 be.getBusinessServices().getBusinessService().add(bs);
880 sb.getBusinessEntity().add(be);
881 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
882
883 List<String> deleteme = new ArrayList<String>();
884 deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
885
886
887
888 sb = new SaveBusiness();
889 sb.setAuthInfo(authInfoSam);
890 be = new BusinessEntity();
891 be.getName().add(new Name());
892 be.getName().get(0).setValue("Sam's business");
893 sb.getBusinessEntity().add(be);
894 BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb);
895
896
897 Holder<List<Subscription>> list = new Holder<List<Subscription>>();
898 list.value = new ArrayList<Subscription>();
899 Subscription s = new Subscription();
900 s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
901 s.setSubscriptionFilter(new SubscriptionFilter());
902 s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
903 s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
904 DatatypeFactory df = DatatypeFactory.newInstance();
905 GregorianCalendar gcal = new GregorianCalendar();
906 gcal.setTimeInMillis(System.currentTimeMillis());
907 gcal.add(Calendar.HOUR, 1);
908 s.setExpiresAfter(df.newXMLGregorianCalendar(gcal));
909
910 s.setNotificationInterval(df.newDuration(5000));
911 list.value.add(s);
912 subscriptionJoe.saveSubscription(authInfoJoe, list);
913
914
915 sb = new SaveBusiness();
916 sb.setAuthInfo(authInfoSam);
917 be = saveBusiness1.getBusinessEntity().get(0);
918 be.getName().get(0).setLang("en");
919 sb.getBusinessEntity().add(be);
920 publicationSam.saveBusiness(sb);
921 int maxwait = 30000;
922 logger.info("waiting for callbacks");
923 while (maxwait > 0) {
924 if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) {
925 break;
926 }
927 Thread.sleep(1000);
928 maxwait = maxwait - 1000;
929 }
930 TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
931 this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
932 deleteme.clear();
933 deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
934 this.DeleteBusinesses(deleteme, authInfoSam, publicationSam);
935 ep.stop();
936 if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) {
937 Assert.fail("no callbacks were recieved.");
938 }
939
940 }
941
942
943
944
945
946
947
948
949 @Test
950 public void JIRA_596() throws Exception {
951 Assume.assumeTrue(TckPublisher.isEnabled());
952 logger.info("JIRA_596");
953 int port = 9000;
954
955 String hostname = TckPublisher.getProperties().getProperty("bindaddress");
956 if (hostname == null) {
957 hostname = InetAddress.getLocalHost().getHostName();
958 }
959
960
961 TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
962
963 UDDISubscriptionListenerImpl.notifcationMap.clear();
964 UDDISubscriptionListenerImpl.notificationCount = 0;
965
966 Endpoint ep = null;
967 boolean ok = false;
968 do {
969 try {
970 ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl);
971 ok = true;
972 } catch (Exception ex) {
973 port++;
974 }
975 } while (!ok);
976 SaveBusiness sb = new SaveBusiness();
977 sb.setAuthInfo(authInfoJoe);
978 BusinessEntity be = new BusinessEntity();
979 be.getName().add(new Name());
980 be.getName().get(0).setValue("Joe's callback business");
981 be.setBusinessServices(new BusinessServices());
982 BusinessService bs = new BusinessService();
983 bs.getName().add(new Name());
984 bs.getName().get(0).setValue("Joe's callback service");
985 bs.setBindingTemplates(new BindingTemplates());
986 BindingTemplate bt = new BindingTemplate();
987 bt.setAccessPoint(new AccessPoint());
988 bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
989 bt.getAccessPoint().setUseType("endPoint");
990
991
992
993
994
995
996 bs.getBindingTemplates().getBindingTemplate().add(bt);
997 be.getBusinessServices().getBusinessService().add(bs);
998 sb.getBusinessEntity().add(be);
999 logger.info("setting up joe's callback business");
1000 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1001
1002 List<String> deleteme = new ArrayList<String>();
1003 deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
1004
1005
1006
1007 sb = new SaveBusiness();
1008 sb.setAuthInfo(authInfoSam);
1009 be = new BusinessEntity();
1010 be.getName().add(new Name());
1011 be.getName().get(0).setValue("Sam's business");
1012 sb.getBusinessEntity().add(be);
1013 logger.info("saving sam's business");
1014 BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb);
1015
1016
1017 Holder<List<Subscription>> list = new Holder<List<Subscription>>();
1018 list.value = new ArrayList<Subscription>();
1019 Subscription s = new Subscription();
1020 s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
1021 s.setSubscriptionFilter(new SubscriptionFilter());
1022 s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
1023 s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
1024 DatatypeFactory df = DatatypeFactory.newInstance();
1025 GregorianCalendar gcal = new GregorianCalendar();
1026 gcal.setTimeInMillis(System.currentTimeMillis());
1027 gcal.add(Calendar.HOUR, 1);
1028 s.setExpiresAfter(df.newXMLGregorianCalendar(gcal));
1029
1030 s.setNotificationInterval(df.newDuration(5000));
1031 list.value.add(s);
1032 logger.info("subscribing joe's to updates for sam's business");
1033 subscriptionJoe.saveSubscription(authInfoJoe, list);
1034
1035
1036 sb = new SaveBusiness();
1037 sb.setAuthInfo(authInfoSam);
1038 be = saveBusiness1.getBusinessEntity().get(0);
1039 be.getName().get(0).setLang("en");
1040 sb.getBusinessEntity().add(be);
1041 logger.info("altering sam's business");
1042 publicationSam.saveBusiness(sb);
1043 logger.info("Waiting...");
1044 int maxwait = 30000;
1045 while (maxwait > 0) {
1046 if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) {
1047 break;
1048 }
1049 Thread.sleep(1000);
1050 maxwait = maxwait - 1000;
1051 }
1052 TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
1053 DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
1054 deleteme.clear();
1055 deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
1056 DeleteBusinesses(deleteme, authInfoSam, publicationSam);
1057 ep.stop();
1058 if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) {
1059 logger.error("no callbacks were recieved");
1060 Assert.fail("no callbacks were recieved.");
1061 }
1062 logger.info("callback response was " + UDDISubscriptionListenerImpl.notifcationMap.get(0));
1063 logger.info("PASS");
1064
1065 }
1066
1067
1068
1069 @Test
1070 public void JIRA_575_BT() throws Exception {
1071 Assume.assumeTrue(TckPublisher.isEnabled());
1072 logger.info("JIRA_575_BT");
1073 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1074 GetTModelDetail gtm = new GetTModelDetail();
1075 gtm.setAuthInfo(authInfoJoe);
1076 gtm.getTModelKey().add(madeupTmodel);
1077 TModelDetail tModelDetail = null;
1078 try {
1079 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1080 } catch (Exception ex) {
1081 }
1082 Assume.assumeTrue(tModelDetail == null);
1083
1084 SaveBusiness sb = new SaveBusiness();
1085 sb.setAuthInfo(authInfoJoe);
1086 BusinessEntity be = new BusinessEntity();
1087 be.getName().add(new Name());
1088 be.getName().get(0).setValue("Joe's JIRA_575_BT business");
1089 be.setBusinessServices(new BusinessServices());
1090 BusinessService bs = new BusinessService();
1091 bs.getName().add(new Name());
1092 bs.getName().get(0).setValue("Joe's JIRA_575_BT service");
1093 bs.setBindingTemplates(new BindingTemplates());
1094 BindingTemplate bt = new BindingTemplate();
1095 bt.setAccessPoint(new AccessPoint());
1096 bt.getAccessPoint().setValue("http://JIRA_575_BT/UDDI_CALLBACK");
1097 bt.getAccessPoint().setUseType("endPoint");
1098
1099 TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
1100 instanceInfo.setTModelKey(madeupTmodel);
1101 bt.setTModelInstanceDetails(new TModelInstanceDetails());
1102 bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
1103
1104 bs.getBindingTemplates().getBindingTemplate().add(bt);
1105 be.getBusinessServices().getBusinessService().add(bs);
1106 sb.getBusinessEntity().add(be);
1107 logger.info("setting up joe's callback business");
1108 try {
1109 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1110 Assert.fail("unexpected success");
1111 } catch (Exception ex) {
1112 logger.error(ex.getMessage());
1113 }
1114
1115 }
1116
1117 @Test
1118 public void JIRA_575_KR_Biz() throws Exception {
1119 Assume.assumeTrue(TckPublisher.isEnabled());
1120 logger.info("JIRA_575_KR_Biz");
1121 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1122 GetTModelDetail gtm = new GetTModelDetail();
1123 gtm.setAuthInfo(authInfoJoe);
1124 gtm.getTModelKey().add(madeupTmodel);
1125 TModelDetail tModelDetail = null;
1126 try {
1127 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1128 } catch (Exception ex) {
1129 }
1130 Assume.assumeTrue(tModelDetail == null);
1131
1132 SaveBusiness sb = new SaveBusiness();
1133 sb.setAuthInfo(authInfoJoe);
1134 BusinessEntity be = new BusinessEntity();
1135 be.getName().add(new Name());
1136 be.getName().get(0).setValue("Joe's JIRA_575_KR_Biz business");
1137
1138 be.setCategoryBag(new CategoryBag());
1139 be.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val"));
1140 sb.getBusinessEntity().add(be);
1141
1142 try {
1143 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1144 Assert.fail("unexpected success");
1145 } catch (Exception ex) {
1146 logger.error(ex.getMessage());
1147 }
1148
1149 }
1150
1151 @Test
1152 public void JIRA_575_IDENT_Biz() throws Exception {
1153 Assume.assumeTrue(TckPublisher.isEnabled());
1154 logger.info("JIRA_575_IDENT_Biz");
1155 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1156 GetTModelDetail gtm = new GetTModelDetail();
1157 gtm.setAuthInfo(authInfoJoe);
1158 gtm.getTModelKey().add(madeupTmodel);
1159 TModelDetail tModelDetail = null;
1160 try {
1161 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1162 } catch (Exception ex) {
1163 }
1164 Assume.assumeTrue(tModelDetail == null);
1165
1166 SaveBusiness sb = new SaveBusiness();
1167 sb.setAuthInfo(authInfoJoe);
1168 BusinessEntity be = new BusinessEntity();
1169 be.getName().add(new Name());
1170 be.getName().get(0).setValue("Joe's JIRA_575_IDENT_Biz business");
1171
1172 be.setIdentifierBag(new IdentifierBag());
1173 be.getIdentifierBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val"));
1174 sb.getBusinessEntity().add(be);
1175
1176 try {
1177 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1178 Assert.fail("unexpected success");
1179 } catch (Exception ex) {
1180 logger.error(ex.getMessage());
1181 }
1182
1183 }
1184
1185 @Test
1186 public void JIRA_575_KR_TMODEL() throws Exception {
1187 Assume.assumeTrue(TckPublisher.isEnabled());
1188 logger.info("JIRA_575_KR_TMODEL");
1189 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1190 GetTModelDetail gtm = new GetTModelDetail();
1191 gtm.setAuthInfo(authInfoJoe);
1192 gtm.getTModelKey().add(madeupTmodel);
1193 TModelDetail tModelDetail = null;
1194 try {
1195 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1196 } catch (Exception ex) {
1197 }
1198 Assume.assumeTrue(tModelDetail == null);
1199
1200 SaveTModel stm = new SaveTModel();
1201 stm.setAuthInfo(authInfoJoe);
1202 TModel tm = new TModel();
1203 tm.setName(new Name("JIRA_575_KR_TMODEL", null));
1204 tm.setCategoryBag(new CategoryBag());
1205 tm.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val"));
1206 stm.getTModel().add(tm);
1207 try {
1208 publicationJoe.saveTModel(stm);
1209 Assert.fail("unexpected success");
1210 } catch (Exception ex) {
1211 logger.error(ex.getMessage());
1212 }
1213 }
1214
1215 @Test
1216 public void JIRA_575_KRGRP_TMODEL() throws Exception {
1217 Assume.assumeTrue(TckPublisher.isEnabled());
1218 logger.info("JIRA_575_KRGRP_TMODEL");
1219 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1220 GetTModelDetail gtm = new GetTModelDetail();
1221 gtm.setAuthInfo(authInfoJoe);
1222 gtm.getTModelKey().add(madeupTmodel);
1223 TModelDetail tModelDetail = null;
1224 try {
1225 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1226 } catch (Exception ex) {
1227 }
1228 Assume.assumeTrue(tModelDetail == null);
1229
1230 SaveTModel stm = new SaveTModel();
1231 stm.setAuthInfo(authInfoJoe);
1232 TModel tm = new TModel();
1233 tm.setName(new Name("JIRA_575_KRGRP_TMODEL", null));
1234 tm.setCategoryBag(new CategoryBag());
1235 tm.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup());
1236 tm.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel);
1237 stm.getTModel().add(tm);
1238 try {
1239 publicationJoe.saveTModel(stm);
1240 Assert.fail("unexpected success");
1241 } catch (Exception ex) {
1242 logger.error(ex.getMessage());
1243 }
1244 }
1245
1246 @Test
1247 public void JIRA_575_KRGRP_Biz() throws Exception {
1248 Assume.assumeTrue(TckPublisher.isEnabled());
1249 logger.info("JIRA_575_KRGRP_Biz");
1250 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1251 GetTModelDetail gtm = new GetTModelDetail();
1252 gtm.setAuthInfo(authInfoJoe);
1253 gtm.getTModelKey().add(madeupTmodel);
1254 TModelDetail tModelDetail = null;
1255 try {
1256 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1257 } catch (Exception ex) {
1258 }
1259 Assume.assumeTrue(tModelDetail == null);
1260
1261 SaveBusiness sb = new SaveBusiness();
1262 sb.setAuthInfo(authInfoJoe);
1263 BusinessEntity be = new BusinessEntity();
1264 be.getName().add(new Name());
1265 be.getName().get(0).setValue("Joe's JIRA_575_KRGRP_Biz business");
1266
1267 be.setCategoryBag(new CategoryBag());
1268
1269 be.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup());
1270 be.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel);
1271
1272 sb.getBusinessEntity().add(be);
1273
1274 try {
1275 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1276 Assert.fail("unexpected success");
1277 } catch (Exception ex) {
1278 logger.error(ex.getMessage());
1279 }
1280
1281 }
1282
1283 @Test
1284 public void JIRA_575_KRGRP_PA() throws Exception {
1285 Assume.assumeTrue(TckPublisher.isEnabled());
1286 logger.info("JIRA_575_KRGRP_PA");
1287 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1288 GetTModelDetail gtm = new GetTModelDetail();
1289 gtm.setAuthInfo(authInfoJoe);
1290 gtm.getTModelKey().add(madeupTmodel);
1291 TModelDetail tModelDetail = null;
1292 try {
1293 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1294 } catch (Exception ex) {
1295 }
1296 Assume.assumeTrue(tModelDetail == null);
1297
1298 tckTmodelUddi.saveTmodels(authInfoUddi);
1299 tckTmodelUddi.saveUDDIPublisherTmodel(authInfoUddi);
1300
1301 tckTModelSam.saveSamSyndicatorTmodel(authInfoSam);
1302 tckTModelJoe.saveJoePublisherTmodel(authInfoJoe);
1303
1304 tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe);
1305 tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam);
1306
1307 AddPublisherAssertions apa = new AddPublisherAssertions();
1308 apa.setAuthInfo(authInfoJoe);
1309 PublisherAssertion pa = new PublisherAssertion();
1310 pa.setKeyedReference(new KeyedReference(madeupTmodel, "name", "val"));
1311 pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY);
1312 pa.setToKey(TckBusiness.SAM_BUSINESS_KEY);
1313 apa.getPublisherAssertion().add(pa);
1314 try {
1315 publicationJoe.addPublisherAssertions(apa);
1316 Assert.fail("unexpected success");
1317 } catch (Exception ex) {
1318 logger.error(ex.getMessage());
1319 } finally {
1320 tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe);
1321 tckBusinessSam.deleteSamSyndicatorBusiness(authInfoSam);
1322 tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe);
1323 tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam);
1324 }
1325 }
1326
1327 @Test
1328 public void JIRA_575_SVC_KR() throws Exception {
1329 Assume.assumeTrue(TckPublisher.isEnabled());
1330 logger.info("JIRA_575_SVC_KR");
1331 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1332 GetTModelDetail gtm = new GetTModelDetail();
1333 gtm.setAuthInfo(authInfoJoe);
1334 gtm.getTModelKey().add(madeupTmodel);
1335 TModelDetail tModelDetail = null;
1336 try {
1337 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1338 } catch (Exception ex) {
1339 }
1340 Assume.assumeTrue(tModelDetail == null);
1341
1342 SaveBusiness sb = new SaveBusiness();
1343 sb.setAuthInfo(authInfoJoe);
1344 BusinessEntity be = new BusinessEntity();
1345 be.getName().add(new Name());
1346 be.getName().get(0).setValue("Joe's JIRA_575_SVC_KR business");
1347 be.setBusinessServices(new BusinessServices());
1348 BusinessService bs = new BusinessService();
1349 bs.getName().add(new Name());
1350 bs.getName().get(0).setValue("Joe's JIRA_575_SVC_KR service");
1351
1352 bs.setCategoryBag(new CategoryBag());
1353 bs.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val"));
1354
1355 be.getBusinessServices().getBusinessService().add(bs);
1356 sb.getBusinessEntity().add(be);
1357
1358 try {
1359 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1360 Assert.fail("unexpected success");
1361 } catch (Exception ex) {
1362 logger.error(ex.getMessage());
1363 }
1364 }
1365
1366 @Test
1367 public void JIRA_575_SVC_KRGRP() throws Exception {
1368 Assume.assumeTrue(TckPublisher.isEnabled());
1369 logger.info("JIRA_575_SVC_KRGRP");
1370 String madeupTmodel = "uddi" + UUID.randomUUID().toString();
1371 GetTModelDetail gtm = new GetTModelDetail();
1372 gtm.setAuthInfo(authInfoJoe);
1373 gtm.getTModelKey().add(madeupTmodel);
1374 TModelDetail tModelDetail = null;
1375 try {
1376 tModelDetail = inquiryJoe.getTModelDetail(gtm);
1377 } catch (Exception ex) {
1378 }
1379 Assume.assumeTrue(tModelDetail == null);
1380
1381 SaveBusiness sb = new SaveBusiness();
1382 sb.setAuthInfo(authInfoJoe);
1383 BusinessEntity be = new BusinessEntity();
1384 be.getName().add(new Name());
1385 be.getName().get(0).setValue("Joe's JIRA_575_SVC_KRGRP business");
1386 be.setBusinessServices(new BusinessServices());
1387 BusinessService bs = new BusinessService();
1388 bs.getName().add(new Name());
1389 bs.getName().get(0).setValue("Joe's JIRA_575_SVC_KRGRP service");
1390
1391 bs.setCategoryBag(new CategoryBag());
1392 bs.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup());
1393 bs.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel);
1394
1395 be.getBusinessServices().getBusinessService().add(bs);
1396 sb.getBusinessEntity().add(be);
1397
1398 try {
1399 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
1400 Assert.fail("unexpected success");
1401 } catch (Exception ex) {
1402 logger.error(ex.getMessage());
1403 }
1404 }
1405
1406 private void DeleteBusinesses(List<String> businesskeysToDelete, String authinfo, UDDIPublicationPortType pub) {
1407
1408 try {
1409 DeleteBusiness db = new DeleteBusiness();
1410 db.setAuthInfo(authinfo);
1411 db.getBusinessKey().addAll(businesskeysToDelete);
1412 pub.deleteBusiness(db);
1413 } catch (Exception ex) {
1414 ex.printStackTrace();
1415 }
1416 }
1417
1418 private void DeleteBusinesses(String businesskeysToDelete, String authinfo, UDDIPublicationPortType pub) {
1419
1420 try {
1421 DeleteBusiness db = new DeleteBusiness();
1422 db.setAuthInfo(authinfo);
1423 db.getBusinessKey().add(businesskeysToDelete);
1424 pub.deleteBusiness(db);
1425 } catch (Exception ex) {
1426 ex.printStackTrace();
1427 }
1428 }
1429
1430 private void DeleteTModels(List<String> businesskeysToDelete) {
1431
1432
1433 try {
1434 DeleteTModel db = new DeleteTModel();
1435 db.setAuthInfo(authInfoJoe);
1436 db.getTModelKey().addAll(businesskeysToDelete);
1437 publicationJoe.deleteTModel(db);
1438 } catch (Exception ex) {
1439 ex.printStackTrace();
1440 }
1441 }
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451 @Test
1452 public void JUDDI_849_AddressLineAttributeTest() throws Exception {
1453 BusinessEntity be = new BusinessEntity();
1454 be.setContacts(new Contacts());
1455 Contact c = new Contact();
1456 c.getPersonName().add(new PersonName("bob", null));
1457 Address addr = new Address();
1458 addr.setTModelKey("uddi:tmodelkey:address");
1459 addr.getAddressLine().add(new AddressLine(null, null, "1313 mockingbird lane"));
1460 c.getAddress().add(addr);
1461 be.getContacts().getContact().add(c);
1462 be.getName().add(new Name("test JUDDI849", null));
1463
1464 SaveBusiness sb = new SaveBusiness();
1465 sb.getBusinessEntity().add(be);
1466 sb.setAuthInfo(authInfoJoe);
1467 try {
1468 publicationJoe.saveBusiness(sb);
1469 Assert.fail("unexpected success");
1470 } catch (Exception ex) {
1471 logger.info("Expected failure: " + ex.getMessage());
1472 logger.debug("Expected failure: " + ex.getMessage(), ex);
1473 }
1474
1475 }
1476
1477 }