You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2005/03/03 22:15:14 UTC
svn commit: r156086 - in incubator/apollo/trunk/src:
java/org/apache/ws/util/ site/content/example/ site/content/example/requests/
site/content/example/src/test/org/oasisOpen/docs/wsrf/
Author: scamp
Date: Thu Mar 3 13:15:09 2005
New Revision: 156086
URL: http://svn.apache.org/viewcvs?view=rev&rev=156086
Log: (empty)
Added:
incubator/apollo/trunk/src/site/content/example/test-build.properties
incubator/apollo/trunk/src/site/content/example/test.xml
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
incubator/apollo/trunk/src/site/content/example/ (props changed)
incubator/apollo/trunk/src/site/content/example/requests/Destroy_Job.soap
incubator/apollo/trunk/src/site/content/example/requests/GetPrinterPropertiesDoc.soap
incubator/apollo/trunk/src/site/content/example/requests/SendDocument.soap
incubator/apollo/trunk/src/site/content/example/requests/SetTerminationTime.soap
incubator/apollo/trunk/src/site/content/example/requests/Set_InsertJobHoldOvernight.soap
incubator/apollo/trunk/src/site/content/example/requests/Set_MultiInsertJobHold.soap
incubator/apollo/trunk/src/site/content/example/requests/Set_Should_Fail.soap
incubator/apollo/trunk/src/site/content/example/src/test/org/oasisOpen/docs/wsrf/InteropTestCase.java
Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java Thu Mar 3 13:15:09 2005
@@ -307,11 +307,14 @@
{
parentXBean = getRootElement( parentXBean );
XmlCursor parentCursor = parentXBean.newCursor();
+
+
if ( parentCursor.toLastChild() )
{
parentCursor.toEndToken();
+ parentCursor.toNextToken();
}
- parentCursor.toNextToken();
+ parentCursor.toEndToken();
xBean = getRootElement( xBean );
parentCursor.insertElement( getName( xBean ) );
parentCursor.toPrevSibling();
Propchange: incubator/apollo/trunk/src/site/content/example/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Mar 3 13:15:09 2005
@@ -1,2 +1,4 @@
*.iml
classes
+test-classes
+classes
Modified: incubator/apollo/trunk/src/site/content/example/requests/Destroy_Job.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/Destroy_Job.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/Destroy_Job.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/Destroy_Job.soap Thu Mar 3 13:15:09 2005
@@ -7,8 +7,7 @@
<Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:To mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:To>
- <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
- <wsrf-pr-wsdl:ResourceID>Job1</wsrf-pr-wsdl:ResourceID>
+ <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
</Header>
<Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/GetPrinterPropertiesDoc.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/GetPrinterPropertiesDoc.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/GetPrinterPropertiesDoc.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/GetPrinterPropertiesDoc.soap Thu Mar 3 13:15:09 2005
@@ -5,7 +5,7 @@
<Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:To mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:To>
- <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
+ <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
</Header>
<Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/SendDocument.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/SendDocument.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/SendDocument.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/SendDocument.soap Thu Mar 3 13:15:09 2005
@@ -7,9 +7,7 @@
<Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:To mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:To>
- <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
- <wsrf-pr-wsdl:ResourceID mustUnderstand="1"
- xmlns:wsrf-pr-wsdl="http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl">Job1</wsrf-pr-wsdl:ResourceID>
+ <wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
</Header>
<Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/SetTerminationTime.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/SetTerminationTime.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/SetTerminationTime.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/SetTerminationTime.soap Thu Mar 3 13:15:09 2005
@@ -9,7 +9,7 @@
<Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:To mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:To>
<wsa:Action mustUnderstand="1">http://localhost:8080/wsrf/services/PrinterFactory</wsa:Action>
- <wsrf-pr-wsdl:ResourceID>Job1</wsrf-pr-wsdl:ResourceID>
+
</Header>
<Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/Set_InsertJobHoldOvernight.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/Set_InsertJobHoldOvernight.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/Set_InsertJobHoldOvernight.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/Set_InsertJobHoldOvernight.soap Thu Mar 3 13:15:09 2005
@@ -12,9 +12,7 @@
<Body>
<wsrf-rp:SetResourceProperties>
<wsrf-rp:Insert>
- <wsrf-pr:job_hold_until_supported>
- Overnight
- </wsrf-pr:job_hold_until_supported>
+ <wsrf-pr:job_hold_until_supported>Overnight</wsrf-pr:job_hold_until_supported>
</wsrf-rp:Insert>
</wsrf-rp:SetResourceProperties>
</Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/Set_MultiInsertJobHold.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/Set_MultiInsertJobHold.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/Set_MultiInsertJobHold.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/Set_MultiInsertJobHold.soap Thu Mar 3 13:15:09 2005
@@ -12,15 +12,11 @@
<Body>
<wsrf-rp:SetResourceProperties>
<wsrf-rp:Insert>
- <wsrf-pr:job_hold_until_supported>
- No-Hold
- </wsrf-pr:job_hold_until_supported>
+ <wsrf-pr:job_hold_until_supported>No-Hold</wsrf-pr:job_hold_until_supported>
</wsrf-rp:Insert>
<wsrf-rp:Insert>
- <wsrf-pr:job_hold_until_default>
- No-Hold
- </wsrf-pr:job_hold_until_default>
+ <wsrf-pr:job_hold_until_default>No-Hold</wsrf-pr:job_hold_until_default>
</wsrf-rp:Insert>
</wsrf-rp:SetResourceProperties>
</Body>
Modified: incubator/apollo/trunk/src/site/content/example/requests/Set_Should_Fail.soap
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/requests/Set_Should_Fail.soap?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/requests/Set_Should_Fail.soap (original)
+++ incubator/apollo/trunk/src/site/content/example/requests/Set_Should_Fail.soap Thu Mar 3 13:15:09 2005
@@ -12,22 +12,14 @@
<Body>
<wsrf-rp:SetResourceProperties>
<wsrf-rp:Update>
- <wsrf-pr:job_hold_until_supported>
- No-Hold
- </wsrf-pr:job_hold_until_supported>
- <wsrf-pr:job_hold_until_supported>
- After-9pm
- </wsrf-pr:job_hold_until_supported>
- <wsrf-rp:Update>
+ <wsrf-pr:job_hold_until_supported>No-Hold</wsrf-pr:job_hold_until_supported>
+ <wsrf-pr:job_hold_until_supported>After-9pm</wsrf-pr:job_hold_until_supported>
+ </wsrf-rp:Update>
<wsrf-rp:Insert>
- <wsrf-pr:job_hold_until_default>
- No-Hold
- </wsrf-pr:job_hold_until_default>
+ <wsrf-pr:job_hold_until_default>No-Hold</wsrf-pr:job_hold_until_default>
</wsrf-rp:Insert>
</wsrf-rp:SetResourceProperties>
</Body>
</Envelope>
-
-<!- Should Fail! -->
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/test/org/oasisOpen/docs/wsrf/InteropTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/test/org/oasisOpen/docs/wsrf/InteropTestCase.java?view=diff&r1=156085&r2=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/test/org/oasisOpen/docs/wsrf/InteropTestCase.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/test/org/oasisOpen/docs/wsrf/InteropTestCase.java Thu Mar 3 13:15:09 2005
@@ -17,7 +17,9 @@
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.PrinterPortPropertyQNames;
import org.xmlsoap.schemas.soap.envelope.Envelope;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.xmlsoap.schemas.soap.envelope.Header;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
import javax.xml.namespace.QName;
import java.io.File;
@@ -36,22 +38,34 @@
public class InteropTestCase extends AbstractOneAxisTestCase
{
//this makes the test case not start the axis server...
- private static boolean m_runAxisServer = true;
+ /**
+ * Check system property, else the default is true
+ */
+ private static boolean m_runAxisServer = System.getProperty("runAxis") != null ? Boolean.valueOf(System.getProperty("runAxis")).booleanValue() : true;
+
private static String PRINTER_FACTORY_PORT = "PrinterFactory";
private static final String PRINTER_PORT = "PrinterPort";
private static final String JOB_PORT = "JobPort";
//setup urls
private String m_baseURL = "http://localhost:8080/wsrf/services/";
- private String m_printerFactoryURL = m_baseURL + PRINTER_FACTORY_PORT;
+
+ /**
+ * check system property else the default is the baseurl
+ */
+ private String m_printerFactoryURL = System.getProperty("printerFactoryURL") != null ? System.getProperty("printerFactoryURL") : m_baseURL + PRINTER_FACTORY_PORT;
private String m_printerURL = m_baseURL + PRINTER_PORT;
private String m_jobURL = m_baseURL + JOB_PORT;
//setup base path
- private File m_basePath = new File(".");
+ /**
+ * check system property else the default is "."
+ */
+ private File m_basePath = System.getProperty("basedir") != null ? new File(System.getProperty("basedir")) : new File(".");
//setup requests path
private File m_requestsDir = new File(m_basePath, "requests");
private static final String SOAP_REQ_CREATE_PRINTER = "CreatePrinter.soap";
+ private ReferencePropertiesType m_printerReferenceProperties;
public InteropTestCase()
@@ -96,41 +110,36 @@
return new FileProvider(InteropTestCase.class.getResourceAsStream("/server-config.wsdd"));
}
- //***** tests ********
-
- public void createPrinter() throws IOException
+ public void createPrinter() throws IOException
{
String response = sendRequest(m_printerFactoryURL, SOAP_REQ_CREATE_PRINTER);
assertTrue(response.indexOf("CreatePrinterResponse") > -1);
EnvelopeDocument envelopeDocument = loadResponseEnvelope(response);
- CreatePrinterResponseDocument.CreatePrinterResponse creatPrinter = (CreatePrinterResponseDocument.CreatePrinterResponse) XmlBeanUtils.getChildElements(envelopeDocument.getEnvelope().getBody(), new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "CreatePrinterResponse"))[0];
- setPrinterURL(creatPrinter);
- }
-
- private void setPrinterURL(CreatePrinterResponseDocument.CreatePrinterResponse create)
- {
- EndpointReferenceType printerRef = (EndpointReferenceType) XmlBeanUtils.getChildElements(create, PrinterPortPropertyQNames.PRINTER_REFERENCE )[0];
- m_printerURL = printerRef.getAddress().getStringValue();
+ CreatePrinterResponseDocument.CreatePrinterResponse createPrinter = (CreatePrinterResponseDocument.CreatePrinterResponse) XmlBeanUtils.getChildElements(envelopeDocument.getEnvelope().getBody(), new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "CreatePrinterResponse"))[0];
+ setPrinterURL(createPrinter);
+ setPrinterReferenceProps(createPrinter);
}
+ //***** tests ********
public void testValidatePrinterInitialState() throws IOException
{
- String response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+ String response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("printer_properties") > -1);
assertTrue(response.indexOf("job_count>0") > -1);
assertTrue(response.indexOf("accepting_jobs>false") > -1);
}
+
public void testGetPrinterQueueCount_SCENARIO_A1() throws IOException
{
- String response = sendRequest(m_printerURL, "GetQueuedJobCount.soap");
+ String response = sendPrinterRequest("GetQueuedJobCount.soap");
assertTrue(response.indexOf("GetResourcePropertyResponse") > -1);
assertTrue(response.indexOf("draft-03.xsd\">0") > -1);
}
public void testGetPrinterStateAndQueueCount_SCENARIO_A2() throws IOException
{
- String response = sendRequest(m_printerURL, "GetMulti.soap");
+ String response = sendPrinterRequest("GetMulti.soap");
assertTrue(response.indexOf("GetMultipleResourcePropertiesResponse") > -1);
assertTrue(response.indexOf("Idle") > -1);
assertTrue(response.indexOf("raft-03.xsd\">0") > -1);
@@ -138,7 +147,7 @@
public void testGetPrinterResourcePropertiesDocument_SCENARIO_A3() throws IOException
{
- String response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+ String response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("GetResourcePropertyDocumentResponse") > -1);
assertTrue(response.indexOf("printer_properties") > -1);
assertTrue(response.indexOf("operations_supported") > -1);
@@ -146,43 +155,44 @@
public void testQueryResourceProperties_SCENARIO_A4() throws IOException
{
- String response = sendRequest(m_printerURL, "QueryPropertiesDoc.soap");
+ String response = sendPrinterRequest("QueryPropertiesDoc.soap");
assertTrue(response.indexOf("QueryResourcePropertiesResponse") > -1);
assertTrue(response.indexOf("true") > -1);
}
- /* public void testQueryCompletedJobs_SCENARIO_A4_VARIANT() throws IOException
- { //do this is after jobs are created
- String response = sendRequest(m_printerURL, "QueryJobsCompleted.soap");
- assertTrue(response.indexOf("QueryResourcePropertiesResponse") > -1);
- // look at response to see how to validate
- //assertTrue(response.indexOf("true") > -1);//check further once understand issue
- }
-*/
+ /* public void testQueryCompletedJobs_SCENARIO_A4_VARIANT() throws IOException
+ { //do this is after jobs are created
+ String response = sendRequest(m_printerURL, "QueryJobsCompleted.soap");
+ assertTrue(response.indexOf("QueryResourcePropertiesResponse") > -1);
+ // look at response to see how to validate
+ //assertTrue(response.indexOf("true") > -1);//check further once understand issue
+ }
+ */
public void testUpdateResourceProperties_SCENARIO_B1() throws IOException
{
- String response = sendRequest(m_printerURL, "UpdateProps.soap");
+ String response = sendPrinterRequest("UpdateProps.soap");
assertTrue(response.indexOf("UpdateResourcePropertiesResponse") > -1);
}
public void testFailInsertResourceProps_SCENARIO_B1_FAIL() throws IOException
{
- String response = sendRequest(m_printerURL, "InsertProps.soap");
- assertTrue(response.indexOf("InvalidInsertResourcePropertiesRequestContent") > -1);
+ String response = sendPrinterRequest("InsertProps.soap");
+ assertTrue(response.indexOf("InvalidInsertResourcePropertiesRequestContentFault") > -1);
}
public void testSetResourceProperties_SCENARIO_B2() throws IOException
{
- String response = sendRequest(m_printerURL, "Set_UpdateDocFormat.soap");
+ String response = sendPrinterRequest("Set_UpdateDocFormat.soap");
assertTrue(response.indexOf("SetResourcePropertiesResponse") > -1);
- response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+
+ response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("text/plain") > -1);
assertTrue(response.indexOf("application/postscript") > -1);
// document_format_supported insert/delete should fail
- response = sendRequest(m_printerURL, "Set_DeleteDocFormat.soap");
+ response = sendPrinterRequest("Set_DeleteDocFormat.soap");
assertTrue(response.indexOf("fault") > -1);
- response = sendRequest(m_printerURL, "Set_InsertDocFormat.soap");
+ response = sendPrinterRequest("Set_InsertDocFormat.soap");
assertTrue(response.indexOf("Fault") > -1);
}
@@ -190,27 +200,27 @@
public void testMultiSetResourceProps_SCENARIO_B3() throws IOException
{
//there are 2 calls in the spec
- String response = sendRequest(m_printerURL, "Set_MultiInsertJobHold.soap");
+ String response = sendPrinterRequest("Set_MultiInsertJobHold.soap");
assertTrue(response.indexOf("SetResourcePropertiesResponse") > -1);
//insert Overnight
- response = sendRequest(m_printerURL, "Set_InsertJobHoldOvernight.soap");
+ response = sendPrinterRequest("Set_InsertJobHoldOvernight.soap");
assertTrue(response.indexOf("SetResourcePropertiesResponse") > -1);
- response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+ response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("Overnight") > -1);
}
public void testFailMultiSetResourceProps_SCENARIO_B3_VARIANT() throws IOException
{
- String response = sendRequest(m_printerURL, "Set_Should_Fail.soap");
+ String response = sendPrinterRequest("Set_Should_Fail.soap");
assertTrue(response.indexOf("fault") > -1);
}
public void testResetToInitialState_SCENARIO_B3_RESET() throws IOException
{
- String response = sendRequest(m_printerURL, "Set_MultiDelete.soap");
+ String response = sendPrinterRequest("Set_MultiDelete.soap");
assertTrue(response.indexOf("SetResourcePropertiesResponse") > -1);
- response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+ response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("job_hold_until_default") == -1);
assertTrue(response.indexOf("_hold_until_supported") == -1);
}
@@ -220,12 +230,11 @@
String response = printJob();
assertTrue(response.indexOf("CreationResponse") > -1);
assertTrue(response.indexOf("successful-ok") > -1);
-
}
public void testValidatePrinterJobProperties() throws IOException
{
- String response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
+ String response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
assertTrue(response.indexOf("job_properties") > -1);
assertTrue(response.indexOf("job_reference") > -1);
assertTrue(response.indexOf("pending") > -1);
@@ -234,16 +243,14 @@
public void testDestroy_SCENARIO_D() throws IOException
{
String jobResponse = printJob();
- String resourceID = null;
EnvelopeDocument envelope = loadResponseEnvelope(jobResponse);
+ XmlBeanUtils.getChildElements(getCreationResponse(envelope));
- setJobURL(getCreationResponse(envelope));
- resourceID = getResourceID(envelope);
+ setJobURL(envelope);
EnvelopeDocument destroyEnvelopeDocument = loadDocument("Destroy_Job.soap");
- setResourceID(destroyEnvelopeDocument, resourceID);
-
+ addReferencePropsToEnvelope(destroyEnvelopeDocument, getJobEndpointReference(envelope).getReferenceProperties() );
- System.out.println("Destroying JOB: " + resourceID);
+ System.out.println("Destroying JOB: ");
String response = sendRequest(m_jobURL, destroyEnvelopeDocument.newInputStream());
assertTrue(response.indexOf("DestroyResponse") > -1);
@@ -252,36 +259,27 @@
assertTrue(response.indexOf("fault") > -1);
}
- private CreationResponseDocument.CreationResponse getCreationResponse(EnvelopeDocument envelope)
- {
- return (CreationResponseDocument.CreationResponse) XmlBeanUtils.getChildElements(envelope.getEnvelope().getBody(), new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "CreationResponse"))[0];
- }
public void testCreateJob_SCENARIO_E() throws IOException
{
String response = createJob();
- String resourceID = getResourceID(loadResponseEnvelope(response));
assertTrue(response.indexOf("CreationResponse") > -1);
assertTrue(response.indexOf("successful-ok") > -1);
- response = sendRequest(m_printerURL, "GetPrinterPropertiesDoc.soap");
- //job id should be gotten for reponse
- assertTrue(response.indexOf(resourceID) > -1);
+ response = sendPrinterRequest("GetPrinterPropertiesDoc.soap");
}
-
public void testSetTerminationTime_SCENARIO_E_CONTINUED() throws IOException
{
String response = createJob();
- EnvelopeDocument envelope = loadResponseEnvelope(response);
- setJobURL(getCreationResponse(envelope));
- String resourceID = getResourceID(envelope);
+ EnvelopeDocument responseEnvelope = loadResponseEnvelope(response);
+ setJobURL(responseEnvelope);
EnvelopeDocument envelopeDoc = null;
envelopeDoc = loadDocument("SetTerminationTime.soap");
- setResourceID(envelopeDoc, resourceID);
+ addReferencePropsToEnvelope(envelopeDoc, getJobEndpointReference(responseEnvelope).getReferenceProperties() );
Calendar instance = Calendar.getInstance();
instance.set(Calendar.MINUTE, instance.get(Calendar.MINUTE) + 5);
@@ -290,7 +288,7 @@
SetTerminationTimeDocument.SetTerminationTime childElement = (SetTerminationTimeDocument.SetTerminationTime) childElements[0];
childElement.setRequestedTerminationTime(instance);
- System.out.println("Setting termination time on JOB: " + resourceID);
+ System.out.println("Setting termination time on JOB: ");
response = sendRequest(m_jobURL, envelopeDoc.newInputStream());
assertTrue(response.indexOf("SetTerminationTimeResponse") > -1);
@@ -299,25 +297,72 @@
public void testSendDocument_SCENARIO_E_CONTINUED() throws IOException
{
String response = createJob();
- EnvelopeDocument envelope = loadResponseEnvelope(response);
- setJobURL(getCreationResponse(envelope));
- String resourceID = getResourceID(envelope);
+ EnvelopeDocument responseEnvelope = loadResponseEnvelope(response);
+ setJobURL(responseEnvelope);
+
EnvelopeDocument envelopeDocument = loadDocument("SendDocument.soap");
- setResourceID(envelopeDocument,resourceID);
+ addReferencePropsToEnvelope(envelopeDocument, getJobEndpointReference(responseEnvelope).getReferenceProperties() );
response = sendRequest(m_jobURL, envelopeDocument.newInputStream());
assertTrue(response.indexOf("CreationResponse") > -1);
assertTrue(response.indexOf("successful-ok") > -1);
}
- private void setJobURL(CreationResponseDocument.CreationResponse creationResponse)
+
+
+ //***** end tests ********
+
+ private String sendPrinterRequest(String fileName) throws IOException
+ {
+ EnvelopeDocument envelopeDocument = loadDocument(fileName);
+ addReferencePropsToEnvelope(envelopeDocument, m_printerReferenceProperties);
+ return sendRequest(m_printerURL, envelopeDocument.newInputStream());
+ }
+
+
+ private CreationResponseDocument.CreationResponse getCreationResponse(EnvelopeDocument envelope)
+ {
+ return (CreationResponseDocument.CreationResponse) XmlBeanUtils.getChildElements(envelope.getEnvelope().getBody(), new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "CreationResponse"))[0];
+ }
+
+ private void setJobURL(EnvelopeDocument envelope)
{
- EndpointReferenceType jobRef = (EndpointReferenceType) XmlBeanUtils.getChildElements(creationResponse, JobPortPropertyQNames.JOB_REFERENCE)[0];
+ EndpointReferenceType jobRef = getJobEndpointReference(envelope);
setJobURL(jobRef.getAddress().getStringValue());
}
- //***** end tests ********
+ private EndpointReferenceType getJobEndpointReference(EnvelopeDocument envelope)
+ {
+ EndpointReferenceType jobRef = (EndpointReferenceType) XmlBeanUtils.getChildElements(getCreationResponse(envelope), JobPortPropertyQNames.JOB_REFERENCE)[0];
+ return jobRef;
+ }
+
+ private void addReferencePropsToEnvelope(EnvelopeDocument envelopeDocument, ReferencePropertiesType referenceProperties)
+ {
+ Header header = envelopeDocument.getEnvelope().getHeader();
+ if(referenceProperties != null)
+ {
+ XmlObject[] childElements = XmlBeanUtils.getChildElements(referenceProperties);
+ for (int i = 0; i < childElements.length; i++)
+ {
+ XmlObject childElement = childElements[i];
+ XmlBeanUtils.addChildElement(header, childElement);
+ }
+ }
+ }
- private EnvelopeDocument loadResponseEnvelope(String response)
+ private void setPrinterReferenceProps(CreatePrinterResponseDocument.CreatePrinterResponse createPrinter)
+ {
+ m_printerReferenceProperties = createPrinter.getPrinterReference().getReferenceProperties();
+ }
+
+ private void setPrinterURL(CreatePrinterResponseDocument.CreatePrinterResponse create)
+ {
+ EndpointReferenceType printerRef = (EndpointReferenceType) XmlBeanUtils.getChildElements(create, PrinterPortPropertyQNames.PRINTER_REFERENCE)[0];
+ m_printerURL = printerRef.getAddress().getStringValue();
+ }
+
+
+ private EnvelopeDocument loadResponseEnvelope(String response)
{
EnvelopeDocument envelope = null;
try
@@ -331,41 +376,26 @@
}
return envelope;
}
- protected String createJob() throws IOException
+
+ protected String createJob() throws IOException
{
- return sendRequest(m_printerURL, "Create_Job.soap");
+ return sendPrinterRequest("Create_Job.soap");
}
+
protected String printJob() throws IOException
{
- return sendRequest(m_printerURL, "PrintJobRequest.soap");
+ return sendPrinterRequest("PrintJobRequest.soap");
}
- private String getResourceID(EnvelopeDocument envelope)
- {
- String resourceKeyId;
- resourceKeyId = XmlBeanUtils.getValue(getResourceIDFromJobReference(envelope));
- return resourceKeyId;
- }
- private XmlObject getResourceIDFromJobReference(EnvelopeDocument envelope)
- {
- XmlObject[] childElements = XmlBeanUtils.getChildElements(envelope.getEnvelope().getBody(), new QName(JobPortPropertyQNames.JOB_REFERENCE.getNamespaceURI(),"CreationResponse"));
- childElements = XmlBeanUtils.getChildElements(childElements[0], JobPortPropertyQNames.JOB_REFERENCE);
- childElements = XmlBeanUtils.getChildElements(childElements[0], new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "ReferenceProperties"));
- return XmlBeanUtils.getChildElements(childElements[0], new QName(JobPortService.TARGET_NSURI, "ResourceID"))[0];
- }
-
- private XmlObject getResourceIDFromHeader(EnvelopeDocument envelope)
- {
- XmlObject[] childElements = XmlBeanUtils.getChildElements(envelope.getEnvelope().getHeader(), new QName(JobPortService.TARGET_NSURI,"ResourceID"));
- return childElements[0];
- }
- private void setResourceID(EnvelopeDocument envelope, String resourceKeyId)
- {
- XmlObject resourceIDXmlObject = getResourceIDFromHeader(envelope);
- XmlBeanUtils.setValue(resourceIDXmlObject, resourceKeyId);
- }
+ private XmlObject getResourceIDFromJobReference(EnvelopeDocument envelope)
+ {
+ XmlObject[] childElements = XmlBeanUtils.getChildElements(envelope.getEnvelope().getBody(), new QName(JobPortPropertyQNames.JOB_REFERENCE.getNamespaceURI(), "CreationResponse"));
+ childElements = XmlBeanUtils.getChildElements(childElements[0], JobPortPropertyQNames.JOB_REFERENCE);
+ childElements = XmlBeanUtils.getChildElements(childElements[0], new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "ReferenceProperties"));
+ return XmlBeanUtils.getChildElements(childElements[0], new QName(JobPortService.TARGET_NSURI, "ResourceID"))[0];
+ }
- private EnvelopeDocument loadDocument(String requestFile)
+ private EnvelopeDocument loadDocument(String requestFile)
throws IOException
{
EnvelopeDocument envelopeDoc = null;
@@ -379,6 +409,7 @@
}
return envelopeDoc;
}
+
public void setRunAxisServer(boolean RUN_AXIS_SERVER)
{
this.RUN_AXIS_SERVER = RUN_AXIS_SERVER;
Added: incubator/apollo/trunk/src/site/content/example/test-build.properties
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/test-build.properties?view=auto&rev=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/test-build.properties (added)
+++ incubator/apollo/trunk/src/site/content/example/test-build.properties Thu Mar 3 13:15:09 2005
@@ -0,0 +1,16 @@
+##
+# The endpoint url of the Printer Factory. This is the starting point for the tests.
+#
+# ***NOTE: To test an external endpoint this should be set to that server's url.
+# **If running in embedded mode then the printerFactoryURL is ignored
+#
+##
+printerFactoryURL=http://wsi.alphaworks.ibm.com:80/ettk/wsrfrpio/services/PrinterPort
+
+##
+# Determines if the unit test will run an embedded version of Axis
+# to load the server and handle requests
+#
+# ***NOTE: To test an external endpoint this should be set to false
+##
+runAxis=false
\ No newline at end of file
Added: incubator/apollo/trunk/src/site/content/example/test.xml
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/test.xml?view=auto&rev=156086
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/test.xml (added)
+++ incubator/apollo/trunk/src/site/content/example/test.xml Thu Mar 3 13:15:09 2005
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+
+<project name="interop_testfile" default="usage" basedir=".">
+
+ <property environment="env" />
+ <property file="build.properties" />
+ <property file="test-build.properties" />
+
+ <property name="jar.dir" location="${basedir}\lib" />
+ <property name="test.classes.dir" location="${basedir}\test-classes" />
+ <property name="test.dir" location="${basedir}\src\test" />
+
+
+
+ <target name="init" unless="apollo.classpath">
+
+ <fail message="Please set the location of the wsrf.webapp.dir in build.properties" unless="wsrf.webapp.dir" />
+ <echo>Using webapp dir: ${wsrf.webapp.dir}</echo>
+
+ <path id="apollo.classpath.id">
+ <pathelement location="${basedir}/classes" />
+ <pathelement location="${wsrf.webapp.dir}/WEB-INF/classes" />
+ <fileset dir="${wsrf.webapp.dir}/WEB-INF/lib" includes="*.jar" />
+ <fileset dir="${jar.dir}" />
+ <pathelement location="${activation.jar}" />
+ <pathelement location="${mail.jar}" />
+ </path>
+ <property name="apollo.classpath" refid="apollo.classpath.id" />
+
+ </target>
+
+
+ <target name="test-all" depends="compile-tests" description="Runs a complete WSRF Interop set of Scenarios">
+ <junit fork="no" printsummary="yes" haltonfailure="no">
+ <sysproperty key="basedir" value="${basedir}"/>
+ <sysproperty key="printerFactoryURL" value="${printerFactoryURL}"/>
+ <sysproperty key="runAxis" value="${runAxis}"/>
+ <classpath>
+ <pathelement location="${test.classes.dir}"/>
+ <pathelement path="${apollo.classpath}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <test name="org.oasisOpen.docs.wsrf.AllScenarios">
+ <formatter type="xml"/>
+ </test>
+ </junit>
+ </target>
+
+ <target name="compile-tests" depends="init" unless="tests.compiled">
+ <mkdir dir="${test.classes.dir}" />
+ <javac srcdir="${test.dir}"
+ destdir="${test.classes.dir}"
+ classpathref="apollo.classpath.id"
+ debug="on"
+ />
+ <copy todir="${test.classes.dir}">
+ <fileset dir="${test.dir}" excludes="**/*.java,**/package.html" />
+ </copy>
+ <property name="tests.compiled" value="true" />
+ </target>
+
+ <target name="usage">
+ <java classname="org.apache.tools.ant.Main">
+ <arg value="-buildfile" />
+ <arg value="${ant.file}" />
+ <arg value="-projecthelp" />
+ </java>
+ </target>
+
+</project>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org