This project has retired. For details please refer to its Attic page.
TckValidator xref
View Javadoc
1   /*
2    * Copyright 2001-2009 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *      http://www.apache.org/licenses/LICENSE-2.0
8    * 
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.apache.juddi.v3.tck;
16  
17  /**
18   * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
19   * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
20   * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
21   */
22  import java.util.Arrays;
23  import static junit.framework.Assert.assertEquals;
24  import static junit.framework.Assert.assertTrue;
25  
26  import java.util.Collection;
27  import java.util.Iterator;
28  import java.util.List;
29  import javax.xml.bind.JAXB;
30  import javax.xml.bind.JAXBElement;
31  import javax.xml.transform.dom.DOMResult;
32  import javax.xml.transform.dom.DOMSource;
33  import org.custommonkey.xmlunit.Diff;
34  import org.custommonkey.xmlunit.XMLUnit;
35  
36  import org.uddi.api_v3.BindingTemplate;
37  import org.uddi.api_v3.BindingTemplates;
38  import org.uddi.api_v3.CategoryBag;
39  import org.uddi.api_v3.Contact;
40  import org.uddi.api_v3.Contacts;
41  import org.uddi.api_v3.Description;
42  import org.uddi.api_v3.DiscoveryURL;
43  import org.uddi.api_v3.DiscoveryURLs;
44  import org.uddi.api_v3.HostingRedirector;
45  import org.uddi.api_v3.InstanceDetails;
46  import org.uddi.api_v3.KeyedReference;
47  import org.uddi.api_v3.Name;
48  import org.uddi.api_v3.OverviewDoc;
49  import org.uddi.api_v3.OverviewURL;
50  import org.uddi.api_v3.PersonName;
51  import org.uddi.api_v3.TModelInstanceDetails;
52  import org.uddi.api_v3.TModelInstanceInfo;
53  import org.w3._2000._09.xmldsig_.CanonicalizationMethodType;
54  import org.w3._2000._09.xmldsig_.DigestMethodType;
55  import org.w3._2000._09.xmldsig_.KeyInfoType;
56  import org.w3._2000._09.xmldsig_.ObjectType;
57  import org.w3._2000._09.xmldsig_.ReferenceType;
58  import org.w3._2000._09.xmldsig_.SignatureMethodType;
59  import org.w3._2000._09.xmldsig_.SignatureType;
60  import org.w3._2000._09.xmldsig_.SignatureValueType;
61  import org.w3._2000._09.xmldsig_.SignedInfoType;
62  import org.w3._2000._09.xmldsig_.TransformType;
63  import org.w3._2000._09.xmldsig_.TransformsType;
64  import org.w3c.dom.Document;
65  import org.w3c.dom.Element;
66  import org.w3c.dom.Node;
67  
68  public class TckValidator {
69  
70  	
71  	
72  
73  	public static void checkNames(List<Name> names1, List<Name> names2) {
74  		if (names1 == null || names2 == null) {
75  			assertEquals(names1, names2);
76  			return;
77  		}
78  		assertEquals(names1.size(), names2.size());
79  		Iterator<Name> names1Itr = names1.iterator();
80  		Iterator<Name> names2Itr = names2.iterator();
81  		while (names1Itr.hasNext()) {
82  			Name name1 = names1Itr.next();
83  			Name name2 = names2Itr.next();
84  			assertEquals(name1.getLang(), name2.getLang());
85  			assertEquals(name1.getValue(), name2.getValue());
86  		}
87  	}
88  	
89  	public static void checkDescriptions(List<Description> descriptions1, List<Description> descriptions2) {
90  		if (descriptions1 == null || descriptions2 == null) {
91  			assertEquals(descriptions1, descriptions2);
92  			return;
93  		}
94  		assertEquals(descriptions1.size(), descriptions2.size());
95  		Iterator<Description> descriptions1Itr = descriptions1.iterator();
96  		Iterator<Description> descriptions2Itr = descriptions2.iterator();
97  		while (descriptions1Itr.hasNext()) {
98  			Description description1 = descriptions1Itr.next();
99  			Description description2 = descriptions2Itr.next();
100 			assertEquals(description1.getLang(), description2.getLang());
101 			assertEquals(description1.getValue(), description2.getValue());
102 		}
103 	}
104 	
105 	public static void checkDiscoveryUrls(DiscoveryURLs discs1, DiscoveryURLs discs2) {
106 		if (discs1 == null || discs2 == null) {
107 			assertEquals(discs1, discs2);
108 			return;
109 		}
110 		List<DiscoveryURL> discList1 = discs1.getDiscoveryURL();
111 		List<DiscoveryURL> discList2 = discs2.getDiscoveryURL();
112 		
113 		if (discList1 == null || discList2 == null) {
114 			assertEquals(discList1, discList2);
115 			return;
116 		}
117 		assertEquals(discList1.size(), discList2.size());
118 		Iterator<DiscoveryURL> discList1Itr = discList1.iterator();
119 		Iterator<DiscoveryURL> discList2Itr = discList2.iterator();
120 		while (discList1Itr.hasNext()) {
121 			DiscoveryURL disc1 = discList1Itr.next();
122 			DiscoveryURL disc2 = discList2Itr.next();
123 			assertEquals(disc1.getUseType(), disc2.getUseType());
124 			assertEquals(disc1.getValue(), disc2.getValue());
125 		}
126 	}
127 	
128         public static void checkSignatures(List<SignatureType> sigs1, List<SignatureType> sigs2) {
129             if (sigs1 == null || sigs2 == null) {
130 			assertEquals(sigs1, sigs2);
131 			return;
132             }
133             assertEquals(sigs1.size(), sigs2.size());
134             Iterator<SignatureType> sigsList1Itr = sigs1.iterator();
135             Iterator<SignatureType> sigsList2Itr = sigs2.iterator();
136             while (sigsList1Itr.hasNext()) {
137                     SignatureType sig1 = sigsList1Itr.next();
138                     SignatureType sig2 = sigsList2Itr.next();
139                     
140                     assertEquals(sig1.getId(), sig2.getId());
141                     checkKeyInfo(sig1.getKeyInfo(), sig2.getKeyInfo());
142                     checkObjectType(sig1.getObject(), sig2.getObject());
143                     checkSignatureValue(sig1.getSignatureValue(), sig2.getSignatureValue());
144                     checkSignedInfo(sig1.getSignedInfo(), sig2.getSignedInfo());
145             }
146         }
147         
148         public static void checkKeyInfo(KeyInfoType kit1, KeyInfoType kit2) {
149             if (kit1 == null || kit2 == null) {
150                     assertEquals(kit1, kit2);
151                     return;
152             }
153             assertEquals(kit1.getId(), kit2.getId());
154 
155             DOMResult domResult1 = new DOMResult();
156             DOMResult domResult2 = new DOMResult();
157             JAXB.marshal(kit1, domResult1);
158             JAXB.marshal(kit2, domResult2);
159             
160             Document doc1 = (Document)domResult1.getNode();
161             DOMSource domSource1 = new DOMSource(doc1.getDocumentElement());
162             Document doc2 = (Document)domResult2.getNode();
163             DOMSource domSource2 = new DOMSource(doc2.getDocumentElement());
164             XMLUnit.setIgnoreAttributeOrder(true);
165             XMLUnit.setIgnoreComments(true);
166             XMLUnit.setIgnoreWhitespace(true);
167             Diff diff = new Diff(domSource1, domSource2);
168             assertTrue("Key info elements should match", diff.similar());
169         }
170         
171         public static void checkObjectType(List<ObjectType> obj1List, List<ObjectType> obj2List) {
172             if (obj1List == null || obj2List == null) {
173                 assertEquals(obj1List, obj2List);
174                 return;
175             }
176             assertEquals(obj1List.size(), obj2List.size());
177             Iterator<ObjectType> objList1Itr = obj1List.iterator();
178             Iterator<ObjectType> objList2Itr = obj2List.iterator();
179             while (objList1Itr.hasNext()) {
180                     ObjectType obj1 = objList1Itr.next();
181                     ObjectType obj2 = objList2Itr.next();
182                     assertEquals(obj1.getEncoding(), obj2.getEncoding());
183                     assertEquals(obj1.getId(), obj2.getId());
184                     assertEquals(obj1.getMimeType(), obj2.getMimeType());
185             }
186         }
187         
188         public static void checkSignatureValue(SignatureValueType sv1, SignatureValueType sv2) {
189             if (sv1 == null || sv2 == null) {
190                 assertEquals(sv1, sv2);
191                 return;
192             }
193             assertEquals(sv1.getId(), sv2.getId());
194             assertTrue(Arrays.equals(sv1.getValue(), sv2.getValue()));
195         }
196         
197         public static void checkSignedInfo(SignedInfoType si1, SignedInfoType si2) {
198             if (si1 == null || si2 == null) {
199                 assertEquals(si1, si2);
200                 return;
201             }
202             assertEquals(si1.getId(), si2.getId());
203             checkCanonicalizationMethod(si1.getCanonicalizationMethod(), si2.getCanonicalizationMethod());
204             checkReference(si1.getReference(), si2.getReference());
205             checkSignatureMethod(si1.getSignatureMethod(), si2.getSignatureMethod());
206         }
207         
208         public static void checkCanonicalizationMethod(CanonicalizationMethodType cm1, CanonicalizationMethodType cm2) {
209             if (cm1 ==  null || cm2 == null) {
210                 assertEquals(cm1, cm2);
211                 return;
212             }
213             assertEquals(cm1.getAlgorithm(), cm2.getAlgorithm());
214         }
215         
216         public static void checkReference(List<ReferenceType> r1List, List<ReferenceType> r2List) {
217             if (r1List == null || r2List == null) {
218                 assertEquals(r1List, r2List);
219                 return;
220             }
221             assertEquals(r1List.size(), r2List.size());
222             
223             Iterator<ReferenceType> rList1Itr = r1List.iterator();
224             Iterator<ReferenceType> rList2Itr = r2List.iterator();
225             while (rList1Itr.hasNext()) {
226                     ReferenceType r1 = rList1Itr.next();
227                     ReferenceType r2 = rList2Itr.next();
228                     checkReference(r1, r2);
229             }
230         }
231         
232         public static void checkReference(ReferenceType r1, ReferenceType r2) {
233             assertTrue(Arrays.equals(r1.getDigestValue(), r2.getDigestValue()));
234             assertEquals(r1.getId(), r2.getId());
235             assertEquals(r1.getType(), r2.getType());
236             assertEquals(r1.getURI(), r2.getURI());
237             
238             checkDigestMethod(r1.getDigestMethod(), r2.getDigestMethod());
239             checkTransforms(r1.getTransforms(), r2.getTransforms());
240         }
241         
242         public static void checkDigestMethod(DigestMethodType dm1, DigestMethodType dm2) {
243             if (dm1 == null || dm2 == null) {
244                 assertEquals(dm1, dm2);
245                 return;
246             }
247             assertEquals(dm1.getAlgorithm(), dm2.getAlgorithm());
248         }
249         
250         public static void checkTransforms(TransformsType tTypes1, TransformsType tTypes2) {
251             if (tTypes1 == null || tTypes2 == null) {
252                 assertEquals(tTypes1, tTypes2);
253                 return;
254             }
255             List<TransformType> tt1List = tTypes1.getTransform();
256             List<TransformType> tt2List = tTypes2.getTransform();
257             if (tt1List == null || tt2List == null) {
258                 assertEquals(tt1List, tt2List);
259                 return;
260             }
261             assertEquals(tt1List.size(), tt2List.size());
262             
263             Iterator<TransformType> ttList1Itr = tt1List.iterator();
264             Iterator<TransformType> ttList2Itr = tt2List.iterator();
265             while (ttList1Itr.hasNext()) {
266                     TransformType tx1 = ttList1Itr.next();
267                     TransformType tx2 = ttList2Itr.next();
268                     
269                     assertEquals(tx1.getAlgorithm(), tx2.getAlgorithm());
270                     checkTransformContentList(tx1.getContent(), tx2.getContent());
271             }
272         }
273         
274         public static void checkTransformContentList(List<Object> list1, List<Object> list2) {
275             if (list1 == null || list2 == null) {
276                 assertEquals(list1, list2);
277                 return;
278             }
279             assertEquals(list1.size(), list2.size());
280             
281             Iterator<Object> list1Itr = list1.iterator();
282             Iterator<Object> list2Itr = list2.iterator();
283             while (list1Itr.hasNext()) {
284                 Object obj1 = list1Itr.next();
285                 Object obj2 = list2Itr.next();
286 
287                 if (obj1 instanceof String) {
288                     assertEquals((String)obj1, obj2);
289                 } else if (obj1 instanceof Element || obj1 instanceof JAXBElement) {
290                     if (obj1 instanceof JAXBElement) {
291                         DOMResult domResult = new DOMResult();
292                         JAXB.marshal(obj1, domResult);
293                         obj1 = ((Document)domResult.getNode()).getDocumentElement();
294                     }
295                     if (obj2 instanceof JAXBElement) {
296                         DOMResult domResult = new DOMResult();
297                         JAXB.marshal(obj2, domResult);
298                         obj2 = ((Document)domResult.getNode()).getDocumentElement();
299                     }
300                     XMLUnit.setIgnoreAttributeOrder(true);
301                     XMLUnit.setIgnoreComments(true);
302                     DOMSource domSrc1 = new DOMSource((Element)obj1);
303                     DOMSource domSrc2 = new DOMSource((Element)obj2);
304                     Diff diff = new Diff(domSrc1, domSrc2);
305                     assertTrue("Element should be the same", diff.similar());
306                 } else {
307                     throw new RuntimeException("Unrecognized type: " + obj1.getClass());
308                 }
309             }
310         }
311         
312         public static void checkSignatureMethod(SignatureMethodType smt1, SignatureMethodType smt2) {
313             if (smt1 == null || smt2 == null) {
314                 assertEquals(smt1, smt2);
315                 return;
316             }
317             assertEquals(smt1.getAlgorithm(), smt2.getAlgorithm());
318         }
319         
320 	public static void checkContacts(Contacts contacts1, Contacts contacts2) {
321 		if (contacts1 == null || contacts2 == null) {
322 			assertEquals(contacts1, contacts2);
323 			return;
324 		}
325 		List<Contact> contactList1 = contacts1.getContact();
326 		List<Contact> contactList2 = contacts2.getContact();
327 		if (contactList1 == null || contactList2 == null) {
328 			assertEquals(contactList1, contactList2);
329 			return;
330 		}
331 		assertEquals(contactList1.size(), contactList2.size());
332 		Iterator<Contact> contactList1Itr = contactList1.iterator();
333 		Iterator<Contact> contactList2Itr = contactList2.iterator();
334 		while (contactList1Itr.hasNext()) {
335 			Contact contact1 = contactList1Itr.next();
336 			Contact contact2 = contactList2Itr.next();
337 			assertEquals(contact1.getUseType(), contact2.getUseType());
338 			
339 			checkPersonNames(contact1.getPersonName(), contact2.getPersonName());
340 			checkDescriptions(contact1.getDescription(), contact2.getDescription());
341 		}
342 	}
343 	
344 	public static void checkPersonNames(List<PersonName> names1, List<PersonName> names2) {
345 		if (names1 == null || names2 == null) {
346 			assertEquals(names1, names2);
347 			return;
348 		}
349 		assertEquals(names1.size(), names2.size());
350 		Iterator<PersonName> names1Itr = names1.iterator();
351 		Iterator<PersonName> names2Itr = names2.iterator();
352 		while (names1Itr.hasNext()) {
353 			PersonName name1 = names1Itr.next();
354 			PersonName name2 = names2Itr.next();
355 			assertEquals(name1.getLang(), name2.getLang());
356 			assertEquals(name1.getValue(), name2.getValue());
357 		}
358 	}
359 
360 	public static void checkCategories(CategoryBag cbag1, CategoryBag cbag2) {
361 		if (cbag1 == null || cbag2 == null) {
362 			assertEquals(cbag1, cbag2);
363 			return;
364 		}
365 		List<KeyedReference> elemList1 = cbag1.getKeyedReference();
366 		List<KeyedReference> elemList2 = cbag2.getKeyedReference();
367 		if (elemList1 == null || elemList2 == null) {
368 			assertEquals(elemList1, elemList2);
369 			return;
370 		}
371 		// In object could have KeyedReferenceGroups which are ignored.  For now, only solo KeyedReferences are checked.
372 		//assertEquals(elemList1.size(), elemList2.size());
373 		Iterator<KeyedReference> elemList1Itr = elemList1.iterator();
374 		Iterator<KeyedReference> elemList2Itr = elemList2.iterator();
375 		while (elemList1Itr.hasNext()) {
376 			KeyedReference elem1 = elemList1Itr.next();
377 			if (elem1 instanceof org.uddi.api_v3.KeyedReference) {
378 				KeyedReference elem2 = elemList2Itr.next();
379 				assertEquals(elem1.getTModelKey(), elem2.getTModelKey());
380 				assertEquals(elem1.getKeyName(), elem2.getKeyName());
381 				assertEquals(elem1.getKeyValue(), elem2.getKeyValue());
382 			}
383 			// add comparing keyedReferenceGroup
384 		}
385 	}
386 	
387 	public static void checkBindingTemplates(BindingTemplates bts1, BindingTemplates bts2) {
388 		if (bts1 == null || bts2 == null) {
389 			assertEquals(bts1, bts2);
390 			return;
391 		}
392 		assertEquals(bts1.getBindingTemplate().size(), bts2.getBindingTemplate().size());
393 		Iterator<BindingTemplate> bt1Iter  = bts1.getBindingTemplate().iterator();
394 		Iterator<BindingTemplate> bt2Iter  = bts2.getBindingTemplate().iterator();
395 		while (bt1Iter.hasNext()) {
396 			BindingTemplate bt1 = bt1Iter.next();
397 			BindingTemplate bt2 = bt2Iter.next();
398 			assertEquals(bt1.getAccessPoint().getValue(),bt2.getAccessPoint().getValue());
399 			assertEquals(bt1.getAccessPoint().getUseType(),bt2.getAccessPoint().getUseType());
400 			assertEquals(bt1.getBindingKey().toLowerCase(),bt2.getBindingKey());
401 			checkCategories(bt1.getCategoryBag(), bt2.getCategoryBag());
402 			checkDescriptions(bt1.getDescription(),bt2.getDescription());
403 			checkHostingRedirector(bt1.getHostingRedirector(),bt2.getHostingRedirector());
404 			//the inbound apiBindingTemplate can have a null serviceKey
405 			if (bt1.getServiceKey()!=null) {
406 				assertEquals(bt1.getServiceKey(),bt2.getServiceKey());
407 			}
408 			checkTModelInstanceDetails(bt1.getTModelInstanceDetails(),bt2.getTModelInstanceDetails());
409 		}
410 	}
411 	
412 	public static void checkTModelInstanceDetails(TModelInstanceDetails tmds1, TModelInstanceDetails tmds2) {
413 		if (tmds1 == null || tmds2 == null) {
414 			assertEquals(tmds1, tmds2);
415 			return;
416 		}
417 		assertEquals(tmds1.getTModelInstanceInfo().size(),tmds2.getTModelInstanceInfo().size());
418 		Iterator<TModelInstanceInfo> tmIter1 = tmds1.getTModelInstanceInfo().iterator();
419 		Iterator<TModelInstanceInfo> tmIter2 = tmds2.getTModelInstanceInfo().iterator();
420 		while (tmIter1.hasNext()) {
421 			TModelInstanceInfo tmI1 = tmIter1.next();
422 			TModelInstanceInfo tmI2 = tmIter2.next();
423 			checkDescriptions(tmI1.getDescription(), tmI2.getDescription());
424 			checkInstanceDetails(tmI1.getInstanceDetails(), tmI2.getInstanceDetails());
425 			assertEquals(tmI1.getTModelKey().toLowerCase(),tmI2.getTModelKey());
426 		}
427 	}
428 	
429 	public static void checkInstanceDetails(InstanceDetails ids1, InstanceDetails ids2) {
430 		if (ids1 == null || ids2 == null) {
431 			assertEquals(ids1, ids2);
432 			return;
433 		}
434 		List<Description> elem1s =  ids1.getDescription();
435 		List<Description> elem2s =  ids2.getDescription();
436 		Iterator<Description> elem1 = elem1s.iterator();
437 
438 		boolean isMatch=false;
439 
440 		if (elem1s.size() == 0 && elem2s.size() == 0) {
441 			isMatch = true;
442 		}
443 		
444 		while (elem1.hasNext()) {
445 			Description desc1 = elem1.next();
446 			
447 			if (desc1 instanceof org.uddi.api_v3.Description) {
448 				//Descriptions
449 				Iterator<Description> elem2 = elem2s.iterator();
450 				while (elem2.hasNext()) {
451 					Description desc2 = elem2.next();
452 					if (desc2 instanceof org.uddi.api_v3.Description) {
453 						if (desc1.getLang().equals(desc2.getLang()) && desc1.getValue().equals(desc2.getValue())) {
454 							isMatch=true;
455 							break;
456 						}
457 					}
458 				}
459 			}
460 		}
461 		assertTrue(isMatch);
462 
463 		
464 		List<OverviewDoc> odoc1s =  ids1.getOverviewDoc();
465 		List<OverviewDoc> odoc2s =  ids2.getOverviewDoc();
466 		Iterator<OverviewDoc> docelem1 = odoc1s.iterator();
467 		isMatch = false;
468 		if (odoc1s.size() == 0 && odoc2s.size() == 0) {
469 			isMatch = true;
470 		}
471 		
472 		while (docelem1.hasNext()) {
473 			OverviewDoc odoc1 = docelem1.next();
474 			if (odoc1 instanceof org.uddi.api_v3.OverviewDoc) {
475 				//OverviewDocs
476 				checkOverviewDocs(odoc1, odoc2s);
477 				isMatch=true;
478 			}
479 		}
480 		
481 		assertEquals((String)ids1.getInstanceParms(),(String)ids2.getInstanceParms());
482 		assertTrue(isMatch);
483 	}
484 	
485 	public static void checkOverviewDocs(OverviewDoc doc1, List<OverviewDoc> elem2s) {
486 		boolean isMatch=false;
487 		Iterator<OverviewDoc> elem2 = elem2s.iterator();
488 		//Match against any OverviewDocs in the elem2 list
489 		while (elem2.hasNext()) {
490 			OverviewDoc doc2 = elem2.next();
491 			if (doc2 instanceof org.uddi.api_v3.OverviewDoc) {
492 				//match doc1 against this doc2
493 				isMatch = compareOverviewDocs(doc1, doc2);
494 				if (isMatch) break;
495 			}
496 		}
497 		assertTrue(isMatch);
498 	}
499 	
500 	public static void checkOverviewDocs(OverviewDoc doc1, Collection<OverviewDoc> doc2s) {
501 		boolean isMatch=false;
502 		Iterator<OverviewDoc> docIter = doc2s.iterator();
503 		while (docIter.hasNext()) {
504 			OverviewDoc doc2 = docIter.next();
505 			//match doc1 against this doc2
506 			isMatch = compareOverviewDocs(doc1, doc2);
507 			if (isMatch) break;
508 		}
509 		assertTrue(isMatch);
510 	}
511 	
512 	public static boolean compareOverviewDocs(OverviewDoc doc1, OverviewDoc doc2) 
513 	{	
514 		boolean descMatch=false;
515 		boolean urlMatch =false;
516 
517 		OverviewURL url1 = (OverviewURL) doc1.getOverviewURL();
518 		OverviewURL url2 = (OverviewURL) doc2.getOverviewURL();
519 		if (url1.getUseType().equals(url2.getUseType()) && url1.getValue().trim().equals(url2.getValue().trim())) {
520 			urlMatch=true;
521 		}
522 
523 
524 		List<Description> descList1 = doc1.getDescription();
525 		Iterator<Description> descIter1 = descList1.iterator();
526 		if (descList1.size() == 0 && doc2.getDescription().size() == 0) {
527 			descMatch = true;
528 		}
529 		while (descIter1.hasNext()) {
530 			Description descr1 = (Description) descIter1.next();
531 			List<Description> descList2 = doc2.getDescription();
532 			Iterator<Description> descElem2 = descList2.iterator();
533 			while (descElem2.hasNext()) {
534 				Description descr2 = descElem2.next();
535 				if (descr1.getLang().equals(descr2.getLang()) && descr1.getValue().equals(descr2.getValue())) {
536 					descMatch=true;
537 				}
538 			}
539 		}
540 
541 		if (urlMatch && descMatch) {
542 				return true;
543 		}
544 		return false;
545 	}
546 	
547 	
548 	
549 	public static void checkHostingRedirector(HostingRedirector hr1, HostingRedirector hr2) {
550 		if (hr1 == null || hr2 == null) {
551 			assertEquals(hr1, hr2);
552 			return;
553 		}
554 		assertEquals(hr1.getBindingKey(),hr2.getBindingKey());
555 	}
556 	
557 }