1 17 package org.alfresco.example.webservice; 18 19 import javax.xml.rpc.ServiceException ; 20 21 import junit.framework.AssertionFailedError; 22 23 import org.alfresco.example.webservice.authentication.AuthenticationResult; 24 import org.alfresco.example.webservice.authentication.AuthenticationServiceLocator; 25 import org.alfresco.example.webservice.authentication.AuthenticationServiceSoapBindingStub; 26 import org.alfresco.example.webservice.types.Store; 27 import org.alfresco.example.webservice.types.StoreEnum; 28 import org.alfresco.service.cmr.repository.StoreRef; 29 import org.alfresco.util.BaseTest; 30 import org.apache.commons.logging.Log; 31 import org.apache.commons.logging.LogFactory; 32 33 42 public abstract class BaseWebServiceSystemTest extends BaseTest 43 { 44 private static Log logger = LogFactory.getLog(BaseWebServiceSystemTest.class); 45 46 private static final String USERNAME = "admin"; 47 private static final String PASSWORD = "admin"; 48 49 62 protected static String rootId = "fddc4ffb-1ace-11da-b3ba-e981aa43b126"; 63 protected static String companyHomeId = "fe289b3d-1ace-11da-b3ba-e981aa43b126"; 64 protected Store STORE = new Store(StoreEnum.workspace, "SpacesStore"); 65 protected StoreRef STORE_REF = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); 66 67 70 @Override 71 protected void setUp() throws Exception 72 { 73 super.setUp(); 74 AuthenticationServiceSoapBindingStub authSvc = null; 75 try 76 { 77 authSvc = (AuthenticationServiceSoapBindingStub)new AuthenticationServiceLocator().getAuthenticationService(); 78 } 79 catch (ServiceException jre) 80 { 81 if (jre.getLinkedCause() != null) 82 { 83 jre.getLinkedCause().printStackTrace(); 84 } 85 86 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 87 } 88 89 assertNotNull("authSvc is null", authSvc); 90 91 authSvc.setTimeout(60000); 93 94 AuthenticationResult result = authSvc.authenticate(USERNAME, PASSWORD); 96 assertNotNull("result is null", result); 97 String ticket = result.getTicket(); 98 assertNotNull("ticket is null", ticket); 99 TicketHolder.ticket = ticket; 100 if (logger.isDebugEnabled()) 101 logger.debug("Retrieved and stored ticket: " + TicketHolder.ticket); 102 } 103 } 104 | Popular Tags |