1 /* 2 * ==================================================================== 3 * 4 * This code is subject to the freebxml License, Version 1.1 5 * 6 * Copyright (c) 2003 freebxml.org. All rights reserved. 7 * 8 * ==================================================================== 9 */ 10 11 package com.sun.xml.registry.ebxml; 12 13 import junit.framework.*; 14 15 import java.util.*; 16 import java.io.*; 17 import javax.activation.*; 18 import javax.xml.registry.*; 19 import javax.xml.registry.infomodel.*; 20 21 /*** 22 * 23 * @author mzaremba 24 */ 25 public class JTestSystem extends TestCase { 26 27 static ApelonJAXRTestSetup setup = null; 28 29 /*** Creates a new instance of JTestSystem */ 30 public JTestSystem(String testMethod) 31 { 32 super(testMethod); 33 } 34 35 public static Test suite() throws Exception 36 { 37 TestSuite suite= new TestSuite(); 38 39 suite.addTest(new JTestSystem("testClassificationSchemes")); 40 suite.addTest(new JTestSystem("testFindConcept")); 41 42 setup = new ApelonJAXRTestSetup(suite); 43 return setup; 44 } 45 46 /* 47 * Test browsing for Classification Schemes (AssociationType used in this test) 48 * and for Classification Concepts 49 */ 50 public void testClassificationSchemes() throws Exception { 51 ArrayList al = new ArrayList(); 52 al.add("Asso%"); 53 BulkResponse br = setup.bqm.findClassificationSchemes(null, al, null, null); 54 assertNull(br.getExceptions()); 55 if (br == null) { 56 fail("AssociationType classification schemes could not be found"); 57 } 58 Collection collection = br.getCollection(); 59 Iterator i = collection.iterator(); 60 ClassificationScheme cs = (ClassificationScheme)i.next(); 61 assertEquals(cs.getName().getValue(), "AssociationType"); 62 63 String[] children = new String[] {"AffiliatedWith", "EmployeeOf", "MemberOf", 64 "RelatedTo", "HasFederationMember", "HasMember", 65 "ExternallyLinks", "Contains", "EquivalentTo", 66 "Extends", "Implements", "InstanceOf", 67 "Supersedes", "Uses", "Replaces", "SubmitterOf", 68 "ResponsibleFor", "OwnerOf", "OffersService", 69 "ContentManagementServiceFor", "InvocationControlFileFor", 70 "AccessControlPolicyFor"}; 71 ArrayList childrenList = new ArrayList(); 72 for (int index =0; index < children.length; index++) { 73 childrenList.add(children[index]); 74 } 75 76 Collection collection2 = cs.getChildrenConcepts(); 77 for (Iterator it = collection2.iterator(); it.hasNext(); ) { 78 Concept con = (Concept)it.next(); 79 assertTrue("Cannot find concept: " + con.getValue(), childrenList.contains(con.getValue())); 80 } 81 } 82 83 public void testFindConcept() throws Exception { 84 String[] objectTypes = new String[] {"xml", "xslt", "xmlSchema", "ebxml", "registry", 85 "rim", "RegistryObject", "Association", 86 "AuditableEvent", "Classification", "ClassificationNode", 87 "ExternalIdentifier", "ExternalLink", "Organization", 88 "ServiceBinding", "SpecificationLink", "User", 89 "RegistryEntry", "ClassificationScheme", "RegistryPackage", 90 "Service", "ExtrinsicObject"}; 91 ArrayList objectTypesList = new ArrayList(); 92 for (int index =0; index < objectTypes.length; index++) { 93 objectTypesList.add(objectTypes[index]); 94 } 95 96 ArrayList cNamePats = new ArrayList(); 97 cNamePats.add("%"); 98 BulkResponse br = setup.bqm.findConcepts(null, cNamePats, null, null, null); 99 assertNull(br.getExceptions()); 100 if (br == null) { 101 fail("No Concept found that match patern %"); 102 } 103 104 ArrayList conceptsList = new ArrayList(); 105 Collection collection = br.getCollection(); 106 for (Iterator it = collection.iterator(); it.hasNext(); ) { 107 conceptsList.add(((Concept)it.next()).getValue()); 108 } 109 assertTrue("Not all Object Types available in registry", conceptsList.containsAll(objectTypesList)); 110 } 111 } 112

This page was automatically generated by Maven