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 package com.sun.xml.registry.ebxml; 11 12 import java.util.HashSet; 13 import java.util.Properties; 14 15 import javax.xml.registry.BusinessLifeCycleManager; 16 import javax.xml.registry.BusinessQueryManager; 17 import javax.xml.registry.Connection; 18 import javax.xml.registry.ConnectionFactory; 19 import javax.xml.registry.DeclarativeQueryManager; 20 import javax.xml.registry.RegistryService; 21 import junit.extensions.TestSetup; 22 import junit.framework.TestSuite; 23 24 import com.sun.xml.registry.ebxml.util.SecurityUtil; 25 import com.sun.xml.registry.ebxml.util.ProviderProperties; 26 27 /*** 28 * <p>Title: </p> 29 * <p>Description: </p> 30 * <p>Copyright: Copyright (c) 2002</p> 31 * <p>Company: </p> 32 * @author unascribed 33 * @version 1.0 34 */ 35 36 public class ApelonJAXRTestSetup extends TestSetup { 37 38 SecurityUtil securityUtil = SecurityUtil.getInstance(); 39 RegistryService service; 40 BusinessQueryManager bqm; 41 BusinessLifeCycleManager lcm; 42 DeclarativeQueryManager dqm; 43 Connection connection; 44 45 public ApelonJAXRTestSetup(TestSuite suite) 46 throws Exception 47 { 48 super(suite); 49 } 50 51 protected void setUp() throws Exception 52 { 53 // Default registry URL 54 String regUrl = "http://localhost:8080/ebxmlrr/registry/soap"; 55 regUrl = ProviderProperties.getInstance().getProperty( 56 "jaxr.server.url", regUrl); 57 58 ConnectionFactory connFactory = ConnectionFactory.newInstance(); 59 60 Properties props = new Properties(); 61 props.put("javax.xml.registry.queryManagerURL", regUrl); 62 connFactory.setProperties(props); 63 connection = connFactory.createConnection(); 64 65 // Set credentials 66 String alias = "mykey"; 67 alias = ProviderProperties.getInstance().getProperty("jaxr-ebxml.security.alias", alias); 68 HashSet creds = new HashSet(); 69 creds.add(securityUtil.aliasToX500PrivateCredential(alias)); 70 connection.setCredentials(creds); 71 72 // creds.add(secUtil.aliasToX500PrivateCredential(alias)); 73 // connection.setCredentials(creds); 74 75 service = connection.getRegistryService(); 76 bqm = service.getBusinessQueryManager(); 77 lcm = service.getBusinessLifeCycleManager(); 78 dqm = service.getDeclarativeQueryManager(); 79 } 80 81 /*** 82 * Closes a Connection when it is no longer needed 83 */ 84 protected void tearDown() throws Exception { 85 connection.close(); 86 } 87 88 /*** 89 * Getter for property lcm. 90 * @return Value of property lcm. 91 */ 92 public javax.xml.registry.BusinessLifeCycleManager getLCM() { 93 return lcm; 94 } 95 96 /*** 97 * Getter for property bqm. 98 * @return Value of property bqm. 99 */ 100 public javax.xml.registry.BusinessQueryManager getBQM() { 101 return bqm; 102 } 103 104 /*** 105 * Getter for property dqm. 106 * @return Value of property dqm. 107 */ 108 public javax.xml.registry.DeclarativeQueryManager getDQM() { 109 return dqm; 110 } 111 112 }

This page was automatically generated by Maven