diff --git a/README b/README index c43b0a0..875e6e6 100644 --- a/README +++ b/README @@ -53,6 +53,28 @@ How to setup the system - installcert.ps1 install - select the new certificate just created above. It's the one named "CN=". Normally it should be the last one. + + + On java client (Linux) machine, set up SSL trust between Java client and Headnode/BrokerNode. + + - Create the environment variable JAVA_HOME and set it to the Java installation path. Compile the GetCert.java under ~/tools/ + + - "$JAVA_HOME/bin/javac" GetCert.java + + a) Create head node and broker node certificates. + - "$JAVA_HOME/bin/java" GetCert + - The above should create a file called "cacerts_new" + - If broker node is a different node, call "$JAVA_HOME/bin/java" GetCert + - The above should update the file "cacerts_new" with the certificate for broker node + - copy ecacerts to overwrite $JAVA_HOME/jre/lib/security/cacerts (NOTE: You need administrate privilege on Vista/7) + + Please note the above step on linux client is only required when the preference file ~/.java/.userPrefs/com/microsoft/hpc/scheduler/session/prefs.xml exists and contains the following entry: + + + + + If the preference file does not exist or the value is "false" for the key "RequireSSLValidation", the certificates are not required. + How to use ========== diff --git a/sample/CcpEchoSvc/JavaEchoSvc.config b/sample/CcpEchoSvc/JavaEchoSvc.config index 5a368e2..dc227a1 100644 --- a/sample/CcpEchoSvc/JavaEchoSvc.config +++ b/sample/CcpEchoSvc/JavaEchoSvc.config @@ -1,175 +1,186 @@ - - - - - - - -
- -
- - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java index 9b4b83a..c24d94d 100644 --- a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java +++ b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java @@ -1,144 +1,173 @@ -/** - * Please modify this class to meet your needs - * This class is not complete - */ - -package org.tempuri; - -import java.io.*; -import java.net.InetAddress; -import org.datacontract.schemas._2004._07.echosvclib.StatisticInfo; - -import com.microsoft.hpc.scheduler.session.DataClient; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; - -import java.util.GregorianCalendar; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * This class was generated by Apache CXF 2.3.3 2011-03-11T14:28:00.191+08:00 - * Generated source version: 2.3.3 - * - */ - -@javax.jws.WebService( - serviceName = "EchoSvc", - portName = "DefaultBinding_IEchoSvc", - targetNamespace = "http://tempuri.org/", - wsdlLocation = "file:tempuri.org.wsdl", - endpointInterface = "org.tempuri.IEchoSvc") -public class IEchoSvcImpl implements IEchoSvc -{ - private static final int BufferSize = 64000; - private static final Logger LOG = Logger.getLogger(IEchoSvcImpl.class.getName()); - - /* - * (non-Javadoc) - * - * @see org.tempuri.IEchoSvc#echoData(java.lang.String dataClientId )* - */ - public java.lang.Integer echoData(java.lang.String dataClientId) - { - ServiceContext.Logger.traceEvent(Level.INFO, "Executing operation echoData"); - ServiceContext.Logger.traceEvent(Level.ALL, dataClientId); - try - { - DataClient client = ServiceContext.getDataClient(dataClientId); - byte[] data = client.readRawBytesAll(); - return data.length; - } catch (java.lang.Exception ex) - { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - } - - /* - * (non-Javadoc) - * - * @see org.tempuri.IEchoSvc#generateLoad(java.lang.Double runMilliSeconds - * ,)byte[] dummyData ,)java.lang.String fileData )* - */ - public StatisticInfo generateLoad(java.lang.Double runMilliSeconds, byte[] dummyData, - java.lang.String fileData) - { - ServiceContext.Logger.traceEvent(Level.INFO, "Executing operation generateLoad"); - ServiceContext.Logger.traceEvent(Level.ALL, runMilliSeconds.toString()); - try - { - StatisticInfo info = new StatisticInfo(); - - // Set start time to now. - info.setStartTime(Utility.getXMLCurrentTime()); - - if (!Utility.isNullOrEmpty(fileData)) - { - byte[] buffer = new byte[BufferSize]; - int readed; - InputStream file; - try - { - file = new FileInputStream(new File(fileData)); - } - catch (FileNotFoundException e) - { - throw new Exception("File not found", e); - } - - do - { - readed = file.read(buffer, 0, BufferSize); - } while (readed != BufferSize); - - file.close(); - } - - GregorianCalendar target = new GregorianCalendar(); - target.add(GregorianCalendar.MILLISECOND, runMilliSeconds.intValue()); - String dummy = System.getenv("CCP_TASKINSTANCEID"); - if (!Utility.isNullOrEmpty(dummy)) { - try { - info.setTaskId(Integer.parseInt(dummy)); - } catch (NumberFormatException e) { - // taskid to default (0) - info.setTaskId(0); - } - } - - while (GregorianCalendar.getInstance().before(target)) - { - // busy wait - } - - info.setEndTime(Utility.getXMLCurrentTime()); - - return info; - } catch (java.lang.Exception ex) - { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - } - - /* - * (non-Javadoc) - * - * @see org.tempuri.IEchoSvc#echo(java.lang.String input )* - */ - public java.lang.String echo(java.lang.String input) - { - ServiceContext.Logger.traceEvent(Level.INFO, "Executing operation echo"); - ServiceContext.Logger.traceEvent(Level.ALL, input); - try - { - String computername = InetAddress.getLocalHost().getHostName(); - return computername + ":" + input; - } catch (java.lang.Exception ex) - { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - } - -} +/** + * Please modify this class to meet your needs + * This class is not complete + */ + +package org.tempuri; + +import java.io.*; +import java.net.InetAddress; + +import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.jaxws.context.WrappedMessageContext; +import org.apache.cxf.message.Message; +import org.datacontract.schemas._2004._07.echosvclib.StatisticInfo; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.servicecontext.etw.*; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.Resource; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPHeader; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +/** + * This class was generated by Apache CXF 2.3.3 2011-03-11T14:28:00.191+08:00 + * Generated source version: 2.3.3 + * + */ + +@javax.jws.WebService(serviceName = "EchoSvc", portName = "DefaultBinding_IEchoSvc", targetNamespace = "http://tempuri.org/", wsdlLocation = "file:tempuri.org.wsdl", endpointInterface = "org.tempuri.IEchoSvc") +public class IEchoSvcImpl implements IEchoSvc { + @Resource + WebServiceContext wsContext; + + private static final int BufferSize = 64000; + private static final Logger LOG = Logger.getLogger(IEchoSvcImpl.class + .getName()); + + /* + * (non-Javadoc) + * + * @see org.tempuri.IEchoSvc#echoData(java.lang.String dataClientId )* + */ + public java.lang.Integer echoData(java.lang.String dataClientId) { + ServiceContext.Logger.traceEvent(Level.INFO, + "Executing operation echoData"); + ServiceContext.Logger.traceEvent(Level.ALL, dataClientId); + try { + DataClient client = ServiceContext.getDataClient(dataClientId); + byte[] data = client.readRawBytesAll(); + return data.length; + } catch (java.lang.Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.IEchoSvc#generateLoad(java.lang.Double runMilliSeconds + * ,)byte[] dummyData ,)java.lang.String fileData )* + */ + public StatisticInfo generateLoad(java.lang.Double runMilliSeconds, + byte[] dummyData, java.lang.String fileData) { + ServiceContext.Logger.traceEvent(Level.INFO, + "Executing operation generateLoad"); + ServiceContext.Logger.traceEvent(Level.ALL, runMilliSeconds.toString()); + try { + StatisticInfo info = new StatisticInfo(); + + // Set start time to now. + info.setStartTime(Utility.getXMLCurrentTime()); + + if (!Utility.isNullOrEmpty(fileData)) { + byte[] buffer = new byte[BufferSize]; + int readed; + InputStream file; + try { + file = new FileInputStream(new File(fileData)); + } catch (FileNotFoundException e) { + throw new Exception("File not found", e); + } + + do { + readed = file.read(buffer, 0, BufferSize); + } while (readed != BufferSize); + + file.close(); + } + + GregorianCalendar target = new GregorianCalendar(); + target.add(GregorianCalendar.MILLISECOND, + runMilliSeconds.intValue()); + String dummy = System.getenv("CCP_TASKINSTANCEID"); + if (!Utility.isNullOrEmpty(dummy)) { + try { + info.setTaskId(Integer.parseInt(dummy)); + } catch (NumberFormatException e) { + // taskid to default (0) + info.setTaskId(0); + } + } + + while (GregorianCalendar.getInstance().before(target)) { + // busy wait + } + + info.setEndTime(Utility.getXMLCurrentTime()); + + return info; + } catch (java.lang.Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.IEchoSvc#echo(java.lang.String input )* + */ + public java.lang.String echo(java.lang.String input) { + ServiceContext.Logger + .traceEvent(Level.INFO, "Executing operation echo"); + ServiceContext.Logger.traceEvent(Level.ALL, input); + ServiceContext.Logger.traceEvent(Level.INFO, "Start to use ETW tracing..."); + ETWTraceEvent etw =new ETWTraceEvent(wsContext); + etw.TraceInformation(input); + + String userData = getUserData(); + ServiceContext.Logger.traceEvent(Level.INFO, "UserData : " + userData); + try { + String computername = InetAddress.getLocalHost().getHostName(); + return computername + ":" + input; + } catch (java.lang.Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + private String getUserData() { + MessageContext mc = this.wsContext.getMessageContext(); + Message message = ((WrappedMessageContext) mc).getWrappedMessage(); + String userData = ""; + List
headers = CastUtils.cast((List) message + .get(Header.HEADER_LIST)); + + for (Header h : headers) { + QName name = h.getName(); + if (name.getLocalPart() == com.microsoft.hpc.scheduler.session.Constant.UserDataHeaderName && + name.getNamespaceURI() == com.microsoft.hpc.scheduler.session.Constant.HpcHeaderNS) + { + Element root = (Element) h.getObject(); + userData = root.getTextContent(); + break; + } + } + return userData; + } + +} diff --git a/sample/helloworld/CcpEchoSvc.jar b/sample/helloworld/CcpEchoSvc.jar index 1a99c90..cdc5233 100644 Binary files a/sample/helloworld/CcpEchoSvc.jar and b/sample/helloworld/CcpEchoSvc.jar differ diff --git a/sample/helloworld/HelloWorld.java b/sample/helloworld/HelloWorld.java index 0de371c..ad98335 100644 --- a/sample/helloworld/HelloWorld.java +++ b/sample/helloworld/HelloWorld.java @@ -1,200 +1,320 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Simple SOA test using Java. -// -//------------------------------------------------------------------------------ - -import org.tempuri.*; -import javax.xml.soap.SOAPException; -import javax.xml.ws.soap.SOAPFaultException; - -import com.microsoft.hpc.scheduler.session.*; - -public class HelloWorld -{ - public static String username = ""; // valid username to submit SOA job - public static String password = ""; // valid user password - private static String headnode = ""; // HPC cluster headnode hostname - private static String serviceName = "JavaEchoSvc"; - private static int nrequests = 12; - - public static void main(String[] args) - { - int nerrs = 0; - nerrs += ParseCmdLine(args); - if (nerrs == 0) { - try { - nerrs += RunBasicTest(); - nerrs += RunResponseHandlerTest(); - } - catch(Exception e) { - nerrs++; - e.printStackTrace(); - } - } - System.out.println("TotalErrors: " + nerrs); - } - - private static void Usage() - { - System.out.println("Usage: HelloWorld /scheduler scheduler /username user /password pwd /nrequests N"); - } - - - private static int ParseCmdLine(String [] args) - { - int nerrs = 0; - int i = 0; - String arg; - while (i < args.length && args[i].startsWith("/")) { - arg = args[i++]; - if (arg.equals("/scheduler")) { - headnode = args[i++]; - } - else if (arg.equals("/username")) { - username = args[i++]; - } - else if (arg.equals("/password")) { - password = args[i++]; - } - else if (arg.equals("/nrequests")) { - nrequests = Integer.parseInt(args[i++]); - } - else { - Usage(); - nerrs++; - break; - } - } - - return nerrs; - } - - - private static int RunBasicTest() - { - int nerrs = 0; - SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); - System.out.printf("Creating a session for %s...\n", serviceName); - - try - { - DurableSession session = DurableSession.createSession(info); - System.out.printf("new session id = %d\n", session.getId()); - - BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); - System.out.printf("Sending %d requests...\n", nrequests); - for(int i = 0; i < nrequests; i++) - { - ObjectFactory of = new ObjectFactory(); - Echo request = of.createEcho(); - request.setInput(of.createEchoInput("hello world!")); - client.sendRequest(request, i); - } - System.out.println("call endRequests() ..."); - client.endRequests(); - - System.out.println("Retrieving responses..."); - - for(BrokerResponse response : client.getResponses(EchoResponse.class)) - { - try - { - String reply = response.getResult().getEchoResult().getValue(); - System.out.printf("\tReceived response for request %s: %s%n", response.getUserData(), reply); - } - catch(Exception ex) - { - nerrs++; - System.out.printf("Error: process %s-th reuqest: %s%n", response.getUserData(), ex.toString()); - } - } - System.out.printf("Done retrieving %d responses%n", nrequests); - client.close(); - session.close(); - } - catch (Throwable e) - { - nerrs++; - e.printStackTrace(); - } - - return nerrs; - } - - private static int RunResponseHandlerTest() - { - int nerrs = 0; - SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); - System.out.printf("Creating a session for %s...\n", serviceName); - - try - { - final DurableSession session = DurableSession.createSession(info); - System.out.printf("new session id = %d\n", session.getId()); - - BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); - - client.setResponseHandler(EchoResponse.class, - new ResponseListener() { - int fetchedCount = 0; - - @Override - public void endOfMessage() { - synchronized(session) { - session.notify(); - } - } - - @Override - public void raiseError(Exception e) { - e.printStackTrace(); - } - - @Override - public void responseReturned(BrokerResponse response) { - try { - String reply = response.getResult().getEchoResult().getValue(); - System.out.printf("\tReceived response for request %s: %s%n", response.getUserData(), reply); - } catch(SOAPFaultException e) { - e.printStackTrace(); - } catch(SOAPException e) { - e.printStackTrace(); - } - - } - - }); - - System.out.printf("Sending %d requests...\n", nrequests); - for(int i = 0; i < nrequests; i++) - { - ObjectFactory of = new ObjectFactory(); - Echo request = of.createEcho(); - request.setInput(of.createEchoInput("hello world!")); - client.sendRequest(request, i); - } - System.out.println("call endRequests() ..."); - client.endRequests(); - - System.out.println("Retrieving responses..."); - - System.out.printf("Done retrieving %d responses%n", nrequests); - synchronized(session) { - session.wait(); - } - session.close(true); - } - catch (Throwable e) - { - nerrs++; - e.printStackTrace(); - } - - return nerrs; - } - -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Simple SOA test using Java. +// +//------------------------------------------------------------------------------ + +import java.util.Random; +import java.util.UUID; + +import org.tempuri.*; +import javax.xml.soap.SOAPException; +import javax.xml.ws.soap.SOAPFaultException; +import com.microsoft.hpc.scheduler.session.*; + +public class HelloWorld +{ + public static String username = ""; // valid username to submit SOA job + public static String password = ""; // valid user password + private static String headnode = ""; // HPC cluster headnode hostname + private static String serviceName = "JavaEchoSvc"; + private static int nrequests = 12; + + public static void main(String[] args) + { + int nerrs = 0; + nerrs += ParseCmdLine(args); + if (nerrs == 0) { + try { + nerrs += RunBasicTest(); + nerrs += RunCommonDataTest(); + nerrs += RunResponseHandlerTest(); + nerrs += RunSoaTracingTest(); + } + catch(Exception e) { + nerrs++; + e.printStackTrace(); + } + } + System.out.println("TotalErrors: " + nerrs); + } + + private static void Usage() + { + System.out.println("Usage: HelloWorld /scheduler scheduler /username user /password pwd /nrequests N"); + } + + private static int ParseCmdLine(String [] args) + { + int nerrs = 0; + int i = 0; + String arg; + while (i < args.length && args[i].startsWith("/")) { + arg = args[i++]; + if (arg.equals("/scheduler")) { + headnode = args[i++]; + } + else if (arg.equals("/username")) { + username = args[i++]; + } + else if (arg.equals("/password")) { + password = args[i++]; + } + else if (arg.equals("/nrequests")) { + nrequests = Integer.parseInt(args[i++]); + } + else { + Usage(); + nerrs++; + break; + } + } + + return nerrs; + } + + private static int RunBasicTest() + { + int nerrs = 0; + SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); + System.out.printf("Creating a session for %s...\n", serviceName); + + try + { + DurableSession session = DurableSession.createSession(info); + System.out.printf("new session id = %d\n", session.getId()); + + BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); + System.out.printf("Sending %d requests...\n", nrequests); + for(int i = 0; i < nrequests; i++) + { + ObjectFactory of = new ObjectFactory(); + Echo request = of.createEcho(); + request.setInput(of.createEchoInput("hello world!")); + client.sendRequest(request, i); + } + System.out.println("call endRequests() ..."); + client.endRequests(); + + System.out.println("Retrieving responses..."); + + for(BrokerResponse response : client.getResponses(EchoResponse.class)) + { + try + { + String reply = response.getResult().getEchoResult().getValue(); + System.out.printf("\tReceived response for request %s: %s%n", response.getUserData(), reply); + } + catch(Exception ex) + { + nerrs++; + System.out.printf("Error: process %s-th reuqest: %s%n", response.getUserData(), ex.toString()); + } + } + System.out.printf("Done retrieving %d responses%n", nrequests); + client.close(); + session.close(); + } + catch (Throwable e) + { + nerrs++; + e.printStackTrace(); + } + return nerrs; + } + + private static int RunCommonDataTest() + { + int nerrs = 0; + SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); + System.out.printf("Creating a session for %s...\n", serviceName); + + try + { + DurableSession session = DurableSession.createSession(info); + System.out.printf("new session id = %d\n", session.getId()); + + // Prepare 1k binary data + byte[] data = new byte[1024]; + Random r = new Random(); + r.nextBytes(data); + + // Create common data client + String dataClientId = java.util.UUID.randomUUID().toString(); + DataClient dataClient = DataClient.create(dataClientId, headnode, username, password); + System.out.printf("new common data client id = %s\n", dataClientId); + // Write data to Windows HPC Cluster + dataClient.writeRawBytesAll(data, true); + + BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); + System.out.printf("Sending %d requests...\n", nrequests); + for(int i = 0; i < nrequests; i++) + { + ObjectFactory of = new ObjectFactory(); + EchoData request = of.createEchoData(); + request.setDataClientId(of.createEchoDataDataClientId(dataClientId)); + client.sendRequest(request, i); + } + System.out.println("call endRequests() ..."); + client.endRequests(); + + System.out.println("Retrieving responses..."); + + for(BrokerResponse response : client.getResponses(EchoDataResponse.class)) + { + try + { + int reply = response.getResult().getEchoDataResult(); + System.out.printf("\tReceived response for request %s: %d%n", response.getUserData(), reply); + } + catch(Exception ex) + { + nerrs++; + System.out.printf("Error: process %s-th reuqest: %s%n", response.getUserData(), ex.toString()); + } + } + System.out.printf("Done retrieving %d responses%n", nrequests); + client.close(); + session.close(); + } + catch (Throwable e) + { + nerrs++; + e.printStackTrace(); + } + return nerrs; + } + + + + private static int RunResponseHandlerTest() + { + int nerrs = 0; + SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); + System.out.printf("Creating a session for %s...\n", serviceName); + + try + { + final DurableSession session = DurableSession.createSession(info); + System.out.printf("new session id = %d\n", session.getId()); + + BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); + + client.setResponseHandler(EchoResponse.class, + new ResponseListener() { + int fetchedCount = 0; + + @Override + public void endOfMessage() { + synchronized(session) { + session.notify(); + } + } + + @Override + public void raiseError(Exception e) { + e.printStackTrace(); + } + + @Override + public void responseReturned(BrokerResponse response) { + try { + String reply = response.getResult().getEchoResult().getValue(); + System.out.printf("\tReceived response for request %s: %s%n", response.getUserData(), reply); + } catch(SOAPFaultException e) { + e.printStackTrace(); + } catch(SOAPException e) { + e.printStackTrace(); + } + + } + + }); + + System.out.printf("Sending %d requests...\n", nrequests); + for(int i = 0; i < nrequests; i++) + { + ObjectFactory of = new ObjectFactory(); + Echo request = of.createEcho(); + request.setInput(of.createEchoInput("hello world!")); + client.sendRequest(request, i); + + + } + System.out.println("call endRequests() ..."); + client.endRequests(); + + System.out.println("Retrieving responses..."); + + System.out.printf("Done retrieving %d responses%n", nrequests); + synchronized(session) { + session.wait(); + } + session.close(true); + } + catch (Throwable e) + { + nerrs++; + e.printStackTrace(); + } + + return nerrs; + } + + private static int RunSoaTracingTest() + { + int nerrs = 0; + SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); + // Set transport scheme to Custom to enable SOA tracing + info.setTransportScheme("Custom"); + System.out.printf("Creating a session for %s...\n", serviceName); + + try + { + DurableSession session = DurableSession.createSession(info); + System.out.printf("new session id = %d\n", session.getId()); + + BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); + System.out.printf("Sending %d requests...\n", nrequests); + for(int i = 0; i < nrequests; i++) + { + ObjectFactory of = new ObjectFactory(); + Echo request = of.createEcho(); + request.setInput(of.createEchoInput("hello world!")); + // Specify message id in each request for message correlation + client.sendRequest(request, i, UUID.randomUUID()); + } + System.out.println("call endRequests() ..."); + client.endRequests(); + + System.out.println("Retrieving responses..."); + + for(BrokerResponse response : client.getResponses(EchoResponse.class)) + { + try + { + String reply = response.getResult().getEchoResult().getValue(); + System.out.printf("\tReceived response for request %s: %s%n", response.getUserData(), reply); + } + catch(Exception ex) + { + nerrs++; + System.out.printf("Error: process %s-th reuqest: %s%n", response.getUserData(), ex.toString()); + } + } + System.out.printf("Done retrieving %d responses%n", nrequests); + client.close(); + session.close(); + } + catch (Throwable e) + { + nerrs++; + e.printStackTrace(); + } + return nerrs; + } + +} diff --git a/sample/helloworld/RunTest.cmd b/sample/helloworld/RunTest.cmd index d56aac8..2b1b109 100644 --- a/sample/helloworld/RunTest.cmd +++ b/sample/helloworld/RunTest.cmd @@ -1,22 +1,22 @@ -@echo off -setlocal - -if [%1]==[] ( - echo Usage: to compile, run: RunTest.cmd src - echo Usage: to run test, run: RunTest.cmd run - exit /b 0 -) - -set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23 -set CXF_HOME=C:\java\apache-cxf-2.4.0 -set Keystore_Password=changeit -set CLASSPATH=.;Microsoft-HpcSession-3.0.jar;CcpEchoSvc.jar;%CXF_HOME%\lib\cxf-manifest.jar - -if [%1]==[src] ( - "%JAVA_HOME%\bin\javac" -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" HelloWorld.java -) -if [%1]==[run] ( - "%JAVA_HOME%\bin\java" HelloWorld -Djavax.net.ssl.trustStore="%JAVA_HOME%\jre\lib\security\cacerts" -Djavax.net.ssl.trustStorePassword=%Keystore_Password% -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" -) - - +@echo off +setlocal + +if [%1]==[] ( + echo Usage: to compile, run: RunTest.cmd src + echo Usage: to run test, run: RunTest.cmd run + exit /b 0 +) + +set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23 +set CXF_HOME=C:\java\apache-cxf-2.4.0 +set Keystore_Password=changeit +set CLASSPATH=.;Microsoft-HpcSession-3.0.jar;CcpEchoSvc.jar;%CXF_HOME%\lib\cxf-manifest.jar + +if [%1]==[src] ( + "%JAVA_HOME%\bin\javac" -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" HelloWorld.java +) +if [%1]==[run] ( + "%JAVA_HOME%\bin\java" -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" -Djavax.net.ssl.trustStore="%JAVA_HOME%\jre\lib\security\cacerts" -Djavax.net.ssl.trustStorePassword=%Keystore_Password% HelloWorld +) + + diff --git a/sample/helloworld/RunTest.sh b/sample/helloworld/RunTest.sh index ee9bfac..95d0eb9 100644 --- a/sample/helloworld/RunTest.sh +++ b/sample/helloworld/RunTest.sh @@ -6,17 +6,17 @@ if [ "$#" = 0 ] ; then exit 0 fi -JAVA_HOME=/etc/jdk1.6.0_23 -CXF_HOME=/etc/apache-cxf-2.4.0 -Keystore_Password=changeit -CLASSPATH=.;Microsoft-HpcSession-3.0.jar;CcpEchoSvc.jar;%CXF_HOME%\lib\cxf-manifest.jar +JAVA_HOME=/usr/java/jdk1.6.0_23 +CXF_HOME=/usr/java/apache-cxf-2.4.0 +Keystore_Password=[password] +CLASSPATH=.:Microsoft-HpcSession-3.0.jar:CcpEchoSvc.jar:$CXF_HOME/lib/cxf-manifest.jar PATH=$PATH:$JAVA_HOME/bin:/home if [ "$1" = "src" ] ; then - "$JAVA_HOME/bin/javac" -cp $CLASSPATH -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" HelloWorld.java + "$JAVA_HOME/bin/javac" -cp $CLASSPATH -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" HelloWorld.java fi if [ "$1" = "run" ] ; then - "$JAVA_HOME/bin/java" -cp $CLASSPATH HelloWorld -Djavax.net.ssl.trustStore="$JAVA_HOME/jre/lib/security/cacerts" -Djavax.net.ssl.trustStorePassword=%Keystore_Password% -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" + "$JAVA_HOME/bin/java" -cp $CLASSPATH HelloWorld -Djavax.net.ssl.trustStore="$JAVA_HOME/jre/lib/security/cacerts" -Djavax.net.ssl.trustStorePassword=$Keystore_Password -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" fi diff --git a/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java b/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java index 7abad83..5b8afbc 100644 --- a/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java +++ b/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java @@ -1,233 +1,286 @@ - -package com.microsoft.hpc.brokerlauncher; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlType; -import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; - - -/** - *

Java class for BrokerInitializationResult complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="BrokerInitializationResult">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="BrokerEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
- *         <element name="ClientBrokerHeartbeatInterval" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="ClientBrokerHeartbeatRetryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="ControllerEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
- *         <element name="MaxMessageSize" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="ResponseEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
- *         <element name="ServiceOperationTimeout" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "BrokerInitializationResult", namespace = "http://hpc.microsoft.com/BrokerLauncher", propOrder = { - "brokerEpr", - "clientBrokerHeartbeatInterval", - "clientBrokerHeartbeatRetryCount", - "controllerEpr", - "maxMessageSize", - "responseEpr", - "serviceOperationTimeout" -}) -public class BrokerInitializationResult { - - @XmlElementRef(name = "BrokerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) - protected JAXBElement brokerEpr; - @XmlElement(name = "ClientBrokerHeartbeatInterval") - protected Integer clientBrokerHeartbeatInterval; - @XmlElement(name = "ClientBrokerHeartbeatRetryCount") - protected Integer clientBrokerHeartbeatRetryCount; - @XmlElementRef(name = "ControllerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) - protected JAXBElement controllerEpr; - @XmlElement(name = "MaxMessageSize") - protected Long maxMessageSize; - @XmlElementRef(name = "ResponseEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) - protected JAXBElement responseEpr; - @XmlElement(name = "ServiceOperationTimeout") - protected Integer serviceOperationTimeout; - - /** - * Gets the value of the brokerEpr property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public JAXBElement getBrokerEpr() { - return brokerEpr; - } - - /** - * Sets the value of the brokerEpr property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public void setBrokerEpr(JAXBElement value) { - this.brokerEpr = ((JAXBElement ) value); - } - - /** - * Gets the value of the clientBrokerHeartbeatInterval property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getClientBrokerHeartbeatInterval() { - return clientBrokerHeartbeatInterval; - } - - /** - * Sets the value of the clientBrokerHeartbeatInterval property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setClientBrokerHeartbeatInterval(Integer value) { - this.clientBrokerHeartbeatInterval = value; - } - - /** - * Gets the value of the clientBrokerHeartbeatRetryCount property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getClientBrokerHeartbeatRetryCount() { - return clientBrokerHeartbeatRetryCount; - } - - /** - * Sets the value of the clientBrokerHeartbeatRetryCount property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setClientBrokerHeartbeatRetryCount(Integer value) { - this.clientBrokerHeartbeatRetryCount = value; - } - - /** - * Gets the value of the controllerEpr property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public JAXBElement getControllerEpr() { - return controllerEpr; - } - - /** - * Sets the value of the controllerEpr property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public void setControllerEpr(JAXBElement value) { - this.controllerEpr = ((JAXBElement ) value); - } - - /** - * Gets the value of the maxMessageSize property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getMaxMessageSize() { - return maxMessageSize; - } - - /** - * Sets the value of the maxMessageSize property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setMaxMessageSize(Long value) { - this.maxMessageSize = value; - } - - /** - * Gets the value of the responseEpr property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public JAXBElement getResponseEpr() { - return responseEpr; - } - - /** - * Sets the value of the responseEpr property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} - * - */ - public void setResponseEpr(JAXBElement value) { - this.responseEpr = ((JAXBElement ) value); - } - - /** - * Gets the value of the serviceOperationTimeout property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getServiceOperationTimeout() { - return serviceOperationTimeout; - } - - /** - * Sets the value of the serviceOperationTimeout property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setServiceOperationTimeout(Integer value) { - this.serviceOperationTimeout = value; - } - -} + +package com.microsoft.hpc.brokerlauncher; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; + + +/** + *

Java class for BrokerInitializationResult complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="BrokerInitializationResult">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="BrokerEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
+ *         <element name="BrokerUniqueId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ClientBrokerHeartbeatInterval" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ClientBrokerHeartbeatRetryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ControllerEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
+ *         <element name="MaxMessageSize" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="ResponseEpr" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
+ *         <element name="ServiceOperationTimeout" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="SupportsMessageDetails" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BrokerInitializationResult", namespace = "http://hpc.microsoft.com/BrokerLauncher", propOrder = { + "brokerEpr", + "brokerUniqueId", + "clientBrokerHeartbeatInterval", + "clientBrokerHeartbeatRetryCount", + "controllerEpr", + "maxMessageSize", + "responseEpr", + "serviceOperationTimeout", + "supportsMessageDetails" +}) +public class BrokerInitializationResult { + + @XmlElementRef(name = "BrokerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) + protected JAXBElement brokerEpr; + @XmlElementRef(name = "BrokerUniqueId", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) + protected JAXBElement brokerUniqueId; + @XmlElement(name = "ClientBrokerHeartbeatInterval") + protected Integer clientBrokerHeartbeatInterval; + @XmlElement(name = "ClientBrokerHeartbeatRetryCount") + protected Integer clientBrokerHeartbeatRetryCount; + @XmlElementRef(name = "ControllerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) + protected JAXBElement controllerEpr; + @XmlElement(name = "MaxMessageSize") + protected Long maxMessageSize; + @XmlElementRef(name = "ResponseEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false) + protected JAXBElement responseEpr; + @XmlElement(name = "ServiceOperationTimeout") + protected Integer serviceOperationTimeout; + @XmlElement(name = "SupportsMessageDetails") + protected boolean supportsMessageDetails; + + /** + * Gets the value of the brokerEpr property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getBrokerEpr() { + return brokerEpr; + } + + /** + * Sets the value of the brokerEpr property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setBrokerEpr(JAXBElement value) { + this.brokerEpr = ((JAXBElement ) value); + } + + /** + * Gets the value of the brokerUniqueId property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getBrokerUniqueId() { + return brokerUniqueId; + } + + /** + * Sets the value of the brokerUniqueId property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setBrokerUniqueId(JAXBElement value) { + this.brokerUniqueId = ((JAXBElement ) value); + } + + /** + * Gets the value of the clientBrokerHeartbeatInterval property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getClientBrokerHeartbeatInterval() { + return clientBrokerHeartbeatInterval; + } + + /** + * Sets the value of the clientBrokerHeartbeatInterval property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setClientBrokerHeartbeatInterval(Integer value) { + this.clientBrokerHeartbeatInterval = value; + } + + /** + * Gets the value of the clientBrokerHeartbeatRetryCount property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getClientBrokerHeartbeatRetryCount() { + return clientBrokerHeartbeatRetryCount; + } + + /** + * Sets the value of the clientBrokerHeartbeatRetryCount property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setClientBrokerHeartbeatRetryCount(Integer value) { + this.clientBrokerHeartbeatRetryCount = value; + } + + /** + * Gets the value of the controllerEpr property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getControllerEpr() { + return controllerEpr; + } + + /** + * Sets the value of the controllerEpr property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setControllerEpr(JAXBElement value) { + this.controllerEpr = ((JAXBElement ) value); + } + + /** + * Gets the value of the maxMessageSize property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getMaxMessageSize() { + return maxMessageSize; + } + + /** + * Sets the value of the maxMessageSize property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setMaxMessageSize(Long value) { + this.maxMessageSize = value; + } + + /** + * Gets the value of the responseEpr property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getResponseEpr() { + return responseEpr; + } + + /** + * Sets the value of the responseEpr property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setResponseEpr(JAXBElement value) { + this.responseEpr = ((JAXBElement ) value); + } + + /** + * Gets the value of the serviceOperationTimeout property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getServiceOperationTimeout() { + return serviceOperationTimeout; + } + + /** + * Sets the value of the serviceOperationTimeout property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setServiceOperationTimeout(Integer value) { + this.serviceOperationTimeout = value; + } + + /** + * Gets the value of the supportsMessageDetails property. + * @return + * possible object is + * {@link boolean} + */ + public boolean getSupportsMessageDetails() { + return this.supportsMessageDetails; + } + + /** + * Sets the value of the supportsMessageDetails property. + * + * @param value + * allowed object is + * {@link boolean} + */ + public void setsupportsMessageDetails(boolean value) { + this.supportsMessageDetails = value; + } + +} diff --git a/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java b/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java index fe4294b..7a3201d 100644 --- a/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java +++ b/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java @@ -31,6 +31,7 @@ public class ObjectFactory { private final static QName _AttachResponseAttachResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "AttachResult"); private final static QName _BrokerInitializationResultBrokerEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "BrokerEpr"); private final static QName _BrokerInitializationResultControllerEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "ControllerEpr"); + private final static QName _BrokerInitializationResultBrokerUniqueId_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "BrokerUniqueId"); private final static QName _BrokerInitializationResultResponseEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "ResponseEpr"); private final static QName _CreateDurableResponseCreateDurableResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "CreateDurableResult"); private final static QName _GetActiveBrokerIdListResponseGetActiveBrokerIdListResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "GetActiveBrokerIdListResult"); @@ -192,6 +193,16 @@ public JAXBElement createBrokerInitializationResultControllerEpr( public JAXBElement createBrokerInitializationResultResponseEpr(ArrayOfstring value) { return new JAXBElement(_BrokerInitializationResultResponseEpr_QNAME, ArrayOfstring.class, BrokerInitializationResult.class, value); } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/BrokerLauncher", name = "BrokerUniqueId", scope = BrokerInitializationResult.class) + public JAXBElement createBrokerInitializationResultBrokerUniqueId(String value) { + return new JAXBElement(_BrokerInitializationResultBrokerUniqueId_QNAME, String.class, BrokerInitializationResult.class, value); + } + /** * Create an instance of {@link JAXBElement }{@code <}{@link BrokerInitializationResult }{@code >}} diff --git a/src/com/microsoft/hpc/properties/ErrorCode.java b/src/com/microsoft/hpc/properties/ErrorCode.java index 2693c6d..6f8890d 100644 --- a/src/com/microsoft/hpc/properties/ErrorCode.java +++ b/src/com/microsoft/hpc/properties/ErrorCode.java @@ -1,984 +1,994 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Global Error Code -// -// ------------------------------------------------------------------------------ - -package com.microsoft.hpc.properties; - -// Summary: -// Defines the possible HPC-defined error codes that HPC can set. -public final class ErrorCode -{ - - // Summary: - // Separator used to separate the insertion strings for the error message - // text. - // See Microsoft.Hpc.Scheduler.Properties.SchedulerException.Params. - public static String ArgumentSeparator = "|||"; - public static int AuthFailureDisableCredentialReuse = 1; - // - // Summary: - // The child job has finished running. - public static int Execution_ChildJobFinished = -2147218986; - public static int Execution_FailedByActivationFilter = -2147218966; - public static int Execution_FailedToOpenStandardError = -2147218973; - public static int Execution_FailedToOpenStandardInput = -2147218975; - public static int Execution_FailedToOpenStandardOutput = -2147218974; - // - // Summary: - // The user canceled the job while it was running. - public static int Execution_JobCanceled = -2147218982; - // - // Summary: - // The job was preempted by a higher priority job. For details, see the - // Microsoft.Hpc.Scheduler.ISchedulerJob.CanPreempt - // and the PreemptionType cluster parameter in the Remarks section of - // Microsoft.Hpc.Scheduler.IScheduler.SetClusterParameter(System.String,System.String). - public static int Execution_JobPreempted = -2147218978; - // - // Summary: - // The job exceeded its run-time limit. See - // Microsoft.Hpc.Scheduler.ISchedulerJob.Runtime - // and Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime. - public static int Execution_JobRuntimeExpired = -2147218987; - // - // Summary: - // An error occurred on the node. - public static int Execution_NodeError = -2147218990; - public static int Execution_NodePrepTaskFailure = -2147218968; - // - // Summary: - // The job or task was scheduled to run on a node that is no longer - // reachable. - public static int Execution_NodeUnreachable = -2147218984; - // - // Summary: - // The parent job of this child job has been canceled. - public static int Execution_ParentJobCanceled = -2147218988; - // - // Summary: - // The process has exited. - public static int Execution_ProcessDead = -2147218983; - // - // Summary: - // The job failed to start on one or more nodes or the nodes were not - // reachable. - public static int Execution_ResourceFailure = -2147218981; - // - // Summary: - // The job failed to start on node {0}. - public static int Execution_StartJobFailedOnNode = -2147218977; - public static int Execution_TaskCanceledBeforeAssignment = -2147218971; - public static int Execution_TaskCanceledDuringExecution = -2147218969; - public static int Execution_TaskCanceledOnJobRequeue = -2147218970; - // - // Summary: - // The scheduler was not able to execute the command specified in the task. - public static int Execution_TaskExecutionFailure = -2147218979; - // - // Summary: - // The task failed. - public static int Execution_TaskFailure = -2147218980; - public static int Execution_TaskNodeNotUsable = -2147218967; - // - // Summary: - // The task exceeded its run-time limit. See - // Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime. - public static int Execution_TaskRuntimeExpired = -2147218985; - // - // Summary: - // The job to which the task belongs was canceled. - public static int Execution_TasksJobCanceled = -2147218989; - // - // Summary: - // The task was canceled while it was running because a job with higher - // priority - // preempted the task. If the task can be rerun, the HPC Job Scheduler - // service - // will attempt to automatically queue it again. - public static int Execution_TasksPreempted = -2147218976; - // - // Summary: - // An unknown error occurred. - public static int Execution_UnknownError = -2147218991; - public static int Execution_WorkingDirectoryNotFound = -2147218972; - // - // Summary: - // The value is outside the allowable range of values. - public static int Operation_ArgumentOutOfRange = -2147220987; - // - // Summary: - // Authenticate failure. - public static int Operation_AuthenticationFailure = -2147220980; - public static int Operation_AzureDeploymentNotFound = -2147220691; - // - // Summary: - // The user canceled the job or task. - public static int Operation_CanceledByUser = -2147220991; - public static int Operation_CancelMessageIsTooLong = -2147220781; - public static int Operation_CannotConnectWithScheduler = -2147220785; - // - // Summary: - // You cannot remove item {0} from the default job template. - public static int Operation_CannotRemoveProfileItemFromDefaultTemplate = -2147220954; - // - // Summary: - // You cannot change the name of the default job template. - public static int Operation_CannotResetDefaultProfileName = -2147220948; - // - // Summary: - // You cannot submit child job, instead you must submit the parent job. - public static int Operation_ChildJobCannotBeSubmittedAlone = -2147220966; - // - // Summary: - // Not able to register with the server. - public static int Operation_CouldNotRegisterWithServer = -2147220932; - // - // Summary: - // Cryptography error. - public static int Operation_CryptographyError = -2147220979; - // - // Summary: - // A database exception occurred while processing the request. - public static int Operation_DatabaseException = -2147220988; - // - // Summary: - // The scheduler was unable to create a new job because the database is - // full. - public static int Operation_DatabaseIsFull = -2147220926; - // - // Summary: - // Duplicate application found in the software license item. - public static int Operation_DuplicateLicenseFeature = -2147220946; - public static int Operation_EmailCredentialMustBeAdmin = -2147220888; - // - // Summary: - // The environment variable name was too long. The size must be smaller than - // {0} characters. - public static int Operation_EnvironmentVarNameTooLong = -2147220929; - // - // Summary: - // The environment variable value was too long. The size must be smaller - // than - // {0} characters. - public static int Operation_EnvironmentVarValueTooLong = -2147220928; - public static int Operation_ExcludedNodeDoesNotExist = -2147220885; - public static int Operation_ExcludedNodeListTooLong = -2147220782; - public static int Operation_ExcludedRequiredNode = -2147220887; - public static int Operation_ExcludedTooManyNodes = -2147220886; - public static int Operation_ExpandedPriorityNotValidOnServer = -2147220792; - public static int Operation_FeatureDeprecated = -2147220896; - public static int Operation_FeatureUnimplemented = -2147220895; - public static int Operation_HPCSidUnavailable = -2147220784; - // - // Summary: - // The job template property {0} is not a legal job template property. - public static int Operation_IllegalProfileProperty = -2147220969; - public static int Operation_IllegalServiceConcludeAttempt = -2147220779; - public static int Operation_IllegalStateForServiceConclude = -2147220778; - public static int Operation_IllegalTaskAddedToServiceJob = -2147220909; - // - // Summary: - // You cannot cancel the job in its current state. - public static int Operation_InvalidCancelJobState = -2147220984; - // - // Summary: - // You cannot cancel the task in its current state. - public static int Operation_InvalidCancelTaskState = -2147220983; - public static int Operation_InvalidEmailAddress = -2147220690; - // - // Summary: - // The provided environment variable name is not valid. - public static int Operation_InvalidEnvironmentVarName = -2147220931; - // - // Summary: - // The provided environment variable value is not valid. - public static int Operation_InvalidEnvironmentVarValue = -2147220930; - // - // Summary: - // You cannot filter on property '{0}' for this type of object. - public static int Operation_InvalidFilterProperty = -2147220925; - // - // Summary: - // The job identifier does not identify an existing job in the scheduler. - public static int Operation_InvalidJobId = -2147220986; - public static int Operation_InvalidJobStateForNodeExclusion = -2147220884; - // - // Summary: - // Invalid specification for '{0}'. - public static int Operation_InvalidJobTemplateItemXml = -2147220927; - // - // Summary: - // The node identifier does not identify and existing node in the cluster. - public static int Operation_InvalidNodeId = -2147220978; - // - // Summary: - // The requested operation is not valid. - public static int Operation_InvalidOperation = -2147220977; - // - // Summary: - // The job template identifier is not valid. - public static int Operation_InvalidProfileId = -2147220933; - public static int Operation_InvalidPropForTaskType = -2147220908; - // - // Summary: - // The row enumeration identifier is not valid. - public static int Operation_InvalidRowEnumId = -2147220935; - // - // Summary: - // The task identifier does not identify and existing task in the scheduler. - public static int Operation_InvalidTaskId = -2147220985; - // - // Summary: - // The job already exists on the server. - public static int Operation_JobAlreadyCreatedOnServer = -2147220941; - public static int Operation_JobDeletionForbidden = -2147220912; - public static int Operation_JobHoldInvalidState = -2147220790; - public static int Operation_JobHoldUntilTooLong = -2147220783; - public static int Operation_JobInvalidHoldUntil = -2147220789; - // - // Summary: - // Job modification failed: {0}. - public static int Operation_JobModifyFailed = -2147220960; - // - // Summary: - // The job was not found on the server. - public static int Operation_JobNotCreatedOnServer = -2147220942; - public static int Operation_JobProgressOutOfRange = -2147220917; - // - // Summary: - // Unable to revert the job changes. - public static int Operation_JobRevertModifyFailed = -2147220959; - public static int Operation_JobTemplateRequiredValueMissing = -2147220878; - public static int Operation_JobTemplateValueInvalid = -2147220881; - public static int Operation_JobTemplateValueTooLarge = -2147220879; - public static int Operation_JobTemplateValueTooSmall = -2147220880; - public static int Operation_JobVersionMismatch = -2147220894; - // - // Summary: - // You must specify a job template name. - public static int Operation_MustProvideProfileName = -2147220934; - public static int Operation_NodeAlreadyExists = -2147220898; - public static int Operation_NodeIsNotOnAzure = -2147220692; - // - // Summary: - // The user does not have permission to use the job template. - public static int Operation_NoPermissionToUseProfile = -2147220967; - // - // Summary: - // No storage is currently defined for the property. - public static int Operation_NoTableDefinedForProperty = -2147220944; - // - // Summary: - // You do not have permission to change this job template. - public static int Operation_NotAllowedToChangeProfiles = -2147220970; - // - // Summary: - // The user is not allowed to create job templates. - public static int Operation_NotAllowedToCreateProfiles = -2147220972; - // - // Summary: - // The default job template cannot be deleted. - public static int Operation_NotAllowedToDeleteDefaultProfile = -2147220968; - // - // Summary: - // The user is not allowed to delete job templates. - public static int Operation_NotAllowedToDeleteProfiles = -2147220971; - // - // Summary: - // Cannot perform the operation because you are not connected to the server. - public static int Operation_NotConnectedToServer = -2147220936; - public static int Operation_ObjectInUse = -2147220882; - // - // Summary: - // The job must be in the configuration state in order to submit the job. - public static int Operation_OnlyConfigJobsCanBeSubmitted = -2147220990; - // - // Summary: - // You can submit the task only if the task is in the - // Microsoft.Hpc.Scheduler.Properties.TaskState.Configuring - // state. - public static int Operation_OnlyConfiguringTasksCanBeSubmitted = -2147220940; - // - // Summary: - // You can reconfigure only canceled or failed jobs. - public static int Operation_OnlyFailedCancelledJobsCanBeConfigured = -2147220982; - public static int Operation_OnlyFailedCancelledTasksCanBeConfigured = -2147220916; - // - // Summary: - // The user does not have permission to perform the operation. - public static int Operation_PermissionDenied = -2147220981; - // - // Summary: - // You cannot change HPC-defined environment variables. - public static int Operation_PreservedEnvironmentVariables = -2147220938; - public static int Operation_PriorityAndExPriCannotBeSetTogether = -2147220791; - // - // Summary: - // The job template item that you are trying to set already exists. - public static int Operation_ProfileItemAlreadyExists = -2147220975; - // - // Summary: - // The default value for the job template item is not within the allowed - // value - // range for the item. - public static int Operation_ProfileItemDefaultValueInvalid = -2147220952; - // - // Summary: - // The default values specified for the job template item {0} must include - // all - // of the required values for that item. Ensure that the default values - // include - // all the values in the Required Values list, and then try again. - public static int Operation_ProfileItemDefaultValueNotIncludeRequiredValue = -2147220953; - // - // Summary: - // The job template item that you are trying to set does not exist. - public static int Operation_ProfileItemDoesNotExist = -2147220976; - // - // Summary: - // The minimum staticraint for the job template item is greater than its - // maximum - // staticraint. - public static int Operation_ProfileItemMinGreaterThanMax = -2147220950; - // - // Summary: - // You must provide a default value for the job template item. - public static int Operation_ProfileItemMustProvideDefaultStringValue = -2147220951; - // - // Summary: - // Invalid template: The template item {0}'s default value, {1}, is larger - // than - // the default value of the related template item, {2} (default value: {3}). - // Correct this inconsistency and try again. - public static int Operation_ProfileItemRangeInconsistent_LeftDefaultGreaterThanRightDefault = -2147220956; - // - // Summary: - // Invalid template: The template item {0}'s maximum value, {1}, is larger - // than - // the maximum value of the related template item, {2} (maximum value: {3}). - // Correct this inconsistency and try again. - public static int Operation_ProfileItemRangeInconsistent_LeftMaxGreaterThanRightMax = -2147220957; - // - // Summary: - // Invalid template: The template item {0}'s minimum value, {1}, is larger - // than - // the minimum value of the related template item, {2} (minimum value: {3}). - // Correct this inconsistency and try again. - public static int Operation_ProfileItemRangeInconsistent_LeftMinGreaterThanRightMin = -2147220958; - // - // Summary: - // The value of the job template item cannot be less than zero. - public static int Operation_ProfileItemRangeInconsistent_ValueLessThanZero = -2147220955; - // - // Summary: - // The data type used to set or access the job template item does not match - // the data type of the item. - public static int Operation_ProfileItemTypeInconsistent = -2147220949; - // - // Summary: - // A job template with the specified name already exists. - public static int Operation_ProfileNameBeenUsed = -2147220964; - // - // Summary: - // The job template does not exist in the scheduler. - public static int Operation_ProfileNotFound = -2147220965; - // - // Summary: - // The property is read-only and cannot be set. - public static int Operation_PropertyIsstatic = -2147220989; - // - // Summary: - // The property name already exists. - public static int Operation_PropertyNameAlreadyExists = -2147220973; - public static int Operation_PropertyNameCannotBeEmpty = -2147220786; - public static int Operation_PropertyNotSupportedOnServerVersion = -2147220907; - // - // Summary: - // The value is too large. - public static int Operation_PropertyValueTooLargeForDatabase = -2147220939; - public static int Operation_ReconnectTimeout = -2147220780; - public static int Operation_SchedulerInCleanupMode = -2147220777; - public static int Operation_SchedulerInRecoverMode = -2147220788; - public static int Operation_SchedulerPrivilegeRequired = -2147220787; - public static int Operation_ServerIsBusy = -2147220897; - // - // Summary: - // You cannot change the property when the job is in the current state. - public static int Operation_SetInvalidPropUnderCertainState = -2147220943; - public static int Operation_TaskDeletionForbidden = -2147220911; - // - // Summary: - // Failed to modify the task. - public static int Operation_TaskModifyFailed = -2147220922; - public static int Operation_TaskNotCreatedOnServer = -2147220914; - public static int Operation_TaskOfTypeCannotBeReconfigured = -2147220915; - public static int Operation_TaskTypeAddedInWrongJobState = -2147220910; - public static int Operation_TaskTypeAndIsParametricIncompatible = -2147220905; - public static int Operation_TaskTypeNotSupportedOnServer = -2147220924; - public static int Operation_TooManyParametricSweepTasksPerJob = -2147220906; - // - // Summary: - // You cannot change the property when the node is in the current state. - public static int Operation_TryToChangePropertyInNodeState = -2147220945; - // - // Summary: - // You cannot modify the job property when the job is in its current state. - public static int Operation_TryToModifyInvalidProperty = -2147220962; - // - // Summary: - // You cannot modify the job property when the job is in its current state. - public static int Operation_TryToModifyInvalidStateJob = -2147220961; - // - // Summary: - // The task cannot be modified in its current state. - public static int Operation_TryToModifyInvalidStateTask = -2147220921; - // - // Summary: - // If the job is a backfill job, you cannot modify the job's runtime value - // when - // the job is running. - public static int Operation_TryToModifyRuntimeForRunningBackfillJob = -2147220963; - // - // Summary: - // The exception was not expected. - public static int Operation_UnexpectedException = -2147220892; - // - // Summary: - // The specified node group does not exist. - public static int Operation_UnknownNodeGroup = -2147220937; - public static int Operation_WindowsTaskSchedulerExecFailure = -2147220890; - public static int Operation_WindowsTaskSchedulerNotStarted = -2147220889; - public static int Operation_WindowsTaskSchedulerTimeout = -2147220891; - // - // Summary: - // The software license format is not valid. The valid format is - // application: - // numberoflicenses{,application:numberoflicenses. - public static int Operation_WrongLicenseFormat = -2147220947; - // - // Summary: - // The cluster does not contain a node that is capable of running a broker - // job. - public static int ResourceAssignement_FailedToFindBrokerNode = -2147219991; - // - // Summary: - // Failed to run the activation filter specified in the - // ActivationFilterProgram - // cluster parameter. - public static int ResourceAssignement_FailedToLaunchActivationFilter = -2147219990; - // - // Summary: - // There are no nodes available to run the task. - public static int ResourceAssignement_NodeUnavailable = -2147219989; - public static int ServiceBroker_ExitCode_End = -2147214992; - public static int ServiceBroker_ExitCode_Start = -2147215992; - // - // Summary: - // The BackendBinding value specified in the service broker's configuration - // file is not valid. Correct the binding and start a new session. - public static int ServiceBroker_InvalidBackendBinding = -2147215986; - // - // Summary: - // The configuration file for the service broker was not valid. - public static int ServiceBroker_InvalidConfig = -2147215989; - // - // Summary: - // The broker could not find the HPC environment information. - public static int ServiceBroker_MissingHpcEnvironmentInfomation = -2147215991; - // - // Summary: - // The service name or assembly name was not specified. - public static int ServiceBroker_MissingServiceInformation = -2147215990; - // - // Summary: - // The broker failed to open the service broker web service. - public static int ServiceBroker_OpenBrokerServiceFailure = -2147215987; - // - // Summary: - // The broker failed to open the service registration web service. - public static int ServiceBroker_OpenRegistrationServiceFailure = -2147215988; - // - // Summary: - // An unexpected exception occurred. Please see the broker execution log for - // details. - public static int ServiceBroker_UnexpectedError = -2147215972; - // - // Summary: - // Not able to find the service assembly file name in the service - // registration - // file. Please ensure that the service registration file has the correct - // format. - public static int ServiceHost_AssemblyFileNameNullOrEmpty = -2147216980; - // - // Summary: - // Failed to find the service assembly file. Please ensure that the assembly - // has been deployed and registered on the node. - public static int ServiceHost_AssemblyFileNotFound = -2147216991; - // - // Summary: - // Failed to load the service assembly. Please ensure that the security - // settings - // for the assembly are correct and that the service assembly information at - // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath) is - // correct. - public static int ServiceHost_AssemblyLoadingError = -2147216990; - // - // Summary: - // The service registration file is not in the correct format. Please use - // the - // service registration XML schema to ensure that the service registration - // file - // is in the correct format. - public static int ServiceHost_BadServiceRegistrationFileFormat = -2147216979; - // - // Summary: - // Failed to find the service contract interface from the service assembly. - // Please ensure that the contract information provided in the service - // registration - // is valid (see - // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath - // and Contract type). - public static int ServiceHost_ContractDiscoverError = -2147216989; - // - // Summary: - // The service registry is corrupt. - public static int ServiceHost_CorruptServiceRegistry = -2147216983; - public static int ServiceHost_ExitCode_End = -2147215992; - public static int ServiceHost_ExitCode_Start = -2147216992; - // - // Summary: - // Failed to register to the broker service. - public static int ServiceHost_FailedToRegisterLB = -2147216984; - public static int ServiceHost_IncorrectCommandLineParameter = -2147216978; - // - // Summary: - // Failed to find the contract implemented by the service type. - public static int ServiceHost_NoContractImplemented = -2147216986; - public static int ServiceHost_PrintCommandHelp = -2147216976; - public static int ServiceHost_ServiceConfigFileNameNotSpecified = -2147216977; - // - // Summary: - // Failed to open the service host. Please ensure that the NetTcp port - // sharing - // service is running and that the user has permission to use port sharing - // service, - // and that the firewall settings are correct. - public static int ServiceHost_ServiceHostFailedToOpen = -2147216985; - // - // Summary: - // The service name is not specified. - public static int ServiceHost_ServiceNameNotSpecified = -2147216982; - // - // Summary: - // Cannot locate the service registration file in both - // %CCP_HOME%ServiceRegistration - // folder and user specified central registration folder (if any). Please - // ensure - // that the service has been successfully deployed. - public static int ServiceHost_ServiceRegistrationFileNotFound = -2147216981; - // - // Summary: - // Failed to find the service type from the service assembly. Please ensure - // that the type information in the service registration is valid (see - // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath - // and ServiceType). - public static int ServiceHost_ServiceTypeDiscoverError = -2147216988; - // - // Summary: - // Failed to load the service type from the service assembly. - public static int ServiceHost_ServiceTypeLoadingError = -2147216987; - // - // Summary: - // An unexpected exception occurred. Please see the service host execution - // log - // for details. - public static int ServiceHost_UnexpectedException = -2147216972; - // - // Summary: - // The operation was a success. - public static int Success = 0; - // - // Summary: - // An unknown error occurred. - public static int UnknowError = -2147214990; - public static int UnknownError = -2147214990; - public static int Validation_AdminJobCannotHaveTaskDependency = -2147219882; - // - // Summary: - // A batch job cannot be a child job. - public static int Validation_BatchJobMustNotBeChildJob = -2147219904; - // - // Summary: - // Failed to compute the maximum resource requirement for the job. - public static int Validation_CalcJobMaxError = -2147219921; - // - // Summary: - // Failed to compute the minimum resource requirement for the job. - public static int Validation_CalcJobMinError = -2147219922; - // - // Summary: - // A child job cannot contain another child job. - public static int Validation_ChildJobContainsChildJob = -2147219908; - // - // Summary: - // The parent identifier included in the child job is different than its - // parent's - // actual identifier. - public static int Validation_ChildJobIdNotPairWithParentJobId = -2147219909; - // - // Summary: - // The child job must be a router job. - public static int Validation_ChildJobMustBeRouterJob = -2147219910; - // - // Summary: - // The child job is not valid. - public static int Validation_ChildJobNotValid = -2147219912; - // - // Summary: - // The cluster does not contain the required minimum number of resources. - public static int Validation_ClusterSizeLessThanMin = -2147219956; - public static int Validation_CombineSelectException = -2147219979; - // - // Summary: - // The credentials specified for this job are not able to log onto the - // cluster. - public static int Validation_CredentialCheckFailed = -2147219989; - // - // Summary: - // Failed to calculate task group level. - public static int Validation_FailToCalculateTaskGroupLevel = -2147219930; - // - // Summary: - // The contents of the Microsoft.Hpc.Scheduler.ISchedulerTask.DependsOn - // property - // is not valid. - public static int Validation_InvalidDependsOn = -2147219929; - public static int Validation_InvalidNodeCriteriaForJob = -2147219886; - public static int Validation_InvalidPropForTaskType = -2147219894; - // - // Summary: - // Job submission failed because the job submission filter application is - // not - // valid. Your cluster administrator should check that the submission filter - // is an executable binary file (".exe" file) or Windows command script - // (".cmd" - // file). - public static int Validation_InvalidSubmissionFilter = -2147219900; - // - // Summary: - // A node that the job requests does not support the job's job type. - public static int Validation_JobAskedNodeMustContainJobType = -2147219953; - // - // Summary: - // The job is missing the user name or password. - public static int Validation_JobMissUsernameOrPassword = -2147219988; - // - // Summary: - // The list of requested nodes does not contain a valid node. - public static int Validation_JobRequestedNodesContainZeroValidNode = -2147219967; - // - // Summary: - // The job requires a node that is not available. - public static int Validation_JobRequiredNodeNotAvailable = -2147219954; - // - // Summary: - // The list of nodes that the task requires must be included in the list of - // the nodes that the job requested. - public static int Validation_JobRequiredNodeNotInJobAskedNodes = -2147219955; - // - // Summary: - // The maximum number of resource units must be greater than zero. - public static int Validation_MaxLessThanOne = -2147219933; - // - // Summary: - // The maximum number of resource units cannot be less than zero. - public static int Validation_MaxLessThanZero = -2147219959; - // - // Summary: - // You must specify the maximum number of resource units that the job - // requires - // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMax property is - // false. - public static int Validation_MaxNotSpecifiedWhenAutoCalcMaxIsFalse = -2147219961; - // - // Summary: - // You must specify a maximum resource value for the task. - public static int Validation_MaxUndefined = -2147219947; - // - // Summary: - // The minimum value must be less than the maximum value. - public static int Validation_MinGreaterThanMax = -2147219958; - // - // Summary: - // The minimum number of resource units must be greater than zero. - public static int Validation_MinLessThanOne = -2147219934; - // - // Summary: - // The minimum number of resource units cannot be less than zero. - public static int Validation_MinLessThanZero = -2147219960; - // - // Summary: - // You must specify the minimum number of resource units that the job - // requires - // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMin property is - // false. - public static int Validation_MinNotSpecifiedWhenAutoCalcMinIsFalse = -2147219962; - // - // Summary: - // You must specify a minimum resource value for the task. - public static int Validation_MinUndefined = -2147219948; - // - // Summary: - // The task must specify a command to run. - public static int Validation_MissCommandLine = -2147219952; - public static int Validation_MultipleNodePrepTasksPerJob = -2147219897; - public static int Validation_MultipleNodeReleaseTasksPerJob = -2147219896; - // - // Summary: - // The computed resources for the job is less than the required number of - // resources. - public static int Validation_NodeListSizeLessThanMin = -2147219957; - // - // Summary: - // The node does not exist in the cluster. - public static int Validation_NodeNotExist = -2147219965; - // - // Summary: - // The cluster does not contain a node that supports the specified resource - // requirements for the job (for example, memory or core requirements). - // Please - // adjust your requirements and submit the job again. - public static int Validation_NoNodeFulfillsTheSelectionCriteria = -2147219966; - public static int Validation_OnlyNodePrepOrReleaseTasksInJob = -2147219895; - // - // Summary: - // The parent job must be a service job. - public static int Validation_ParentJobMustBeServiceJob = -2147219911; - // - // Summary: - // The parent job is not valid. - public static int Validation_ParentJobNotValid = -2147219907; - // - // Summary: - // The job template does not exist. - public static int Validation_ProfileNotExist = -2147219977; - // - // Summary: - // The property value is not within the allowed range of values as specified - // by the job template. - public static int Validation_PropertyOutOfRange = -2147219978; - // - // Summary: - // A property that requires a value as specified by the job template has not - // been set. - public static int Validation_RequiredPropertyNotSet = -2147219981; - // - // Summary: - // A router job cannot be a child job. - public static int Validation_RouterJobMustBeChildJob = -2147219906; - // - // Summary: - // To reserve resources for a job (when the job does not contain tasks and - // has - // requested that it run until canceled), you must specify the maximum and - // minimum - // resource values for the job -you cannot request that the scheduler - // compute - // the maximum and minimum resource values. - public static int Validation_RunUntilCanceledButAutoMinMaxSet = -2147219963; - // - // Summary: - // To reserve resources for a job (when the job does not contain tasks and - // has - // requested that it run until canceled), you must specify the maximum and - // minimum - // resource values for the job. - public static int Validation_RunUntilCanceledButMinMaxNotSpecified = -2147219964; - // - // Summary: - // A service job cannot be a child job. - public static int Validation_ServiceJobMustNotBeChildJob = -2147219905; - public static int Validation_ServiceTaskIsNotAlone = -2147219887; - // - // Summary: - // Job submission failed because the job submission filter application could - // not be found. Your cluster administrator should check that the submission - // filter is accessible from the head node of the cluster and the path to - // the - // submission filter is a fully-qualified (not relative) path name. - public static int Validation_SubmissionFilterDoesNotExist = -2147219901; - // - // Summary: - // The job failed to pass the job submission filter specified in the - // SubmissionFilterProgram - // cluster parameter. - public static int Validation_SubmissionFilterFailed = -2147219902; - public static int Validation_SubmissionFilterInvalidJobTerm = -2147219883; - public static int Validation_SubmissionFilterTimeout = -2147219884; - public static int Validation_TargetResourceCountLessThanMin = -2147219888; - public static int Validation_TargetResourceCountMoreThanMax = -2147219889; - // - // Summary: - // The task must specify the same resource unit as the job. - public static int Validation_TaskAllocUnitNotSameWithJob = -2147219949; - // - // Summary: - // The dependency list for multiple tasks creates a circular dependency. - public static int Validation_TaskDependenciesContainCycle = -2147219931; - // - // Summary: - // The minimum and maximum resource requirements cannot be computed for a - // job - // with exclusive access to the nodes. You must specify the minimum and - // maximum - // resource values and resubmit the job. - public static int Validation_TaskExclusiveWhileJobAutoMinMaxEnabled = -2147219938; - // - // Summary: - // The task can run exclusively on a node only if the job specifies that it - // must run exclusively on the node. - public static int Validation_TaskExclusiveWhileJobNot = -2147219943; - // - // Summary: - // The task failed because the scheduler could not validate its parent job. - // Correct the validation error on the parent job and resubmit the job. - public static int Validation_TaskFailedOnJobValidationFault = -2147219936; - // - // Summary: - // The task specifies a list of dependent tasks but the task does not - // specify - // a name value for itself; each dependent task and the task specifying the - // dependency must include a name value. - public static int Validation_TaskHasDependOnButNoName = -2147219928; - // - // Summary: - // The task cannot specify required nodes when the job has requested that - // the - // scheduler compute the required resources. - public static int Validation_TaskHasRequiredNodesWhileJobAutoMinMaxEnabled = -2147219937; - // - // Summary: - // The increment value for a parametric task must be greater than or equal - // to - // 1. - public static int Validation_TaskIncrementValueLessThanZero = -2147219899; - // - // Summary: - // The start value for a parametric task cannot be greater than end value. - public static int Validation_TaskInvalidParametricSweep = -2147219898; - // - // Summary: - // The maximum resource value for the task must be less than that of the - // job. - public static int Validation_TaskMaxGreaterThanJobMax = -2147219945; - // - // Summary: - // The minimum resource value for the task must be less than that of the - // job. - public static int Validation_TaskMinGreaterThanJobMin = -2147219946; - // - // Summary: - // The minimum resource value for the task must be less than its maximum The - // minimum resource value for the task must be less than that of the job - // value. - public static int Validation_TaskMinGreaterThanTaskMax = -2147219944; - public static int Validation_TaskNodeReleaseDisabled = -2147219893; - public static int Validation_TaskNodeReleaseExceedsMaxRunTime = -2147219892; - // - // Summary: - // You have exceeded the number of times that a task can be queued again. - // The - // TaskRetryCount cluster parameter specifies the maximum number of times - // that - // a task can be queued again. - public static int Validation_TaskRequeuedTooManyTimes = -2147219951; - public static int Validation_TaskRequiredNodeNotAllocatedToRunningJob = -2147219885; - // - // Summary: - // The job requires a node that is not available. - public static int Validation_TaskRequiredNodeNotAvailable = -2147219940; - // - // Summary: - // The list of nodes that the task requires must be included in the list of - // the nodes that the job requested. - public static int Validation_TaskRequiredNodeNotInJobAskedNodes = -2147219942; - // - // Summary: - // The task specifies more required nodes than the job's specified maximum - // resource - // usage. - public static int Validation_TaskRequiredNodeOutOfJobMaximumResource = -2147219939; - // - // Summary: - // The run-time value for the task is greater than the length of time that - // the - // job is scheduled to remain running. - public static int Validation_TaskRuntimeGreaterThanJob = -2147219941; - public static int Validation_TaskTypeAddedInWrongJobState = -2147219891; - // - // Summary: - // The task failed validation. - public static int Validation_TaskValidationFailed = -2147219935; - public static int Validation_TooManyParametricInstances = -2147219890; - // - // Summary: - // You cannot queue the task again because the task is marked to run only - // one - // time. - public static int Validation_TryToRequeueNonRerunnableTask = -2147219950; - // - // Summary: - // The depends on list is ambiguous because multiple tasks specify the same - // name. - public static int Validation_TwoTasksWithSameNameDifferentGroup = -2147219932; - // - // Summary: - // An unexpected exception occurred while validating the job. - public static int Validation_UnexpectedExceptionWhenValidating = -2147219991; - public static int Validation_Unknown = -2147219990; - - // Summary: - // Defines the category of errors into which the - // Microsoft.Hpc.Scheduler.Properties.ErrorCode - // codes are grouped. - public enum Category - { - // Summary: - // An error occurred while performing an operation (for example, the - // user tried - // to delete a job template but they do not have permissions to delete - // templates). - // This enumeration member represents a value of 0. - OperationError, - // - // Summary: - // The error occurred while validating the job or task before it ran. - // This enumeration - // member represents a value of 1. - ValidationError, - // - // Summary: - // The error occurred while assigning resources to the job or task. This - // enumeration - // member represents a value of 2. - ResourceAssignmentError, - // - // Summary: - // The error occurred while executing the job or task. This enumeration - // member - // represents a value of 3. - ExecutionError, - // - // Summary: - // Includes errors related to starting service or broker jobs. This - // enumeration - // member represents a value of 4. - Other, - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Global Error Code +// +// ------------------------------------------------------------------------------ + +package com.microsoft.hpc.properties; + +// Summary: +// Defines the possible HPC-defined error codes that HPC can set. +public final class ErrorCode +{ + + // Summary: + // Separator used to separate the insertion strings for the error message + // text. + // See Microsoft.Hpc.Scheduler.Properties.SchedulerException.Params. + public static String ArgumentSeparator = "|||"; + public static int AuthFailureDisableCredentialReuse = 1; + // + // Summary: + // The child job has finished running. + public static int Execution_ChildJobFinished = -2147218986; + public static int Execution_FailedByActivationFilter = -2147218966; + public static int Execution_FailedToOpenStandardError = -2147218973; + public static int Execution_FailedToOpenStandardInput = -2147218975; + public static int Execution_FailedToOpenStandardOutput = -2147218974; + // + // Summary: + // The user canceled the job while it was running. + public static int Execution_JobCanceled = -2147218982; + // + // Summary: + // The job was preempted by a higher priority job. For details, see the + // Microsoft.Hpc.Scheduler.ISchedulerJob.CanPreempt + // and the PreemptionType cluster parameter in the Remarks section of + // Microsoft.Hpc.Scheduler.IScheduler.SetClusterParameter(System.String,System.String). + public static int Execution_JobPreempted = -2147218978; + // + // Summary: + // The job exceeded its run-time limit. See + // Microsoft.Hpc.Scheduler.ISchedulerJob.Runtime + // and Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime. + public static int Execution_JobRuntimeExpired = -2147218987; + // + // Summary: + // An error occurred on the node. + public static int Execution_NodeError = -2147218990; + public static int Execution_NodePrepTaskFailure = -2147218968; + // + // Summary: + // The job or task was scheduled to run on a node that is no longer + // reachable. + public static int Execution_NodeUnreachable = -2147218984; + // + // Summary: + // The parent job of this child job has been canceled. + public static int Execution_ParentJobCanceled = -2147218988; + // + // Summary: + // The process has exited. + public static int Execution_ProcessDead = -2147218983; + // + // Summary: + // The job failed to start on one or more nodes or the nodes were not + // reachable. + public static int Execution_ResourceFailure = -2147218981; + // + // Summary: + // The job failed to start on node {0}. + public static int Execution_StartJobFailedOnNode = -2147218977; + public static int Execution_TaskCanceledBeforeAssignment = -2147218971; + public static int Execution_TaskCanceledDuringExecution = -2147218969; + public static int Execution_TaskCanceledOnJobRequeue = -2147218970; + // + // Summary: + // The scheduler was not able to execute the command specified in the task. + public static int Execution_TaskExecutionFailure = -2147218979; + // + // Summary: + // The task failed. + public static int Execution_TaskFailure = -2147218980; + public static int Execution_TaskNodeNotUsable = -2147218967; + // + // Summary: + // The task exceeded its run-time limit. See + // Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime. + public static int Execution_TaskRuntimeExpired = -2147218985; + // + // Summary: + // The job to which the task belongs was canceled. + public static int Execution_TasksJobCanceled = -2147218989; + // + // Summary: + // The task was canceled while it was running because a job with higher + // priority + // preempted the task. If the task can be rerun, the HPC Job Scheduler + // service + // will attempt to automatically queue it again. + public static int Execution_TasksPreempted = -2147218976; + // + // Summary: + // An unknown error occurred. + public static int Execution_UnknownError = -2147218991; + public static int Execution_WorkingDirectoryNotFound = -2147218972; + // + // Summary: + // The value is outside the allowable range of values. + public static int Operation_ArgumentOutOfRange = -2147220987; + // + // Summary: + // Authenticate failure. + public static int Operation_AuthenticationFailure = -2147220980; + public static int Operation_AzureDeploymentNotFound = -2147220691; + // + // Summary: + // The user canceled the job or task. + public static int Operation_CanceledByUser = -2147220991; + public static int Operation_CancelMessageIsTooLong = -2147220781; + public static int Operation_CannotConnectWithScheduler = -2147220785; + // + // Summary: + // You cannot remove item {0} from the default job template. + public static int Operation_CannotRemoveProfileItemFromDefaultTemplate = -2147220954; + // + // Summary: + // You cannot change the name of the default job template. + public static int Operation_CannotResetDefaultProfileName = -2147220948; + // + // Summary: + // You cannot submit child job, instead you must submit the parent job. + public static int Operation_ChildJobCannotBeSubmittedAlone = -2147220966; + // + // Summary: + // Not able to register with the server. + public static int Operation_CouldNotRegisterWithServer = -2147220932; + // + // Summary: + // Cryptography error. + public static int Operation_CryptographyError = -2147220979; + // + // Summary: + // A database exception occurred while processing the request. + public static int Operation_DatabaseException = -2147220988; + // + // Summary: + // The scheduler was unable to create a new job because the database is + // full. + public static int Operation_DatabaseIsFull = -2147220926; + // + // Summary: + // Duplicate application found in the software license item. + public static int Operation_DuplicateLicenseFeature = -2147220946; + public static int Operation_EmailCredentialMustBeAdmin = -2147220888; + // + // Summary: + // The environment variable name was too long. The size must be smaller than + // {0} characters. + public static int Operation_EnvironmentVarNameTooLong = -2147220929; + // + // Summary: + // The environment variable value was too long. The size must be smaller + // than + // {0} characters. + public static int Operation_EnvironmentVarValueTooLong = -2147220928; + public static int Operation_ExcludedNodeDoesNotExist = -2147220885; + public static int Operation_ExcludedNodeListTooLong = -2147220782; + public static int Operation_ExcludedRequiredNode = -2147220887; + public static int Operation_ExcludedTooManyNodes = -2147220886; + public static int Operation_ExpandedPriorityNotValidOnServer = -2147220792; + public static int Operation_FeatureDeprecated = -2147220896; + public static int Operation_FeatureUnimplemented = -2147220895; + public static int Operation_HPCSidUnavailable = -2147220784; + // + // Summary: + // The job template property {0} is not a legal job template property. + public static int Operation_IllegalProfileProperty = -2147220969; + public static int Operation_IllegalServiceConcludeAttempt = -2147220779; + public static int Operation_IllegalStateForServiceConclude = -2147220778; + public static int Operation_IllegalTaskAddedToServiceJob = -2147220909; + // + // Summary: + // You cannot cancel the job in its current state. + public static int Operation_InvalidCancelJobState = -2147220984; + // + // Summary: + // You cannot cancel the task in its current state. + public static int Operation_InvalidCancelTaskState = -2147220983; + public static int Operation_InvalidEmailAddress = -2147220690; + // + // Summary: + // The provided environment variable name is not valid. + public static int Operation_InvalidEnvironmentVarName = -2147220931; + // + // Summary: + // The provided environment variable value is not valid. + public static int Operation_InvalidEnvironmentVarValue = -2147220930; + // + // Summary: + // You cannot filter on property '{0}' for this type of object. + public static int Operation_InvalidFilterProperty = -2147220925; + // + // Summary: + // The job identifier does not identify an existing job in the scheduler. + public static int Operation_InvalidJobId = -2147220986; + public static int Operation_InvalidJobStateForNodeExclusion = -2147220884; + // + // Summary: + // Invalid specification for '{0}'. + public static int Operation_InvalidJobTemplateItemXml = -2147220927; + // + // Summary: + // The node identifier does not identify and existing node in the cluster. + public static int Operation_InvalidNodeId = -2147220978; + // + // Summary: + // The requested operation is not valid. + public static int Operation_InvalidOperation = -2147220977; + // + // Summary: + // The job template identifier is not valid. + public static int Operation_InvalidProfileId = -2147220933; + public static int Operation_InvalidPropForTaskType = -2147220908; + // + // Summary: + // The row enumeration identifier is not valid. + public static int Operation_InvalidRowEnumId = -2147220935; + // + // Summary: + // The task identifier does not identify and existing task in the scheduler. + public static int Operation_InvalidTaskId = -2147220985; + // + // Summary: + // The job already exists on the server. + public static int Operation_JobAlreadyCreatedOnServer = -2147220941; + public static int Operation_JobDeletionForbidden = -2147220912; + public static int Operation_JobHoldInvalidState = -2147220790; + public static int Operation_JobHoldUntilTooLong = -2147220783; + public static int Operation_JobInvalidHoldUntil = -2147220789; + // + // Summary: + // Job modification failed: {0}. + public static int Operation_JobModifyFailed = -2147220960; + // + // Summary: + // The job was not found on the server. + public static int Operation_JobNotCreatedOnServer = -2147220942; + public static int Operation_JobProgressOutOfRange = -2147220917; + // + // Summary: + // Unable to revert the job changes. + public static int Operation_JobRevertModifyFailed = -2147220959; + public static int Operation_JobTemplateRequiredValueMissing = -2147220878; + public static int Operation_JobTemplateValueInvalid = -2147220881; + public static int Operation_JobTemplateValueTooLarge = -2147220879; + public static int Operation_JobTemplateValueTooSmall = -2147220880; + public static int Operation_JobVersionMismatch = -2147220894; + // + // Summary: + // You must specify a job template name. + public static int Operation_MustProvideProfileName = -2147220934; + public static int Operation_NodeAlreadyExists = -2147220898; + public static int Operation_NodeIsNotOnAzure = -2147220692; + // + // Summary: + // The user does not have permission to use the job template. + public static int Operation_NoPermissionToUseProfile = -2147220967; + // + // Summary: + // No storage is currently defined for the property. + public static int Operation_NoTableDefinedForProperty = -2147220944; + // + // Summary: + // You do not have permission to change this job template. + public static int Operation_NotAllowedToChangeProfiles = -2147220970; + // + // Summary: + // The user is not allowed to create job templates. + public static int Operation_NotAllowedToCreateProfiles = -2147220972; + // + // Summary: + // The default job template cannot be deleted. + public static int Operation_NotAllowedToDeleteDefaultProfile = -2147220968; + // + // Summary: + // The user is not allowed to delete job templates. + public static int Operation_NotAllowedToDeleteProfiles = -2147220971; + // + // Summary: + // Cannot perform the operation because you are not connected to the server. + public static int Operation_NotConnectedToServer = -2147220936; + public static int Operation_ObjectInUse = -2147220882; + // + // Summary: + // The job must be in the configuration state in order to submit the job. + public static int Operation_OnlyConfigJobsCanBeSubmitted = -2147220990; + // + // Summary: + // You can submit the task only if the task is in the + // Microsoft.Hpc.Scheduler.Properties.TaskState.Configuring + // state. + public static int Operation_OnlyConfiguringTasksCanBeSubmitted = -2147220940; + // + // Summary: + // You can reconfigure only canceled or failed jobs. + public static int Operation_OnlyFailedCancelledJobsCanBeConfigured = -2147220982; + public static int Operation_OnlyFailedCancelledTasksCanBeConfigured = -2147220916; + // + // Summary: + // The user does not have permission to perform the operation. + public static int Operation_PermissionDenied = -2147220981; + // + // Summary: + // You cannot change HPC-defined environment variables. + public static int Operation_PreservedEnvironmentVariables = -2147220938; + public static int Operation_PriorityAndExPriCannotBeSetTogether = -2147220791; + // + // Summary: + // The job template item that you are trying to set already exists. + public static int Operation_ProfileItemAlreadyExists = -2147220975; + // + // Summary: + // The default value for the job template item is not within the allowed + // value + // range for the item. + public static int Operation_ProfileItemDefaultValueInvalid = -2147220952; + // + // Summary: + // The default values specified for the job template item {0} must include + // all + // of the required values for that item. Ensure that the default values + // include + // all the values in the Required Values list, and then try again. + public static int Operation_ProfileItemDefaultValueNotIncludeRequiredValue = -2147220953; + // + // Summary: + // The job template item that you are trying to set does not exist. + public static int Operation_ProfileItemDoesNotExist = -2147220976; + // + // Summary: + // The minimum staticraint for the job template item is greater than its + // maximum + // staticraint. + public static int Operation_ProfileItemMinGreaterThanMax = -2147220950; + // + // Summary: + // You must provide a default value for the job template item. + public static int Operation_ProfileItemMustProvideDefaultStringValue = -2147220951; + // + // Summary: + // Invalid template: The template item {0}'s default value, {1}, is larger + // than + // the default value of the related template item, {2} (default value: {3}). + // Correct this inconsistency and try again. + public static int Operation_ProfileItemRangeInconsistent_LeftDefaultGreaterThanRightDefault = -2147220956; + // + // Summary: + // Invalid template: The template item {0}'s maximum value, {1}, is larger + // than + // the maximum value of the related template item, {2} (maximum value: {3}). + // Correct this inconsistency and try again. + public static int Operation_ProfileItemRangeInconsistent_LeftMaxGreaterThanRightMax = -2147220957; + // + // Summary: + // Invalid template: The template item {0}'s minimum value, {1}, is larger + // than + // the minimum value of the related template item, {2} (minimum value: {3}). + // Correct this inconsistency and try again. + public static int Operation_ProfileItemRangeInconsistent_LeftMinGreaterThanRightMin = -2147220958; + // + // Summary: + // The value of the job template item cannot be less than zero. + public static int Operation_ProfileItemRangeInconsistent_ValueLessThanZero = -2147220955; + // + // Summary: + // The data type used to set or access the job template item does not match + // the data type of the item. + public static int Operation_ProfileItemTypeInconsistent = -2147220949; + // + // Summary: + // A job template with the specified name already exists. + public static int Operation_ProfileNameBeenUsed = -2147220964; + // + // Summary: + // The job template does not exist in the scheduler. + public static int Operation_ProfileNotFound = -2147220965; + // + // Summary: + // The property is read-only and cannot be set. + public static int Operation_PropertyIsstatic = -2147220989; + // + // Summary: + // The property name already exists. + public static int Operation_PropertyNameAlreadyExists = -2147220973; + public static int Operation_PropertyNameCannotBeEmpty = -2147220786; + public static int Operation_PropertyNotSupportedOnServerVersion = -2147220907; + // + // Summary: + // The value is too large. + public static int Operation_PropertyValueTooLargeForDatabase = -2147220939; + public static int Operation_ReconnectTimeout = -2147220780; + public static int Operation_SchedulerInCleanupMode = -2147220777; + public static int Operation_SchedulerInRecoverMode = -2147220788; + public static int Operation_SchedulerPrivilegeRequired = -2147220787; + public static int Operation_ServerIsBusy = -2147220897; + // + // Summary: + // You cannot change the property when the job is in the current state. + public static int Operation_SetInvalidPropUnderCertainState = -2147220943; + public static int Operation_TaskDeletionForbidden = -2147220911; + // + // Summary: + // Failed to modify the task. + public static int Operation_TaskModifyFailed = -2147220922; + public static int Operation_TaskNotCreatedOnServer = -2147220914; + public static int Operation_TaskOfTypeCannotBeReconfigured = -2147220915; + public static int Operation_TaskTypeAddedInWrongJobState = -2147220910; + public static int Operation_TaskTypeAndIsParametricIncompatible = -2147220905; + public static int Operation_TaskTypeNotSupportedOnServer = -2147220924; + public static int Operation_TooManyParametricSweepTasksPerJob = -2147220906; + // + // Summary: + // You cannot change the property when the node is in the current state. + public static int Operation_TryToChangePropertyInNodeState = -2147220945; + // + // Summary: + // You cannot modify the job property when the job is in its current state. + public static int Operation_TryToModifyInvalidProperty = -2147220962; + // + // Summary: + // You cannot modify the job property when the job is in its current state. + public static int Operation_TryToModifyInvalidStateJob = -2147220961; + // + // Summary: + // The task cannot be modified in its current state. + public static int Operation_TryToModifyInvalidStateTask = -2147220921; + // + // Summary: + // If the job is a backfill job, you cannot modify the job's runtime value + // when + // the job is running. + public static int Operation_TryToModifyRuntimeForRunningBackfillJob = -2147220963; + // + // Summary: + // The exception was not expected. + public static int Operation_UnexpectedException = -2147220892; + // + // Summary: + // The specified node group does not exist. + public static int Operation_UnknownNodeGroup = -2147220937; + public static int Operation_WindowsTaskSchedulerExecFailure = -2147220890; + public static int Operation_WindowsTaskSchedulerNotStarted = -2147220889; + public static int Operation_WindowsTaskSchedulerTimeout = -2147220891; + // + // Summary: + // The software license format is not valid. The valid format is + // application: + // numberoflicenses{,application:numberoflicenses. + public static int Operation_WrongLicenseFormat = -2147220947; + // + // Summary: + // The cluster does not contain a node that is capable of running a broker + // job. + public static int ResourceAssignement_FailedToFindBrokerNode = -2147219991; + // + // Summary: + // Failed to run the activation filter specified in the + // ActivationFilterProgram + // cluster parameter. + public static int ResourceAssignement_FailedToLaunchActivationFilter = -2147219990; + // + // Summary: + // There are no nodes available to run the task. + public static int ResourceAssignement_NodeUnavailable = -2147219989; + public static int ServiceBroker_ExitCode_End = -2147214992; + public static int ServiceBroker_ExitCode_Start = -2147215992; + // + // Summary: + // The BackendBinding value specified in the service broker's configuration + // file is not valid. Correct the binding and start a new session. + public static int ServiceBroker_InvalidBackendBinding = -2147215986; + // + // Summary: + // The configuration file for the service broker was not valid. + public static int ServiceBroker_InvalidConfig = -2147215989; + // + // Summary: + // The broker could not find the HPC environment information. + public static int ServiceBroker_MissingHpcEnvironmentInfomation = -2147215991; + // + // Summary: + // The service name or assembly name was not specified. + public static int ServiceBroker_MissingServiceInformation = -2147215990; + // + // Summary: + // The broker failed to open the service broker web service. + public static int ServiceBroker_OpenBrokerServiceFailure = -2147215987; + // + // Summary: + // The broker failed to open the service registration web service. + public static int ServiceBroker_OpenRegistrationServiceFailure = -2147215988; + // + // Summary: + // An unexpected exception occurred. Please see the broker execution log for + // details. + public static int ServiceBroker_UnexpectedError = -2147215972; + // + // Summary: + // Not able to find the service assembly file name in the service + // registration + // file. Please ensure that the service registration file has the correct + // format. + public static int ServiceHost_AssemblyFileNameNullOrEmpty = -2147216980; + // + // Summary: + // Failed to find the service assembly file. Please ensure that the assembly + // has been deployed and registered on the node. + public static int ServiceHost_AssemblyFileNotFound = -2147216991; + // + // Summary: + // Failed to load the service assembly. Please ensure that the security + // settings + // for the assembly are correct and that the service assembly information at + // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath) is + // correct. + public static int ServiceHost_AssemblyLoadingError = -2147216990; + // + // Summary: + // The service registration file is not in the correct format. Please use + // the + // service registration XML schema to ensure that the service registration + // file + // is in the correct format. + public static int ServiceHost_BadServiceRegistrationFileFormat = -2147216979; + // + // Summary: + // Failed to find the service contract interface from the service assembly. + // Please ensure that the contract information provided in the service + // registration + // is valid (see + // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath + // and Contract type). + public static int ServiceHost_ContractDiscoverError = -2147216989; + // + // Summary: + // The service registry is corrupt. + public static int ServiceHost_CorruptServiceRegistry = -2147216983; + public static int ServiceHost_ExitCode_End = -2147215992; + public static int ServiceHost_ExitCode_Start = -2147216992; + // + // Summary: + // Failed to register to the broker service. + public static int ServiceHost_FailedToRegisterLB = -2147216984; + public static int ServiceHost_IncorrectCommandLineParameter = -2147216978; + // + // Summary: + // Failed to find the contract implemented by the service type. + public static int ServiceHost_NoContractImplemented = -2147216986; + public static int ServiceHost_PrintCommandHelp = -2147216976; + public static int ServiceHost_ServiceConfigFileNameNotSpecified = -2147216977; + // + // Summary: + // Failed to open the service host. Please ensure that the NetTcp port + // sharing + // service is running and that the user has permission to use port sharing + // service, + // and that the firewall settings are correct. + public static int ServiceHost_ServiceHostFailedToOpen = -2147216985; + // + // Summary: + // The service name is not specified. + public static int ServiceHost_ServiceNameNotSpecified = -2147216982; + // + // Summary: + // Cannot locate the service registration file in both + // %CCP_HOME%ServiceRegistration + // folder and user specified central registration folder (if any). Please + // ensure + // that the service has been successfully deployed. + public static int ServiceHost_ServiceRegistrationFileNotFound = -2147216981; + // + // Summary: + // Failed to find the service type from the service assembly. Please ensure + // that the type information in the service registration is valid (see + // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath + // and ServiceType). + public static int ServiceHost_ServiceTypeDiscoverError = -2147216988; + // + // Summary: + // Failed to load the service type from the service assembly. + public static int ServiceHost_ServiceTypeLoadingError = -2147216987; + // + // Summary: + // An unexpected exception occurred. Please see the service host execution + // log + // for details. + public static int ServiceHost_UnexpectedException = -2147216972; + // + // Summary: + // The operation was a success. + public static int Success = 0; + // + // Summary: + // An unknown error occurred. + public static int UnknowError = -2147214990; + public static int UnknownError = -2147214990; + public static int Validation_AdminJobCannotHaveTaskDependency = -2147219882; + // + // Summary: + // A batch job cannot be a child job. + public static int Validation_BatchJobMustNotBeChildJob = -2147219904; + // + // Summary: + // Failed to compute the maximum resource requirement for the job. + public static int Validation_CalcJobMaxError = -2147219921; + // + // Summary: + // Failed to compute the minimum resource requirement for the job. + public static int Validation_CalcJobMinError = -2147219922; + // + // Summary: + // A child job cannot contain another child job. + public static int Validation_ChildJobContainsChildJob = -2147219908; + // + // Summary: + // The parent identifier included in the child job is different than its + // parent's + // actual identifier. + public static int Validation_ChildJobIdNotPairWithParentJobId = -2147219909; + // + // Summary: + // The child job must be a router job. + public static int Validation_ChildJobMustBeRouterJob = -2147219910; + // + // Summary: + // The child job is not valid. + public static int Validation_ChildJobNotValid = -2147219912; + // + // Summary: + // The cluster does not contain the required minimum number of resources. + public static int Validation_ClusterSizeLessThanMin = -2147219956; + public static int Validation_CombineSelectException = -2147219979; + // + // Summary: + // The credentials specified for this job are not able to log onto the + // cluster. + public static int Validation_CredentialCheckFailed = -2147219989; + // + // Summary: + // Failed to calculate task group level. + public static int Validation_FailToCalculateTaskGroupLevel = -2147219930; + // + // Summary: + // The contents of the Microsoft.Hpc.Scheduler.ISchedulerTask.DependsOn + // property + // is not valid. + public static int Validation_InvalidDependsOn = -2147219929; + public static int Validation_InvalidNodeCriteriaForJob = -2147219886; + public static int Validation_InvalidPropForTaskType = -2147219894; + // + // Summary: + // Job submission failed because the job submission filter application is + // not + // valid. Your cluster administrator should check that the submission filter + // is an executable binary file (".exe" file) or Windows command script + // (".cmd" + // file). + public static int Validation_InvalidSubmissionFilter = -2147219900; + // + // Summary: + // A node that the job requests does not support the job's job type. + public static int Validation_JobAskedNodeMustContainJobType = -2147219953; + // + // Summary: + // The job is missing the user name or password. + public static int Validation_JobMissUsernameOrPassword = -2147219988; + // + // Summary: + // The list of requested nodes does not contain a valid node. + public static int Validation_JobRequestedNodesContainZeroValidNode = -2147219967; + // + // Summary: + // The job requires a node that is not available. + public static int Validation_JobRequiredNodeNotAvailable = -2147219954; + // + // Summary: + // The list of nodes that the task requires must be included in the list of + // the nodes that the job requested. + public static int Validation_JobRequiredNodeNotInJobAskedNodes = -2147219955; + // + // Summary: + // The maximum number of resource units must be greater than zero. + public static int Validation_MaxLessThanOne = -2147219933; + // + // Summary: + // The maximum number of resource units cannot be less than zero. + public static int Validation_MaxLessThanZero = -2147219959; + // + // Summary: + // You must specify the maximum number of resource units that the job + // requires + // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMax property is + // false. + public static int Validation_MaxNotSpecifiedWhenAutoCalcMaxIsFalse = -2147219961; + // + // Summary: + // You must specify a maximum resource value for the task. + public static int Validation_MaxUndefined = -2147219947; + // + // Summary: + // The minimum value must be less than the maximum value. + public static int Validation_MinGreaterThanMax = -2147219958; + // + // Summary: + // The minimum number of resource units must be greater than zero. + public static int Validation_MinLessThanOne = -2147219934; + // + // Summary: + // The minimum number of resource units cannot be less than zero. + public static int Validation_MinLessThanZero = -2147219960; + // + // Summary: + // You must specify the minimum number of resource units that the job + // requires + // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMin property is + // false. + public static int Validation_MinNotSpecifiedWhenAutoCalcMinIsFalse = -2147219962; + // + // Summary: + // You must specify a minimum resource value for the task. + public static int Validation_MinUndefined = -2147219948; + // + // Summary: + // The task must specify a command to run. + public static int Validation_MissCommandLine = -2147219952; + public static int Validation_MultipleNodePrepTasksPerJob = -2147219897; + public static int Validation_MultipleNodeReleaseTasksPerJob = -2147219896; + // + // Summary: + // The computed resources for the job is less than the required number of + // resources. + public static int Validation_NodeListSizeLessThanMin = -2147219957; + // + // Summary: + // The node does not exist in the cluster. + public static int Validation_NodeNotExist = -2147219965; + // + // Summary: + // The cluster does not contain a node that supports the specified resource + // requirements for the job (for example, memory or core requirements). + // Please + // adjust your requirements and submit the job again. + public static int Validation_NoNodeFulfillsTheSelectionCriteria = -2147219966; + public static int Validation_OnlyNodePrepOrReleaseTasksInJob = -2147219895; + // + // Summary: + // The parent job must be a service job. + public static int Validation_ParentJobMustBeServiceJob = -2147219911; + // + // Summary: + // The parent job is not valid. + public static int Validation_ParentJobNotValid = -2147219907; + // + // Summary: + // The job template does not exist. + public static int Validation_ProfileNotExist = -2147219977; + // + // Summary: + // The property value is not within the allowed range of values as specified + // by the job template. + public static int Validation_PropertyOutOfRange = -2147219978; + // + // Summary: + // A property that requires a value as specified by the job template has not + // been set. + public static int Validation_RequiredPropertyNotSet = -2147219981; + // + // Summary: + // A router job cannot be a child job. + public static int Validation_RouterJobMustBeChildJob = -2147219906; + // + // Summary: + // To reserve resources for a job (when the job does not contain tasks and + // has + // requested that it run until canceled), you must specify the maximum and + // minimum + // resource values for the job -you cannot request that the scheduler + // compute + // the maximum and minimum resource values. + public static int Validation_RunUntilCanceledButAutoMinMaxSet = -2147219963; + // + // Summary: + // To reserve resources for a job (when the job does not contain tasks and + // has + // requested that it run until canceled), you must specify the maximum and + // minimum + // resource values for the job. + public static int Validation_RunUntilCanceledButMinMaxNotSpecified = -2147219964; + // + // Summary: + // A service job cannot be a child job. + public static int Validation_ServiceJobMustNotBeChildJob = -2147219905; + public static int Validation_ServiceTaskIsNotAlone = -2147219887; + // + // Summary: + // Job submission failed because the job submission filter application could + // not be found. Your cluster administrator should check that the submission + // filter is accessible from the head node of the cluster and the path to + // the + // submission filter is a fully-qualified (not relative) path name. + public static int Validation_SubmissionFilterDoesNotExist = -2147219901; + // + // Summary: + // The job failed to pass the job submission filter specified in the + // SubmissionFilterProgram + // cluster parameter. + public static int Validation_SubmissionFilterFailed = -2147219902; + public static int Validation_SubmissionFilterInvalidJobTerm = -2147219883; + public static int Validation_SubmissionFilterTimeout = -2147219884; + public static int Validation_TargetResourceCountLessThanMin = -2147219888; + public static int Validation_TargetResourceCountMoreThanMax = -2147219889; + // + // Summary: + // The task must specify the same resource unit as the job. + public static int Validation_TaskAllocUnitNotSameWithJob = -2147219949; + // + // Summary: + // The dependency list for multiple tasks creates a circular dependency. + public static int Validation_TaskDependenciesContainCycle = -2147219931; + // + // Summary: + // The minimum and maximum resource requirements cannot be computed for a + // job + // with exclusive access to the nodes. You must specify the minimum and + // maximum + // resource values and resubmit the job. + public static int Validation_TaskExclusiveWhileJobAutoMinMaxEnabled = -2147219938; + // + // Summary: + // The task can run exclusively on a node only if the job specifies that it + // must run exclusively on the node. + public static int Validation_TaskExclusiveWhileJobNot = -2147219943; + // + // Summary: + // The task failed because the scheduler could not validate its parent job. + // Correct the validation error on the parent job and resubmit the job. + public static int Validation_TaskFailedOnJobValidationFault = -2147219936; + // + // Summary: + // The task specifies a list of dependent tasks but the task does not + // specify + // a name value for itself; each dependent task and the task specifying the + // dependency must include a name value. + public static int Validation_TaskHasDependOnButNoName = -2147219928; + // + // Summary: + // The task cannot specify required nodes when the job has requested that + // the + // scheduler compute the required resources. + public static int Validation_TaskHasRequiredNodesWhileJobAutoMinMaxEnabled = -2147219937; + // + // Summary: + // The increment value for a parametric task must be greater than or equal + // to + // 1. + public static int Validation_TaskIncrementValueLessThanZero = -2147219899; + // + // Summary: + // The start value for a parametric task cannot be greater than end value. + public static int Validation_TaskInvalidParametricSweep = -2147219898; + // + // Summary: + // The maximum resource value for the task must be less than that of the + // job. + public static int Validation_TaskMaxGreaterThanJobMax = -2147219945; + // + // Summary: + // The minimum resource value for the task must be less than that of the + // job. + public static int Validation_TaskMinGreaterThanJobMin = -2147219946; + // + // Summary: + // The minimum resource value for the task must be less than its maximum The + // minimum resource value for the task must be less than that of the job + // value. + public static int Validation_TaskMinGreaterThanTaskMax = -2147219944; + public static int Validation_TaskNodeReleaseDisabled = -2147219893; + public static int Validation_TaskNodeReleaseExceedsMaxRunTime = -2147219892; + // + // Summary: + // You have exceeded the number of times that a task can be queued again. + // The + // TaskRetryCount cluster parameter specifies the maximum number of times + // that + // a task can be queued again. + public static int Validation_TaskRequeuedTooManyTimes = -2147219951; + public static int Validation_TaskRequiredNodeNotAllocatedToRunningJob = -2147219885; + // + // Summary: + // The job requires a node that is not available. + public static int Validation_TaskRequiredNodeNotAvailable = -2147219940; + // + // Summary: + // The list of nodes that the task requires must be included in the list of + // the nodes that the job requested. + public static int Validation_TaskRequiredNodeNotInJobAskedNodes = -2147219942; + // + // Summary: + // The task specifies more required nodes than the job's specified maximum + // resource + // usage. + public static int Validation_TaskRequiredNodeOutOfJobMaximumResource = -2147219939; + // + // Summary: + // The run-time value for the task is greater than the length of time that + // the + // job is scheduled to remain running. + public static int Validation_TaskRuntimeGreaterThanJob = -2147219941; + public static int Validation_TaskTypeAddedInWrongJobState = -2147219891; + // + // Summary: + // The task failed validation. + public static int Validation_TaskValidationFailed = -2147219935; + public static int Validation_TooManyParametricInstances = -2147219890; + // + // Summary: + // You cannot queue the task again because the task is marked to run only + // one + // time. + public static int Validation_TryToRequeueNonRerunnableTask = -2147219950; + // + // Summary: + // The depends on list is ambiguous because multiple tasks specify the same + // name. + public static int Validation_TwoTasksWithSameNameDifferentGroup = -2147219932; + // + // Summary: + // An unexpected exception occurred while validating the job. + public static int Validation_UnexpectedExceptionWhenValidating = -2147219991; + public static int Validation_Unknown = -2147219990; + // + // Summary: + // An unexpected exception occurred while calling ETW. + public static int ERROR_INVALIDFLAG = -2147220001; + public static int ERROR_NULLMSG = -2147220002; + public static int ERROR_INVALIDMESSAGEID = -2147220003; + public static int ERROR_INVALIDDISPATCHID = -2147220004; + public static int ERROR_DLLNOTEXIST = -2147220005; + public static int ERROR_REGISTRATIONFAILED = -2147220006; + public static int ERROR_WRITEEVENTFAILED = -2147220007; + + // Summary: + // Defines the category of errors into which the + // Microsoft.Hpc.Scheduler.Properties.ErrorCode + // codes are grouped. + public enum Category + { + // Summary: + // An error occurred while performing an operation (for example, the + // user tried + // to delete a job template but they do not have permissions to delete + // templates). + // This enumeration member represents a value of 0. + OperationError, + // + // Summary: + // The error occurred while validating the job or task before it ran. + // This enumeration + // member represents a value of 1. + ValidationError, + // + // Summary: + // The error occurred while assigning resources to the job or task. This + // enumeration + // member represents a value of 2. + ResourceAssignmentError, + // + // Summary: + // The error occurred while executing the job or task. This enumeration + // member + // represents a value of 3. + ExecutionError, + // + // Summary: + // Includes errors related to starting service or broker jobs. This + // enumeration + // member represents a value of 4. + Other, + } + +} diff --git a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java index 9808871..b6e8cad 100644 --- a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java @@ -1,879 +1,977 @@ -//------------------------------------------------------------------------------ -// -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ - -package com.microsoft.hpc.scheduler.session; - -import java.net.SocketTimeoutException; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import javax.xml.ws.Service; -import javax.xml.ws.WebServiceException; - -import com.microsoft.hpc.BrokerClientStatus; - -/** - * Used to communicate with the broker to send and receive messages - * - * @see #sendRequest(Object) - * @see #endRequests() - * @see #pullResponses(Class) - */ -public class BrokerClient -{ - /** - * Store the count of the sent messages - */ - private volatile AtomicInteger sendCount = new AtomicInteger(); - - private volatile AtomicInteger uncommitCount = new AtomicInteger(); - - // private CallbackManager callbackManager - // Callbacks are not supported in Java - - // private int defaultResponsesTimeout = 60 * 1000; - // PullResponses uses a built in timeout of 1 minute - - private volatile boolean isBrokerDown = false; - - /** - * Reference to Controller client. Java Changes: Changed from - * BrokerControllerClient. Implemented as IBrokerController in Java - */ - private CxfBrokerControllerClient controllerClient; - - /** - * Reference to the Session object passed to the client - */ - private SessionBase session; - - /** - * The string of the clientid - */ - private String clientId; - - /** - * Stores the scheme - */ - private TransportScheme scheme; - - /** - * Default timeout when waiting for new requests to reach broker - */ - private int timeoutThrottlingMS = 60 * 1000; - - // The following fields are only necessary for the java implementation. - /** - * Specifies the default timeout for EOM call - */ - final public int DEFAULT_TIMEOUT = 60000; - - // / - // / Default timeout when waiting for new requests to reach broker - // / - final int defaultSendTimeout = 60 * 1000; // Default to 1 min - - /** - * The client proxy to communicate to broker endpoint - */ - private CxfBrokerClient client; - - /** - * if we called endrequest - */ - private boolean isEndRequest = false; - - /** - * if this client is disposed - */ - private boolean isDisposed = false; - - /** - * Creates instances of the BrokerClient - * - * @param session - * Session or DurableSession - * @param service - * Service class to instantiate - */ - public BrokerClient(SessionBase session, Class service) { - Utility.throwIfNull(session, "session"); - - init(session, null, null, service); - } - - /** - * Creates instances of the BrokerClient - * - * @param clientid - * String identity of the client - * @param session - * Session or DurableSession - * @param service - * Service class to instantiate - */ - public BrokerClient(String clientid, SessionBase session, - Class service) { - Utility.throwIfNull(session, "session"); - Utility.throwIfNullOrEmpty(clientid, "clientid"); - Utility.throwIfTooLong(clientid.length(), "clientid", 128, - SR.v("ClientIdTooLong")); - - init(session, null, clientid, service); - } - - /** - * Creates instances of the BrokerClient - * - * @param session - * Session or DurableSession - * @param bindingConfigName - * Binding configuration to use to connect to broker - * @param service - * Service class to instantiate - */ - public BrokerClient(SessionBase session, String bindingConfigName, - Class service) { - Utility.throwIfNull(session, "session"); - - init(session, bindingConfigName, null, service); - } - - /** - * Creates instances of the BrokerClient - * - * @param clientid - * String identity of the client - * @param session - * Session or DurableSession - * @param bindingConfigName - * Binding configuration to use to connect to the broker - * @param service - * Service class to instantiate - */ - public BrokerClient(String clientid, SessionBase session, - String bindingConfigName, Class service) { - Utility.throwIfNull(session, "session"); - Utility.throwIfNullOrEmpty(clientid, "clientid"); - Utility.throwIfTooLong(clientid.length(), "clientid", 128, - SR.v("ClientIdTooLong")); - - init(session, bindingConfigName, clientid, service); - } - - /** - * Initializes BrokerClient session - * - * @param session - * Session or DurableSession - * @param bindingConfigName - * Binding configuration to use to connect to the broker - * @param _clientId - * String identity of the client - * @param service - * Service class to instantiate - * @throws Exception - */ - private void init(SessionBase session, String bindingConfigName, - String _clientId, Class service) { - // printSessionInfo(session.getInfo()); - if (_clientId == null) { - clientId = ""; - } else { - Utility.throwIfInvalidClientId(_clientId); - clientId = _clientId; - } - - this.session = session; - - String epr = session.getInfo().getBrokerEpr().getValue().getString() - .get(1); - client = new CxfBrokerClient(session._username, - session._password, epr, service); - - controllerClient = CreateControllerClient(session); - - // Try to get the scheme from session info - this.scheme = TransportScheme.valueOf((session.getInfo() - .getTransportScheme().get(0))); - - // Set the scheme - if (this.scheme != TransportScheme.Http) { - throw new UnsupportedOperationException(); - } - - // If serviceOperationTimeout is specified, derive default timeouts for - // EndRequest - if (this.session.getInfo().getServiceOperationTimeout() != null - && this.session.getInfo().getServiceOperationTimeout() > 0) { - this.timeoutThrottlingMS = this.session.getInfo() - .getServiceOperationTimeout(); - } else { - this.timeoutThrottlingMS = Integer.MAX_VALUE; - } - client.setTimeout(this.timeoutThrottlingMS); - - sendCount.set(0); - uncommitCount.set(0); - } - - private CxfBrokerControllerClient CreateControllerClient(SessionBase session) { - String controllerEpr = session.getInfo().getControllerEpr().getValue() - .getString().get(1); - - if (session.getInfo().isSecure()) { - return new CxfBrokerControllerClient(session._username, - session._password, controllerEpr); - } else { - return new CxfBrokerControllerClient(null, null, controllerEpr); - } - } - - /** - * Send typed message to broker - * - * @param - * Typed message type - * @param request - * Typed message to send - * @throws SessionException - * @throws TimeoutException - * @see {@link HpcJava#createRequest(Class, Object...)} - */ - public void sendRequest(TMessage request) - throws SessionException, SocketTimeoutException { - sendRequest(request, ""); - } - - /** - * Send typed messages with user data to broker - * - * @param - * Typed message type - * @param request - * Typed message to send - * @param userData - * User data (will be converted to String because of Java - * limitations) - * @throws SessionException - * @throws TimeoutException - * @see {@link HpcJava#createRequest(Class, Object...)} - */ - public void sendRequest(Object request, Object userData) - throws SessionException, SocketTimeoutException { - sendRequest(request, userData, defaultSendTimeout); - } - - /** - * Send typed messages with user data to broker - * - * @param - * Typed message type - * @param request - * Typed message to send - * @param userData - * User data (will be converted to String because of Java - * limitations) - * @param timeout - * send timeout - * @throws SessionException - * @throws TimeoutException - * @see {@link HpcJava#createRequest(Class, Object...)} - */ - public void sendRequest(Object request, Object userData, int timeout) - throws SessionException, SocketTimeoutException { - Utility.throwIfNull(request, "request"); - Utility.throwIfNull(userData, "userData"); - if (timeout < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (isEndRequest) - throw new IllegalStateException(); - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - try { - client.SendMessage(request, this.clientId, userData, timeout); - sendCount.incrementAndGet(); - uncommitCount.incrementAndGet(); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v("ClientTimeout")); - } else { - throw new SessionException(we); - } - } - } - - /** - * Send typed messages with user data to broker - * - * @param - * Typed message type - * @param request - * Typed message to send - * @param userData - * User data (will be converted to String because of Java - * limitations) - * @param action - * Action of typed message if type is ambiguous - * @throws SessionException - * @throws TimeoutException - * @see {@link HpcJava#createRequest(Class, Object...)} - */ - public void sendRequest(Object request, Object userData, String action) - throws SessionException, SocketTimeoutException { - sendRequest(request, userData, action, defaultSendTimeout); - } - - /** - * Send typed messages with user data to broker - * - * @param - * Typed message type - * @param request - * Typed message to send - * @param userData - * User data (will be converted to String because of Java - * limitations) - * @param action - * Action of typed message if type is ambiguous - * @param timeout - * send timeout - * @throws SessionException - * @throws TimeoutException - * @see {@link HpcJava#createRequest(Class, Object...)} - */ - public void sendRequest(Object request, Object userData, String action, - int timeout) throws SessionException, SocketTimeoutException { - Utility.throwIfNull(request, "request"); - Utility.throwIfNull(userData, "userData"); - Utility.throwIfNull(action, "action"); - if (timeout < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (isEndRequest) - throw new IllegalStateException(); - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - try { - client.SendMessage(request, this.clientId, userData, action, - timeout); - sendCount.incrementAndGet(); - uncommitCount.incrementAndGet(); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v("ClientTimeout")); - } else { - throw new SessionException(we); - } - } - } - - /** - * Get the response from the server. the function will return an iterable - * instance which can be used to do for each. - * - * the iterator is able to move next until it hits end of message flag. - * - * @param - * @param message - * @return - * @throws SessionException - * - */ - public Iterable> getResponses( - Class message) throws SessionException { - return getResponses(message, 0); - } - - /** - * Get the response from the server. the function will return an iterable - * instance which can be used to do for each. - * - * the iterator is able to move next until it hits end of message flag. - * - * @param - * @param message - * @return - * @throws SessionException - * - */ - public Iterable> getResponses( - Class message, int timeoutMilliseconds) - throws SessionException { - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - return new ResponseList>(message, - CreateControllerClient(session), - this.client.getRequestAction(message), this.clientId, - timeoutMilliseconds); - } - - /** - * Get the response from the server. the function will return an iterable - * instance which can be used to do for each. - * - * the iterator is able to move next until it hits end of message flag. - * - * @param - * @param message - * @return - * @throws SessionException - * - */ - public Iterable> getResponses() - throws SessionException { - return getResponses(0); - } - - /** - * Get the response from the server. the function will return an iterable - * instance which can be used to do for each. - * - * the iterator is able to move next until it hits end of message flag. - * - * @param - * @param message - * @return - * @throws SessionException - * - */ - public Iterable> getResponses(int timeoutMilliseconds) - throws SessionException { - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - Map> t = this.client.getResponseTypeMapping(); - return new ResponseList>(t, - CreateControllerClient(session), this.clientId, - timeoutMilliseconds); - } - - /** - * Set the response handler to handle the response when it is arrived - * - * @param - * @param message - * @param responselistener - */ - public void setResponseHandler(final Class message, - final ResponseListener responselistener) { - Utility.throwIfNull(responselistener, "responselistener"); - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - Runnable runnable = new Runnable() { - public void run() { - Iterable> responses; - try { - responses = getResponses(message); - for (BrokerResponse r : responses) { - responselistener.responseReturned(r); - } - responselistener.endOfMessage(); - } catch (SessionException e) { - responselistener.raiseError(e); - } catch (RuntimeException e) { - if (e.getCause() == null) - responselistener.raiseError(e); - else - responselistener.raiseError((Exception)e.getCause()); - } - } - }; - Thread thread = new Thread(runnable); - thread.start(); - } - - /** - * Set the response handler to handle the response when it is arrived - * - * @param - * @param message - * @param responselistener - */ - public void setResponseHandler(final Class message, - final ResponseListener responselistener, - final int timeoutMilliseconds) { - Utility.throwIfNull(responselistener, "responselistener"); - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - Runnable runnable = new Runnable() { - public void run() { - Iterable> responses; - try { - responses = getResponses(message, timeoutMilliseconds); - for (BrokerResponse r : responses) { - responselistener.responseReturned(r); - } - responselistener.endOfMessage(); - } catch (SessionException e) { - responselistener.raiseError(e); - } catch (RuntimeException e) { - if (e.getCause() == null) - responselistener.raiseError(e); - else - responselistener.raiseError((Exception) e.getCause()); - } - } - }; - Thread thread = new Thread(runnable); - thread.start(); - } - - /** - * Set the response handler to handle the response when it is arrived - * - * @param - * @param message - * @param responselistener - */ - public void setResponseHandler( - final ResponseListener responselistener) { - Utility.throwIfNull(responselistener, "responselistener"); - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - Runnable runnable = new Runnable() { - public void run() { - Iterable> responses; - try { - responses = getResponses(); - for (BrokerResponse r : responses) { - responselistener.responseReturned(r); - } - responselistener.endOfMessage(); - } catch (SessionException e) { - responselistener.raiseError(e); - } catch (RuntimeException e) { - if (e.getCause() == null) - responselistener.raiseError(e); - else - responselistener.raiseError((Exception) e.getCause()); - } - } - }; - Thread thread = new Thread(runnable); - thread.start(); - } - - /** - * Set the response handler to handle the response when it is arrived - * - * @param - * @param message - * @param responselistener - */ - public void setResponseHandler( - final ResponseListener responselistener, - final int timeoutMilliseconds) { - Utility.throwIfNull(responselistener, "responselistener"); - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - Runnable runnable = new Runnable() { - public void run() { - Iterable> responses; - try { - responses = getResponses(timeoutMilliseconds); - for (BrokerResponse r : responses) { - responselistener.responseReturned(r); - } - responselistener.endOfMessage(); - } catch (SessionException e) { - responselistener.raiseError(e); - } catch (RuntimeException e) { - if (e.getCause() == null) - responselistener.raiseError(e); - else - responselistener.raiseError((Exception) e.getCause()); - } - } - }; - Thread thread = new Thread(runnable); - thread.start(); - } - - /** - * Handles cleanup of the BrokerClient instance. Semi-Equivalent to Dispose - * in C# - */ - protected void finalize() { - dispose(); - } - - /** - * Handles cleanup of the BrokerClient instance - */ - protected void dispose() { - if (this.isDisposed) - return; - - if (this.controllerClient != null) { - this.controllerClient.destory(); - this.controllerClient = null; - } - this.session = null; - this.isDisposed = true; - } - - /** - * Commits requests to broker's store. - * - * @param timeoutMilliseconds - * timeout before exception - * @throws TimeoutException - * @throws SessionException - * @throws InvalidOperationException - */ - public void endRequests(int timeoutMilliseconds) - throws SocketTimeoutException, SessionException { - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - if (this.sendCount.get() == 0) { - throw new IllegalStateException(SR.v("InvalidEndRequestsCount")); - } - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - // Pick the larger of the two timeouts to ensure operationTimeout is - // long enough - int largerTimeout = this.timeoutThrottlingMS > timeoutMilliseconds ? this.timeoutThrottlingMS - : timeoutMilliseconds; - - int count = uncommitCount.getAndSet(0); - try { - if (timeoutMilliseconds == 0) { - controllerClient.setTimeout(0); - timeoutMilliseconds = Integer.MAX_VALUE; - } else - controllerClient.setTimeout(largerTimeout); - - controllerClient.endRequests(count, clientId, largerTimeout, - timeoutMilliseconds); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } - isEndRequest = true; - } - - /** - * Flush requests to broker's store. - * - * @throws SessionException - * @throws TimeoutException - * @throws InvalidOperationException - */ - public void flush() throws SocketTimeoutException, SessionException { - flush(DEFAULT_TIMEOUT); - } - - /** - * Flush requests to broker's store. - * - * @param timeoutMilliseconds - * timeout before exception - * @throws TimeoutException - * @throws SessionException - */ - public void flush(int timeoutMilliseconds) throws SocketTimeoutException, - SessionException { - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - if (isDisposed) { - throw new IllegalStateException(SR.v("ClientAlreadyClosed")); - } - - if (this.sendCount.get() == 0) { - return; - } - - // Pick the larger of the two timeouts to ensure operationTimeout is - // long enough - int largerTimeout = this.timeoutThrottlingMS > timeoutMilliseconds ? this.timeoutThrottlingMS - : timeoutMilliseconds; - - int count = uncommitCount.getAndSet(0); - try { - if (timeoutMilliseconds == 0) { - controllerClient.setTimeout(0); - timeoutMilliseconds = -1; - } else - controllerClient.setTimeout(largerTimeout); - - controllerClient.flush(count, clientId, largerTimeout, - timeoutMilliseconds); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } - } - - /** - * Commits requests to broker's store. Default timeout is defined above. - * - * @throws SessionException - * @throws TimeoutException - * @throws InvalidOperationException - */ - public void endRequests() throws SocketTimeoutException, SessionException { - endRequests(DEFAULT_TIMEOUT); - } - - /** - * Closes broker connections - * - * @throws SessionException - * @throws TimeoutException - */ - public void close() throws SocketTimeoutException, SessionException { - close(false, Constant.PurgeTimeoutMS); - } - - /** - * Close the connection and purge the results to the server - * - * @param purge - * if true, the result will be removed in the broker - * @throws SessionException - * @throws TimeoutException - */ - public void close(Boolean purge) throws SocketTimeoutException, - SessionException { - close(purge, Constant.PurgeTimeoutMS); - } - - /** - * Close the connection and purge the results in the server - * - * @param purge - * if true, the result will be removed in the broker - * @param timeoutMilliseconds - * the timeout for the response if purge - * @throws TimeoutException - * @throws SessionException - */ - public void close(Boolean purge, int timeoutMilliseconds) - throws SocketTimeoutException, SessionException { - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (isDisposed) { - return; - } - - if (purge) { - try { - controllerClient.setTimeout(timeoutMilliseconds); - controllerClient.purge(clientId); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", - timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } - } - dispose(); - } - - public BrokerClientStatus getStatus() throws SessionException { - return controllerClient.GetStatus(this.clientId); - } - - public int getRequestCount() throws SessionException { - return controllerClient.getRequestsCount(this.clientId); - } -} +//------------------------------------------------------------------------------ +// +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +package com.microsoft.hpc.scheduler.session; + +import java.net.SocketTimeoutException; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; +import javax.xml.ws.Service; +import javax.xml.ws.WebServiceException; + +import com.microsoft.hpc.BrokerClientStatus; + +/** + * Used to communicate with the broker to send and receive messages + * + * @see #sendRequest(Object) + * @see #endRequests() + * @see #pullResponses(Class) + */ +public class BrokerClient +{ + /** + * Store the count of the sent messages + */ + private volatile AtomicInteger sendCount = new AtomicInteger(); + + private volatile AtomicInteger uncommitCount = new AtomicInteger(); + + // private CallbackManager callbackManager + // Callbacks are not supported in Java + + // private int defaultResponsesTimeout = 60 * 1000; + // PullResponses uses a built in timeout of 1 minute + + private volatile boolean isBrokerDown = false; + + /** + * Reference to Controller client. Java Changes: Changed from + * BrokerControllerClient. Implemented as IBrokerController in Java + */ + private CxfBrokerControllerClient controllerClient; + + /** + * Reference to the Session object passed to the client + */ + private SessionBase session; + + /** + * The string of the clientid + */ + private String clientId; + + /** + * Stores the scheme + */ + private TransportScheme scheme; + + /** + * Default timeout when waiting for new requests to reach broker + */ + private int timeoutThrottlingMS = 60 * 1000; + + // The following fields are only necessary for the java implementation. + /** + * Specifies the default timeout for EOM call + */ + final public int DEFAULT_TIMEOUT = 60000; + + // / + // / Default timeout when waiting for new requests to reach broker + // / + final int defaultSendTimeout = 60 * 1000; // Default to 1 min + + /** + * The client proxy to communicate to broker endpoint + */ + private CxfBrokerClient client; + + /** + * if we called endrequest + */ + private boolean isEndRequest = false; + + /** + * if this client is disposed + */ + private boolean isDisposed = false; + + /** + * if the broker response handler is configured. + * Only one response handler is allowed + */ + private Boolean isHandlerSet = false; + + + /** + * Creates instances of the BrokerClient + * + * @param session + * Session or DurableSession + * @param service + * Service class to instantiate + */ + public BrokerClient(SessionBase session, Class service) { + Utility.throwIfNull(session, "session"); + + init(session, null, null, service); + } + + /** + * Creates instances of the BrokerClient + * + * @param clientid + * String identity of the client + * @param session + * Session or DurableSession + * @param service + * Service class to instantiate + */ + public BrokerClient(String clientid, SessionBase session, + Class service) { + Utility.throwIfNull(session, "session"); + Utility.throwIfNullOrEmpty(clientid, "clientid"); + Utility.throwIfTooLong(clientid.length(), "clientid", 128, + SR.v("ClientIdTooLong")); + + init(session, null, clientid, service); + } + + /** + * Creates instances of the BrokerClient + * + * @param session + * Session or DurableSession + * @param bindingConfigName + * Binding configuration to use to connect to broker + * @param service + * Service class to instantiate + */ + public BrokerClient(SessionBase session, String bindingConfigName, + Class service) { + Utility.throwIfNull(session, "session"); + + init(session, bindingConfigName, null, service); + } + + /** + * Creates instances of the BrokerClient + * + * @param clientid + * String identity of the client + * @param session + * Session or DurableSession + * @param bindingConfigName + * Binding configuration to use to connect to the broker + * @param service + * Service class to instantiate + */ + public BrokerClient(String clientid, SessionBase session, + String bindingConfigName, Class service) { + Utility.throwIfNull(session, "session"); + Utility.throwIfNullOrEmpty(clientid, "clientid"); + Utility.throwIfTooLong(clientid.length(), "clientid", 128, + SR.v("ClientIdTooLong")); + + init(session, bindingConfigName, clientid, service); + } + + /** + * Initializes BrokerClient session + * + * @param session + * Session or DurableSession + * @param bindingConfigName + * Binding configuration to use to connect to the broker + * @param _clientId + * String identity of the client + * @param service + * Service class to instantiate + * @throws Exception + */ + private void init(SessionBase session, String bindingConfigName, + String _clientId, Class service) { + // printSessionInfo(session.getInfo()); + if (_clientId == null) { + clientId = ""; + } else { + Utility.throwIfInvalidClientId(_clientId); + clientId = _clientId; + } + + this.session = session; + + + // Try to get the scheme from session info + this.scheme = TransportScheme.valueOf((session.getInfo() + .getTransportScheme().get(0))); + + controllerClient = CreateControllerClient(session); + + // Set the scheme + if (this.scheme != TransportScheme.Http && + this.scheme != TransportScheme.Custom) { + throw new UnsupportedOperationException(); + } + + String epr = ""; + if(this.scheme == TransportScheme.Http) { + epr = session.getInfo().getBrokerEpr().getValue().getString().get(1); + } else if (this.scheme == TransportScheme.Custom) { + epr = session.getInfo().getBrokerEpr().getValue().getString().get(2); + } + + client = new CxfBrokerClient(session._username, + session._password, epr, service); + + // If serviceOperationTimeout is specified, derive default timeouts for + // EndRequest + if (this.session.getInfo().getServiceOperationTimeout() != null + && this.session.getInfo().getServiceOperationTimeout() > 0) { + this.timeoutThrottlingMS = this.session.getInfo() + .getServiceOperationTimeout(); + } else { + this.timeoutThrottlingMS = Integer.MAX_VALUE; + } + client.setTimeout(this.timeoutThrottlingMS); + + sendCount.set(0); + uncommitCount.set(0); + } + + private CxfBrokerControllerClient CreateControllerClient(SessionBase session) { + String controllerEpr = ""; + if(this.scheme == TransportScheme.Http) { + controllerEpr = session.getInfo().getControllerEpr().getValue().getString().get(1); + } else if (this.scheme == TransportScheme.Custom) { + controllerEpr = session.getInfo().getControllerEpr().getValue().getString().get(2); + } + + if (session.getInfo().isSecure()) { + return new CxfBrokerControllerClient(session._username, + session._password, controllerEpr); + } else { + return new CxfBrokerControllerClient(null, null, controllerEpr); + } + } + + /** + * Send typed message to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(TMessage request) + throws SessionException, SocketTimeoutException { + sendRequest(request, "", UUID.randomUUID()); + } + + /** + * Send typed message to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param messageId + * messageId of the message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(TMessage request, UUID messageId) + throws SessionException, SocketTimeoutException { + sendRequest(request, "", messageId); + } + + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData) + throws SessionException, SocketTimeoutException { + sendRequest(request, userData, defaultSendTimeout, UUID.randomUUID()); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param messageId + * messageId of the message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, UUID messageId) + throws SessionException, SocketTimeoutException { + sendRequest(request, userData, defaultSendTimeout, messageId); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param timeout + * send timeout + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, int timeout) + throws SessionException, SocketTimeoutException { + sendRequest(request, userData, timeout, UUID.randomUUID()); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param timeout + * send timeout + * @param messageId + * messageId of the message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, int timeout, UUID messageId) + throws SessionException, SocketTimeoutException { + Utility.throwIfNull(request, "request"); + Utility.throwIfNull(userData, "userData"); + Utility.throwIfNull(messageId, "messageId"); + if (timeout < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (isEndRequest) + throw new IllegalStateException(); + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + try { + client.SendMessage(request, this.clientId, userData, timeout, messageId); + sendCount.incrementAndGet(); + uncommitCount.incrementAndGet(); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v("ClientTimeout")); + } else { + throw new SessionException(we); + } + } + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param action + * Action of typed message if type is ambiguous + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, String action) + throws SessionException, SocketTimeoutException { + sendRequest(request, userData, action, defaultSendTimeout, UUID.randomUUID()); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param action + * Action of typed message if type is ambiguous + * @param messageId + * messageId of message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, String action, UUID messageId) + throws SessionException, SocketTimeoutException { + sendRequest(request, userData, action, defaultSendTimeout, messageId); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param action + * Action of typed message if type is ambiguous + * @param timeout + * send timeout + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, String action, + int timeout) throws SessionException, SocketTimeoutException { + sendRequest(request, userData, action, timeout, UUID.randomUUID()); + } + + /** + * Send typed messages with user data to broker + * + * @param + * Typed message type + * @param request + * Typed message to send + * @param userData + * User data (will be converted to String because of Java + * limitations) + * @param action + * Action of typed message if type is ambiguous + * @param timeout + * send timeout + * @param messageId + * messageId of message to send + * @throws SessionException + * @throws TimeoutException + * @see {@link HpcJava#createRequest(Class, Object...)} + */ + public void sendRequest(Object request, Object userData, String action, + int timeout, UUID messageId) throws SessionException, SocketTimeoutException { + Utility.throwIfNull(request, "request"); + Utility.throwIfNull(userData, "userData"); + Utility.throwIfNull(action, "action"); + Utility.throwIfNull(messageId, "messageId"); + if (timeout < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (isEndRequest) + throw new IllegalStateException(); + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + try { + client.SendMessage(request, this.clientId, userData, action, + timeout, messageId); + sendCount.incrementAndGet(); + uncommitCount.incrementAndGet(); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v("ClientTimeout")); + } else { + throw new SessionException(we); + } + } + } + + /** + * Get the response from the server. the function will return an iterable + * instance which can be used to do for each. + * + * the iterator is able to move next until it hits end of message flag. + * + * @param + * @param message + * @return + * @throws SessionException + * + */ + public Iterable> getResponses( + Class message) throws SessionException { + return getResponses(message, 0); + } + + /** + * Get the response from the server. the function will return an iterable + * instance which can be used to do for each. + * + * the iterator is able to move next until it hits end of message flag. + * + * @param + * @param message + * @return + * @throws SessionException + * + */ + public Iterable> getResponses( + Class message, int timeoutMilliseconds) + throws SessionException { + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + return new ResponseList>(message, + CreateControllerClient(session), + this.client.getRequestAction(message), this.clientId, + timeoutMilliseconds); + } + + /** + * Get the response from the server. the function will return an iterable + * instance which can be used to do for each. + * + * the iterator is able to move next until it hits end of message flag. + * + * @param + * @param message + * @return + * @throws SessionException + * + */ + public Iterable> getResponses() + throws SessionException { + return getResponses(0); + } + + /** + * Get the response from the server. the function will return an iterable + * instance which can be used to do for each. + * + * the iterator is able to move next until it hits end of message flag. + * + * @param + * @param message + * @return + * @throws SessionException + * + */ + public Iterable> getResponses(int timeoutMilliseconds) + throws SessionException { + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + Map> t = this.client.getResponseTypeMapping(); + return new ResponseList>(t, + CreateControllerClient(session), this.clientId, + timeoutMilliseconds); + } + + /** + * Set the response handler to handle the response when it is arrived + * + * @param + * @param message + * @param responselistener + */ + public void setResponseHandler(final Class message, + final ResponseListener responselistener) { + setResponseHandler(message, responselistener, 0); + } + + /** + * Set the response handler to handle the response when it is arrived + * + * @param + * @param message + * @param responselistener + */ + public void setResponseHandler(final Class message, + final ResponseListener responselistener, + final int timeoutMilliseconds) { + Utility.throwIfNull(responselistener, "responselistener"); + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + Runnable runnable = new Runnable() { + public void run() { + Iterable> responses; + try { + responses = getResponses(message, timeoutMilliseconds); + for (BrokerResponse r : responses) { + responselistener.responseReturned(r); + } + responselistener.endOfMessage(); + } catch (SessionException e) { + responselistener.raiseError(e); + } catch (RuntimeException e) { + if (e.getCause() == null) + responselistener.raiseError(e); + else + responselistener.raiseError((Exception) e.getCause()); + } + } + }; + synchronized (this.isHandlerSet) { + if (this.isHandlerSet == true) { + throw new UnsupportedOperationException( + SR.v("OneResponseEnumerationPerBrokerClient")); + } + + Thread thread = new Thread(runnable); + thread.start(); + this.isHandlerSet = true; + } + } + + /** + * Set the response handler to handle the response when it is arrived + * + * @param + * @param message + * @param responselistener + */ + public void setResponseHandler( + final ResponseListener responselistener) { + setResponseHandler(responselistener, 0); + } + + /** + * Set the response handler to handle the response when it is arrived + * + * @param + * @param message + * @param responselistener + */ + public void setResponseHandler( + final ResponseListener responselistener, + final int timeoutMilliseconds) { + Utility.throwIfNull(responselistener, "responselistener"); + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + Runnable runnable = new Runnable() { + public void run() { + Iterable> responses; + try { + responses = getResponses(timeoutMilliseconds); + for (BrokerResponse r : responses) { + responselistener.responseReturned(r); + } + responselistener.endOfMessage(); + } catch (SessionException e) { + responselistener.raiseError(e); + } catch (RuntimeException e) { + if (e.getCause() == null) + responselistener.raiseError(e); + else + responselistener.raiseError((Exception) e.getCause()); + } + } + }; + synchronized (this.isHandlerSet) { + if (this.isHandlerSet == true) { + throw new UnsupportedOperationException( + SR.v("OneResponseEnumerationPerBrokerClient")); + } + + Thread thread = new Thread(runnable); + thread.start(); + this.isHandlerSet = true; + } + } + + /** + * Handles cleanup of the BrokerClient instance. Semi-Equivalent to Dispose + * in C# + */ + protected void finalize() { + dispose(); + } + + /** + * Handles cleanup of the BrokerClient instance + */ + protected void dispose() { + if (this.isDisposed) + return; + + if (this.controllerClient != null) { + this.controllerClient.destory(); + this.controllerClient = null; + } + this.session = null; + this.isDisposed = true; + } + + /** + * Commits requests to broker's store. + * + * @param timeoutMilliseconds + * timeout before exception + * @throws TimeoutException + * @throws SessionException + * @throws InvalidOperationException + */ + public void endRequests(int timeoutMilliseconds) + throws SocketTimeoutException, SessionException { + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + if (this.sendCount.get() == 0) { + throw new IllegalStateException(SR.v("InvalidEndRequestsCount")); + } + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + // Pick the larger of the two timeouts to ensure operationTimeout is + // long enough + int largerTimeout = this.timeoutThrottlingMS > timeoutMilliseconds ? this.timeoutThrottlingMS + : timeoutMilliseconds; + + int count = uncommitCount.getAndSet(0); + try { + if (timeoutMilliseconds == 0) { + controllerClient.setTimeout(0); + timeoutMilliseconds = Integer.MAX_VALUE; + } else + controllerClient.setTimeout(largerTimeout); + + controllerClient.endRequests(count, clientId, largerTimeout, + timeoutMilliseconds); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } + isEndRequest = true; + } + + /** + * Flush requests to broker's store. + * + * @throws SessionException + * @throws TimeoutException + * @throws InvalidOperationException + */ + public void flush() throws SocketTimeoutException, SessionException { + flush(DEFAULT_TIMEOUT); + } + + /** + * Flush requests to broker's store. + * + * @param timeoutMilliseconds + * timeout before exception + * @throws TimeoutException + * @throws SessionException + */ + public void flush(int timeoutMilliseconds) throws SocketTimeoutException, + SessionException { + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + if (isDisposed) { + throw new IllegalStateException(SR.v("ClientAlreadyClosed")); + } + + if (this.sendCount.get() == 0) { + return; + } + + // Pick the larger of the two timeouts to ensure operationTimeout is + // long enough + int largerTimeout = this.timeoutThrottlingMS > timeoutMilliseconds ? this.timeoutThrottlingMS + : timeoutMilliseconds; + + int count = uncommitCount.getAndSet(0); + try { + if (timeoutMilliseconds == 0) { + controllerClient.setTimeout(0); + timeoutMilliseconds = -1; + } else + controllerClient.setTimeout(largerTimeout); + + controllerClient.flush(count, clientId, largerTimeout, + timeoutMilliseconds); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } + } + + /** + * Commits requests to broker's store. Default timeout is defined above. + * + * @throws SessionException + * @throws TimeoutException + * @throws InvalidOperationException + */ + public void endRequests() throws SocketTimeoutException, SessionException { + endRequests(DEFAULT_TIMEOUT); + } + + /** + * Closes broker connections + * + * @throws SessionException + * @throws TimeoutException + */ + public void close() throws SocketTimeoutException, SessionException { + close(false, Constant.PurgeTimeoutMS); + } + + /** + * Close the connection and purge the results to the server + * + * @param purge + * if true, the result will be removed in the broker + * @throws SessionException + * @throws TimeoutException + */ + public void close(Boolean purge) throws SocketTimeoutException, + SessionException { + close(purge, Constant.PurgeTimeoutMS); + } + + /** + * Close the connection and purge the results in the server + * + * @param purge + * if true, the result will be removed in the broker + * @param timeoutMilliseconds + * the timeout for the response if purge + * @throws TimeoutException + * @throws SessionException + */ + public void close(Boolean purge, int timeoutMilliseconds) + throws SocketTimeoutException, SessionException { + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (isDisposed) { + return; + } + + if (purge) { + try { + controllerClient.setTimeout(timeoutMilliseconds); + controllerClient.purge(clientId); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", + timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } + } + dispose(); + } + + public BrokerClientStatus getStatus() throws SessionException { + return controllerClient.GetStatus(this.clientId); + } + + public int getRequestCount() throws SessionException { + return controllerClient.getRequestsCount(this.clientId); + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/Constant.java b/src/com/microsoft/hpc/scheduler/session/Constant.java index cfc0602..2939d88 100644 --- a/src/com/microsoft/hpc/scheduler/session/Constant.java +++ b/src/com/microsoft/hpc/scheduler/session/Constant.java @@ -1,323 +1,346 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Global constants -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ - -package com.microsoft.hpc.scheduler.session; - -/** - * The Constant variables - */ -public class Constant -{ - /** - * SOAP Action of broker's EOM message - */ - final public static String EndRequestsAction = "http://hpc.microsoft.com/EndOfGetResponse"; - - /** - * Element name of user data SOAP header - */ - final public static String UserDataHeaderName = "HPCServer2008_Broker_UserDataNS"; - - /** - * Element name of user data SOAP header - */ - final public static String ClientIdHeaderName = "HPCServer2008_Broker_ClientIdNS"; - - /** - * Element name of request action SOAP Header - */ - final public static String ActionHeaderName = "HPCServer2008_Broker_RequestActionNS"; - - /** - * Namespace of user data SOAP header - */ - final public static String HpcHeaderNS = "http://www.microsoft.com/hpc"; - - /** - * Element name of client callback ID header - */ - final public static String ResponseCallbackIdHeaderName = "HPCServer2008_Broker_ResponseCallbackId"; - - /** - * Namespace name of client callback ID header - */ - final public static String ResponseCallbackIdHeaderNS = HpcHeaderNS; - - /** - * Maximum length of user data SOAP header - */ - final public static int MaxUserDataLen = 1024; - - /** - * Maximum size of message TODO: Need to pull from current binding - */ - final public static int MaxBufferSize = 200 * 1024; - - /** - * Default EOM timeout is 60 sec - */ - final public static int EOMTimeoutMS = 60 * 1000; - - /** - * Default Purge timeout is 10 sec - */ - final public static int PurgeTimeoutMS = 10 * 1000; - - /** - * Min WCF operation timeout - */ - final public static int MinOperationTimeout = 60 * 1000; - - /** - * Request all responses - */ - final public static int GetResponse_All = -1; - - /** - * Stores session launcher port - */ - final public static int SessionLauncherPort = 9090; - - /** - * The environment variable for data server location - */ - - final public static String DataServerEnv = "HPC_SOADATASERVER"; - - /** - * @field Namespace of Action SOAP header - **/ - final public static String HpcActionHeaderNS = "http://www.w3.org/2005/08/addressing"; - - /** - * @field Namespace of XMLSchema-instance - **/ - final public static String XMLSchemaInstanceNS = "http://www.w3.org/2001/XMLSchema-instance"; - - /** - * @field Environment Variable to pass service initialization timeout - **/ - final public static String ServiceInitializationTimeoutEnvVar = "CCP_SERVICE_INITIALIZATION_TIMEOUT"; - - /** - * @field Environment Variable to pass cancel task grace period - **/ - final public static String CancelTaskGracePeriodEnvVar = "CCP_CANCEL_TASK_GRACEPERIOD"; - - /** - * @field Folder Name for saving the necessary data - **/ - final public static String CCP_DATAEnvVar = "CCP_DATA"; - - /** - * File name for the service config file - **/ - final public static String ServiceConfigFileNameEnvVar = "CCP_SERVICE_CONFIG_FILENAME"; - - /** - * @field Environment Variable to pass the value indicating enable - * MessageLevelPreemption or not. - **/ - final public static String EnableMessageLevelPreemptionEnvVar = "CCP_MESSAGE_LEVEL_PREEMPTION"; - - /** - * @fieldEnvironment Variable to pass the localtion of the process - **/ - final public static String TASKINSTANCEIDEnvVar = "CCP_TASKINSTANCEID"; - - /** - * @fieldDefault value for cancel task grace period. Same as node managers - **/ - final public static int DefaultCancelTaskGracePeriod = 5000; - - /** - * @field Name of the ServiceJob property - **/ - final public static String ServiceJobId = "HPC_ServiceJobId"; - - /** - * @field Name of the head node - **/ - final public static String HeadnodeName = "HPC_Headnode"; - - /** - * @field Store cluster name environment - **/ - final public static String HeadnodeEnvVar = "CCP_CLUSTER_NAME"; - - /** - * @field Env var to pass serviceOperationTimeout to service hosts - **/ - final public static String ServiceConfigServiceOperatonTimeoutEnvVar = "CCP_SERVICE_SERVICEOPERATIONTIMEOUT"; - - /** - * @field Default value for serviceOperationTimeout service config setting - **/ - final public static int DefaultServiceOperationTimeout = 24 * 60 * 60 * 1000; - - /** - * @field Store the service host port - **/ - final public static int ServiceHostPort = 9100; - - /** - * @field Store the service host port for IHpcServiceHost - **/ - final public static int ServiceHostControllerPort = 9200; - - /** - * @field Stores the network prefix env to get the network prefix - **/ - final public static String NetworkPrefixEnv = "WCF_NETWORKPREFIX"; - - /** - * @field Stores the enterprise network prefix - **/ - final public static String EnterpriseNetwork = "Enterprise"; - - /** - * @field Store registry path environment - **/ - final public static String RegistryPathEnv = "CCP_SERVICEREGISTRATION_PATH"; - - /** - * @field Store service name environment - **/ - final public static String ServiceNameEnvVar = "CCP_SERVICENAME"; - - /** - * @field Store job id environment - **/ - final public static String JobIDEnvVar = "CCP_JOBID"; - - /** - * @field Store task system id environment - **/ - final public static String TaskSystemIDEnvVar = "CCP_TASKSYSTEMID"; - - /** - * @field Store task id environment - **/ - final public static String TaskIDEnvVar = "CCP_TASKID"; - - /** - * @field Store processor number environment - **/ - final public static String ProcNumEnvVar = "CCP_NUMCPUS"; - - /** - * @field Store core id list environment - **/ - final public static String CoreIdsEnvVar = "CCP_COREIDS"; - - /** - * @field Env var used to store pre/post command for HpcServiceHost to use - * when launching the command - **/ - final public static String PrePostTaskCommandLineEnvVar = "CCP_PREPOST_COMMANDLINE"; - - /** - * @field Env var used to store pre/post working dir for HpcServiceHost to - * use when launching the command on premise - **/ - final public static String PrePostTaskOnPremiseWorkingDirEnvVar = "CCP_PREPOST_ONPREMISE_WORKINGDIR"; - - /** - * @field Env var used to pass soa data server information to service hosts - **/ - final public static String SoaDataServerInfoEnvVar = "HPC_SOADATASERVER"; - - /** - * @field Message header name of Preemption The service host adds the header - * to the response message when the process is preempted, and the - * broker reads it. The value type is integer. - **/ - final public static String MessageHeaderPreemption = "preemption"; - - - /** - * @field ETW trace format - */ - final public static String ETWTraceFormat = "\n" - + "\n" - + "0\n" - + "3\n" - +"0\n" - + "%s\n" - + "" - + "\n" - + "\n" - + "" - + "\n" - + "%s\n" - + "\n" - + "" - // CDATA sections are designed to take the trauma out of - // escaping text that has lots of characters that need escaping - // (like < and &) - + "" - + "\n" + "\n"; -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Global constants +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +package com.microsoft.hpc.scheduler.session; + +/** + * The Constant variables + */ +public class Constant +{ + /** + * SOAP Action of broker's EOM message + */ + final public static String EndRequestsAction = "http://hpc.microsoft.com/EndOfGetResponse"; + + /** + * Element name of user data SOAP header + */ + final public static String UserDataHeaderName = "HPCServer2008_Broker_UserDataNS"; + + /** + * Element name of user data SOAP header + */ + final public static String ClientIdHeaderName = "HPCServer2008_Broker_ClientIdNS"; + + /** + * Element name of request action SOAP Header + */ + final public static String ActionHeaderName = "HPCServer2008_Broker_RequestActionNS"; + + /** + * Namespace of user data SOAP header + */ + final public static String HpcHeaderNS = "http://www.microsoft.com/hpc"; + + /** + * Element name of client callback ID header + */ + final public static String ResponseCallbackIdHeaderName = "HPCServer2008_Broker_ResponseCallbackId"; + + /** + * Namespace name of client callback ID header + */ + final public static String ResponseCallbackIdHeaderNS = HpcHeaderNS; + + /** + * Maximum length of user data SOAP header + */ + final public static int MaxUserDataLen = 1024; + + /** + * Maximum size of message TODO: Need to pull from current binding + */ + final public static int MaxBufferSize = 200 * 1024; + + /** + * Default EOM timeout is 60 sec + */ + final public static int EOMTimeoutMS = 60 * 1000; + + /** + * Default Purge timeout is 10 sec + */ + final public static int PurgeTimeoutMS = 10 * 1000; + + /** + * Min WCF operation timeout + */ + final public static int MinOperationTimeout = 60 * 1000; + + /** + * Request all responses + */ + final public static int GetResponse_All = -1; + + /** + * Stores session launcher port + */ + final public static int SessionLauncherPort = 9090; + + /** + * The environment variable for data server location + */ + + final public static String DataServerEnv = "HPC_SOADATASERVER"; + + /** + * @field Namespace of Action SOAP header + **/ + final public static String HpcActionHeaderNS = "http://www.w3.org/2005/08/addressing"; + + /** + * @field Namespace of XMLSchema-instance + **/ + final public static String XMLSchemaInstanceNS = "http://www.w3.org/2001/XMLSchema-instance"; + + /** + * @field Environment Variable to pass service initialization timeout + **/ + final public static String ServiceInitializationTimeoutEnvVar = "CCP_SERVICE_INITIALIZATION_TIMEOUT"; + + /** + * @field Environment Variable to pass cancel task grace period + **/ + final public static String CancelTaskGracePeriodEnvVar = "CCP_CANCEL_TASK_GRACEPERIOD"; + + /** + * @field Folder Name for saving the necessary data + **/ + final public static String CCP_DATAEnvVar = "CCP_DATA"; + + /** + * File name for the service config file + **/ + final public static String ServiceConfigFileNameEnvVar = "CCP_SERVICE_CONFIG_FILENAME"; + + /** + * @field Environment Variable to pass the value indicating enable + * MessageLevelPreemption or not. + **/ + final public static String EnableMessageLevelPreemptionEnvVar = "CCP_MESSAGE_LEVEL_PREEMPTION"; + + /** + * @fieldEnvironment Variable to pass the localtion of the process + **/ + final public static String TASKINSTANCEIDEnvVar = "CCP_TASKINSTANCEID"; + + /** + * @fieldDefault value for cancel task grace period. Same as node managers + **/ + final public static int DefaultCancelTaskGracePeriod = 5000; + + /** + * @field Name of the ServiceJob property + **/ + final public static String ServiceJobId = "HPC_ServiceJobId"; + + /** + * @field Name of the head node + **/ + final public static String HeadnodeName = "HPC_Headnode"; + + /** + * @field Store cluster name environment + **/ + final public static String HeadnodeEnvVar = "CCP_CLUSTER_NAME"; + + /** + * @field Env var to pass serviceOperationTimeout to service hosts + **/ + final public static String ServiceConfigServiceOperatonTimeoutEnvVar = "CCP_SERVICE_SERVICEOPERATIONTIMEOUT"; + + /** + * @field Default value for serviceOperationTimeout service config setting + **/ + final public static int DefaultServiceOperationTimeout = 24 * 60 * 60 * 1000; + + /** + * @field Store the service host port + **/ + final public static int ServiceHostPort = 9100; + + /** + * @field Store the service host port for IHpcServiceHost + **/ + final public static int ServiceHostControllerPort = 9200; + + /** + * @field Stores the network prefix env to get the network prefix + **/ + final public static String NetworkPrefixEnv = "WCF_NETWORKPREFIX"; + + /** + * @field Stores the enterprise network prefix + **/ + final public static String EnterpriseNetwork = "Enterprise"; + + /** + * @field Store registry path environment + **/ + final public static String RegistryPathEnv = "CCP_SERVICEREGISTRATION_PATH"; + + /** + * @field Store service name environment + **/ + final public static String ServiceNameEnvVar = "CCP_SERVICENAME"; + + /** + * @field Store job id environment + **/ + final public static String JobIDEnvVar = "CCP_JOBID"; + + /** + * @field Store task system id environment + **/ + final public static String TaskSystemIDEnvVar = "CCP_TASKSYSTEMID"; + + /** + * @field Store task id environment + **/ + final public static String TaskIDEnvVar = "CCP_TASKID"; + + /** + * @field Store processor number environment + **/ + final public static String ProcNumEnvVar = "CCP_NUMCPUS"; + + /** + * @field Store core id list environment + **/ + final public static String CoreIdsEnvVar = "CCP_COREIDS"; + + /** + * @field Env var used to store pre/post command for HpcServiceHost to use + * when launching the command + **/ + final public static String PrePostTaskCommandLineEnvVar = "CCP_PREPOST_COMMANDLINE"; + + /** + * @field Env var used to store pre/post working dir for HpcServiceHost to + * use when launching the command on premise + **/ + final public static String PrePostTaskOnPremiseWorkingDirEnvVar = "CCP_PREPOST_ONPREMISE_WORKINGDIR"; + + /** + * @field Env var used to pass soa data server information to service hosts + **/ + final public static String SoaDataServerInfoEnvVar = "HPC_SOADATASERVER"; + + /** + * @field Message header name of Preemption The service host adds the header + * to the response message when the process is preempted, and the + * broker reads it. The value type is integer. + **/ + final public static String MessageHeaderPreemption = "preemption"; + + /** + * @field DispatchID LocalPart in Header + **/ + final public static String DISPATCHIDLOCALPART = "HPCServer2008_Broker_DispatchIdNS"; + + /** + * @field MessageID LocalPart in Header + **/ + final public static String MESSAGEIDLOCALPART = "MessageID"; + + /** + * @field SoaDiagTraceLevel + */ + final public static String SOADIAGTRACELEVEL = "SoaDiagTraceLevel"; + + /** + * @field The 5 trace level used to call .dll when using etw + **/ + final public static int TRACE_CRITICAL = 5; + final public static int TRACE_ERROR = 4; + final public static int TRACE_WARNING = 3; + final public static int TRACE_INFO = 2; + final public static int TRACE_VERBOSE = 1; + + /** + * @field ETW trace format + */ + final public static String ETWTraceFormat = "\n" + + "\n" + + "0\n" + + "3\n" + +"0\n" + + "%s\n" + + "" + + "\n" + + "\n" + + "" + + "\n" + + "%s\n" + + "\n" + + "" + // CDATA sections are designed to take the trauma out of + // escaping text that has lots of characters that need escaping + // (like < and &) + + "" + + "\n" + "\n"; +} diff --git a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java index 5931d1f..09193a6 100644 --- a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java @@ -1,362 +1,399 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// CxfBrokerClient class -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ - -package com.microsoft.hpc.scheduler.session; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.namespace.QName; -import javax.xml.soap.MessageFactory; -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPHeader; -import javax.xml.soap.SOAPHeaderElement; -import javax.xml.soap.SOAPMessage; -import javax.xml.ws.Action; -import javax.xml.ws.Dispatch; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.Service; -import javax.xml.ws.soap.AddressingFeature; -import javax.xml.ws.soap.SOAPBinding; - -import org.apache.cxf.endpoint.Client; -import org.apache.cxf.frontend.ClientProxy; -import org.apache.cxf.jaxws.DispatchImpl; -import org.apache.cxf.transport.http.HTTPConduit; - -/** - * @author junsu - * - */ -class CxfBrokerClient extends CxfClientBase -{ - static HashMap, JAXBContext> contextMap = new HashMap, JAXBContext>();; - - HashMap> dispatchMap; - Map actionMap; - Map> responseTypeMap; - Map responseMap; - QName portName; - javax.xml.ws.Service soaService; - String EPR; - Client client; - - public CxfBrokerClient(String username, String password, String epr, - Class service) { - this.EPR = epr; - Class interfaceType = GetServiceInterface(service); - - CreateActionMap(interfaceType); - - portName = new QName("http://hpc.microsoft.com", "brokerPort"); - soaService = Service.create(GetServiceName(service)); - - soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, epr); - Object interfaceObj = soaService.getPort(portName, interfaceType); - Initialize(username, password, interfaceObj); - - client = ClientProxy.getClient(serviceObj); - - this.dispatchMap = new HashMap>(); - } - - private QName GetServiceName(Class service) { - try { - Field field = service.getDeclaredField("SERVICE"); - return (QName) field.get(null); - } catch (Exception e) { - throw new IllegalArgumentException( - SR.v("RequireServiceContractType")); - } - } - - private void CreateActionMap(Class interfaceType) { - actionMap = new HashMap(); - responseMap = new HashMap(); - responseTypeMap = new HashMap>(); - Method[] methods = interfaceType.getMethods(); - for (Method t : methods) { - Action action = t.getAnnotation(Action.class); - RequestWrapper request = t.getAnnotation(RequestWrapper.class); - ResponseWrapper response = t.getAnnotation(ResponseWrapper.class); - if (actionMap.containsKey(request.className())) { - // if this request type is in the table - // this is a ambiguous request type, clear it to null - actionMap.put(request.className(), null); - } else { - actionMap.put(request.className(), action.input()); - } - - try { - responseTypeMap.put(action.output(), Class.forName(response.className())); - } catch (ClassNotFoundException e) { - } - - if (responseMap.containsKey(response.className())) { - // if this request type is in the table - // this is a ambiguous request type, clear it to null - responseMap.put(response.className(), null); - } else { - responseMap.put(response.className(), action.input()); - } - } - } - - private Class GetServiceInterface(Class service) { - Method[] methods = service.getMethods(); - for (Method t : methods) { - if (t.getName().startsWith("getDefault") - && t.getParameterTypes().length == 0) { - // searches for a function that starts with "getDefault" (as in - // getDefaultBindingIEchoSvc) - return t.getReturnType(); - } - } - - throw new IllegalArgumentException(SR.v("RequireServiceContractType")); - } - - /** - * Implement the cache for JAXContext for one type - * - * @param type - * @return - * @throws JAXBException - */ - static private JAXBContext getContext(Class type) throws JAXBException { - JAXBContext jc; - if (contextMap.containsKey(type)) { - jc = contextMap.get(type); - } else { - jc = JAXBContext.newInstance(type); - synchronized (contextMap) { - contextMap.put(type, jc); - } - } - - return jc; - } - - private Dispatch getSOAPDispatch(String action) { - if (dispatchMap.containsKey(action)) { - return dispatchMap.get(action); - } else { - Dispatch dispatch = soaService.createDispatch( - portName, SOAPMessage.class, Service.Mode.MESSAGE, - new AddressingFeature(false)); - - DispatchImpl dispImpl = (DispatchImpl) dispatch; - trustAll((HTTPConduit) dispImpl.getClient().getConduit()); - addWSSHeaders(dispImpl.getClient().getEndpoint()); - - dispatch.getRequestContext().put( - Dispatch.ENDPOINT_ADDRESS_PROPERTY, this.EPR); - dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, - true); - dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, - action); - dispatchMap.put(action, dispatch); - - return dispatch; - } - } - - /** - * Client Identity QName - */ - private QName clientIdHeader = new QName(Constant.HpcHeaderNS, - Constant.ClientIdHeaderName); - - /** - * Generates the SOAP message for the dispatch - * - * @param payload - * the message to be generated - * @param userData - * userdata to be supplied with the message - * @return - */ - private SOAPMessage createSOAPMessage(Dispatch dispatch, - Object payload, String clientid, Object userData) - throws SessionException { - try { - // Create message factory - MessageFactory mf = ((SOAPBinding) dispatch.getBinding()) - .getMessageFactory(); - SOAPMessage msg = mf.createMessage(); - - // Add userData as a SOAP header - generateUserDataHeader(userData, msg); - - // Add clientid as a SOAP header - generateClientIdHeader(msg, clientid); - - // Add the payload object as a message body - JAXBContext jc = getContext(payload.getClass()); - - Marshaller marshaller = jc.createMarshaller(); - marshaller.marshal(payload, msg.getSOAPBody()); - msg.saveChanges(); - - return msg; - } catch (Exception e) { - throw new SessionException(e); - } - } - - /** - * Set SOAP header for clientId - *

- * Java Changes: return type to void, added SOAPMessage msg as parameter - * Required for interoperability with Java's native SOAP functions - *

- * - * @param msg - * @throws SOAPException - */ - private void generateClientIdHeader(SOAPMessage msg, String clientId) - throws SOAPException { - SOAPHeader header = msg.getSOAPHeader(); - SOAPHeaderElement headerElement = header - .addHeaderElement(clientIdHeader); - headerElement.setValue(clientId); - } - - /** - * Generates SOAP header for user data - *

- * Java Changes: return type to void, added SOAPMessage msg as parameter - * Required for interoperability with Java's native SOAP functions - *

- * - * @param userData - * @param msg - * @throws SOAPException - */ - private static void generateUserDataHeader(Object userData, SOAPMessage msg) - throws SOAPException { - SOAPHeader header = msg.getSOAPHeader(); - SOAPHeaderElement headerElement = header.addHeaderElement(new QName( - Constant.HpcHeaderNS, Constant.UserDataHeaderName)); - headerElement.setValue(userData.toString()); - } - - /** - * Send the message by OneWay Operation - * - * @param payload - * @param userData - * @throws SessionException - */ - public void SendMessage(Object payload, String clientId, Object userData, - int timeout) throws SessionException { - // find out the action name - String className = payload.getClass().getName(); - if (!actionMap.containsKey(className) - || actionMap.get(className) == null) { - throw new SessionException( - "Cannot find the action assiocate with the request class."); - } - - String Action = actionMap.get(className); - SendMessage(payload, clientId, userData, Action, timeout); - } - - public void SendMessage(Object payload, String clientId, Object userData, - String action, int timeout) throws SessionException { - // find the Dispatcher - Dispatch dispatch = getSOAPDispatch(action); - - // create the message based on payload and userData - SOAPMessage msg; - msg = createSOAPMessage(dispatch, payload, clientId, userData); - - setClientTimeout(((DispatchImpl) dispatch).getClient(), - timeout); - - // send out the message - dispatch.invokeOneWay(msg); - } - - public String getRequestAction(Class messageClass) - throws SessionException { - if (responseMap.containsKey(messageClass.getName())) { - return responseMap.get(messageClass.getName()); - } else { - throw new SessionException(SR.v("AmbiguousOperation")); - } - } - - public Map> getResponseTypeMapping() - { - return responseTypeMap; - } -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// CxfBrokerClient class +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +package com.microsoft.hpc.scheduler.session; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; +import javax.xml.soap.MessageFactory; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPHeader; +import javax.xml.soap.SOAPHeaderElement; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.Action; +import javax.xml.ws.Dispatch; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import javax.xml.ws.Service; +import javax.xml.ws.soap.AddressingFeature; +import javax.xml.ws.soap.SOAPBinding; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.frontend.ClientProxy; +import org.apache.cxf.jaxws.DispatchImpl; +import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.ws.addressing.AddressingBuilder; +import org.apache.cxf.ws.addressing.AddressingProperties; +import org.apache.cxf.ws.addressing.AttributedURIType; +import org.apache.cxf.ws.addressing.ObjectFactory; +import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; + + +/** + * @author junsu + * + */ +class CxfBrokerClient extends CxfClientBase +{ + static HashMap, JAXBContext> contextMap = new HashMap, JAXBContext>();; + + HashMap> dispatchMap; + Map actionMap; + Map> responseTypeMap; + Map responseMap; + QName portName; + javax.xml.ws.Service soaService; + String EPR; + Client client; + ObjectFactory wsaObjectFactory; + + public CxfBrokerClient(String username, String password, String epr, + Class service) { + this.EPR = epr; + Class interfaceType = GetServiceInterface(service); + + CreateActionMap(interfaceType); + + portName = new QName("http://hpc.microsoft.com", "brokerPort"); + soaService = Service.create(GetServiceName(service)); + + soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, epr); + Object interfaceObj = soaService.getPort(portName, interfaceType); + Initialize(username, password, interfaceObj); + + client = ClientProxy.getClient(serviceObj); + + this.dispatchMap = new HashMap>(); + wsaObjectFactory = new ObjectFactory(); + } + + private QName GetServiceName(Class service) { + try { + Field field = service.getDeclaredField("SERVICE"); + return (QName) field.get(null); + } catch (Exception e) { + throw new IllegalArgumentException( + SR.v("RequireServiceContractType")); + } + } + + private void CreateActionMap(Class interfaceType) { + actionMap = new HashMap(); + responseMap = new HashMap(); + responseTypeMap = new HashMap>(); + Method[] methods = interfaceType.getMethods(); + for (Method t : methods) { + Action action = t.getAnnotation(Action.class); + RequestWrapper request = t.getAnnotation(RequestWrapper.class); + ResponseWrapper response = t.getAnnotation(ResponseWrapper.class); + if (actionMap.containsKey(request.className())) { + // if this request type is in the table + // this is a ambiguous request type, clear it to null + actionMap.put(request.className(), null); + } else { + actionMap.put(request.className(), action.input()); + } + + try { + responseTypeMap.put(action.output(), Class.forName(response.className())); + } catch (ClassNotFoundException e) { + } + + if (responseMap.containsKey(response.className())) { + // if this request type is in the table + // this is a ambiguous request type, clear it to null + responseMap.put(response.className(), null); + } else { + responseMap.put(response.className(), action.input()); + } + } + } + + private Class GetServiceInterface(Class service) { + Method[] methods = service.getMethods(); + for (Method t : methods) { + if (t.getName().startsWith("getDefault") + && t.getParameterTypes().length == 0) { + // searches for a function that starts with "getDefault" (as in + // getDefaultBindingIEchoSvc) + return t.getReturnType(); + } + } + + throw new IllegalArgumentException(SR.v("RequireServiceContractType")); + } + + /** + * Implement the cache for JAXContext for one type + * + * @param type + * @return + * @throws JAXBException + */ + static private JAXBContext getContext(Class type) throws JAXBException { + JAXBContext jc; + if (contextMap.containsKey(type)) { + jc = contextMap.get(type); + } else { + jc = JAXBContext.newInstance(type); + synchronized (contextMap) { + contextMap.put(type, jc); + } + } + + return jc; + } + + private Dispatch getSOAPDispatch(String action) { + if (dispatchMap.containsKey(action)) { + return dispatchMap.get(action); + } else { + Dispatch dispatch = soaService.createDispatch( + portName, SOAPMessage.class, Service.Mode.MESSAGE, + new AddressingFeature(true)); + DispatchImpl dispImpl = (DispatchImpl) dispatch; + trustAll((HTTPConduit) dispImpl.getClient().getConduit()); + addWSSHeaders(dispImpl.getClient().getEndpoint()); + + /* Per CXF FAQ. future calls to getRequestContext() will use a thread local + request context. That allows the request context to be threadsafe. + (Note: the response context is always thread local in CXF) */ + dispatch.getRequestContext().put("thread.local.request.context", "true"); + dispatch.getRequestContext().put( + Dispatch.ENDPOINT_ADDRESS_PROPERTY, this.EPR); + dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, + true); + dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, + action); + /* Create message id + get Message Addressing Properties instance */ + + AddressingBuilder builder = AddressingBuilder.getAddressingBuilder(); + AddressingProperties maps = builder.newAddressingProperties(); + dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, maps); + dispatchMap.put(action, dispatch); + return dispatch; + } + } + + /** + * Client Identity QName + */ + private QName clientIdHeader = new QName(Constant.HpcHeaderNS, + Constant.ClientIdHeaderName); + + /** + * Generates the SOAP message for the dispatch + * + * @param payload + * the message to be generated + * @param userData + * userdata to be supplied with the message + * @return + */ + private SOAPMessage createSOAPMessage(Dispatch dispatch, + Object payload, String clientid, Object userData, UUID messageId) + throws SessionException { + try { + // Create message factory + MessageFactory mf = ((SOAPBinding) dispatch.getBinding()) + .getMessageFactory(); + SOAPMessage msg = mf.createMessage(); + // Add messageId as a SOAP header + generateMessageIdHeader(dispatch.getRequestContext(), messageId); + + // Add userData as a SOAP header + generateUserDataHeader(userData, msg); + + // Add clientid as a SOAP header + generateClientIdHeader(msg, clientid); + + // Add the payload object as a message body + JAXBContext jc = getContext(payload.getClass()); + + Marshaller marshaller = jc.createMarshaller(); + marshaller.marshal(payload, msg.getSOAPBody()); + msg.saveChanges(); + + return msg; + } catch (Exception e) { + throw new SessionException(e); + } + } + + /** + * Set SOAP header for messageId + * + * @param requestContext + * the requestContext of the dispatcher + * @param messageId + * messageId of the message to send + * @return + */ + private void generateMessageIdHeader(Map requestContext, UUID messageId) { + AddressingProperties maps = (AddressingProperties) requestContext.get(CLIENT_ADDRESSING_PROPERTIES); + AttributedURIType messageID = wsaObjectFactory.createAttributedURIType(); + messageID.setValue("urn:uuid:" + messageId.toString()); + maps.setMessageID(messageID); + } + + /** + * Set SOAP header for clientId + *

+ * Java Changes: return type to void, added SOAPMessage msg as parameter + * Required for interoperability with Java's native SOAP functions + *

+ * + * @param msg + * @throws SOAPException + */ + private void generateClientIdHeader(SOAPMessage msg, String clientId) + throws SOAPException { + SOAPHeader header = msg.getSOAPHeader(); + SOAPHeaderElement headerElement = header + .addHeaderElement(clientIdHeader); + headerElement.setValue(clientId); + } + + /** + * Generates SOAP header for user data + *

+ * Java Changes: return type to void, added SOAPMessage msg as parameter + * Required for interoperability with Java's native SOAP functions + *

+ * + * @param userData + * @param msg + * @throws SOAPException + */ + private static void generateUserDataHeader(Object userData, SOAPMessage msg) + throws SOAPException { + SOAPHeader header = msg.getSOAPHeader(); + SOAPHeaderElement headerElement = header.addHeaderElement(new QName( + Constant.HpcHeaderNS, Constant.UserDataHeaderName)); + headerElement.setValue(userData.toString()); + } + + /** + * Send the message by OneWay Operation + * + * @param payload + * @param userData + * @param messageId + * @throws SessionException + */ + public void SendMessage(Object payload, String clientId, Object userData, + int timeout, UUID messageId) throws SessionException { + // find out the action name + String className = payload.getClass().getName(); + if (!actionMap.containsKey(className) + || actionMap.get(className) == null) { + throw new SessionException( + "Cannot find the action assiocate with the request class."); + } + + String Action = actionMap.get(className); + SendMessage(payload, clientId, userData, Action, timeout, messageId); + } + + public void SendMessage(Object payload, String clientId, Object userData, + String action, int timeout, UUID messageId) throws SessionException { + // find the Dispatcher + Dispatch dispatch = getSOAPDispatch(action); + + + // create the message based on payload and userData + SOAPMessage msg; + msg = createSOAPMessage(dispatch, payload, clientId, userData, messageId); + + setClientTimeout(((DispatchImpl) dispatch).getClient(), + timeout); + + // send out the message + dispatch.invokeOneWay(msg); + } + + public String getRequestAction(Class messageClass) + throws SessionException { + if (responseMap.containsKey(messageClass.getName())) { + return responseMap.get(messageClass.getName()); + } else { + throw new SessionException(SR.v("AmbiguousOperation")); + } + } + + public Map> getResponseTypeMapping() + { + return responseTypeMap; + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/CxfBrokerControllerClient.java b/src/com/microsoft/hpc/scheduler/session/CxfBrokerControllerClient.java index acb44dd..9fa0925 100644 --- a/src/com/microsoft/hpc/scheduler/session/CxfBrokerControllerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/CxfBrokerControllerClient.java @@ -1,188 +1,188 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// CxfBrokerControllerClient class -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ - -package com.microsoft.hpc.scheduler.session; - -import java.util.Collection; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.soap.SOAPBinding; - -import com.microsoft.hpc.BrokerClientStatus; -import com.microsoft.hpc.brokercontroller.BrokerResponseMessages; -import com.microsoft.hpc.brokercontroller.GetResponsePosition; -import com.microsoft.hpc.brokercontroller.IBrokerController; -import com.microsoft.hpc.brokercontroller.IBrokerControllerEndRequestsSessionFaultFaultFaultMessage; -import com.microsoft.hpc.brokercontroller.IBrokerControllerFlushSessionFaultFaultFaultMessage; -import com.microsoft.hpc.brokercontroller.IBrokerControllerGetBrokerClientStatusSessionFaultFaultFaultMessage; -import com.microsoft.hpc.brokercontroller.IBrokerControllerGetRequestsCountSessionFaultFaultFaultMessage; -import com.microsoft.hpc.brokercontroller.IBrokerControllerPullResponsesSessionFaultFaultFaultMessage; -import com.microsoft.hpc.brokercontroller.IBrokerControllerPurgeSessionFaultFaultFaultMessage; - -class CxfBrokerControllerClient extends CxfClientBase -{ - IBrokerController brokerController; - String epr; - - /** - * Create the broker controller instance - * - * @param username - * user name if this is a secure session - * @param password - * password if this is a secure session - * @param EPRAddr - * brokerController epr - */ - public CxfBrokerControllerClient(String username, String password, - String EPRAddr) { - this.epr = EPRAddr.toLowerCase(); - - QName portName = new QName("http://hpc.microsoft.com", - "HpcBrokerControllerClientHttpsPort"); - javax.xml.ws.Service soaService = Service - .create(new QName("http://hpc.microsoft.com/brokercontroller/", "BrokerController")); - soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, this.epr); - brokerController = soaService - .getPort(portName, IBrokerController.class); - - Initialize(username, password, brokerController); - } - - public void endRequests(int sendCount, String clientId, int largerTimeout, - int timeoutMilliseconds) throws SessionException { - try { - this.brokerController.endRequests(sendCount, clientId, - largerTimeout, timeoutMilliseconds); - } catch (IBrokerControllerEndRequestsSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - } - - public void purge(String clientId) throws SessionException { - try { - this.brokerController.purge(clientId); - } catch (IBrokerControllerPurgeSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - } - - public boolean pullResponses(Map> mapping, String action, - boolean fromStart, int count, String clientId, Collection queue) - throws SessionException { - BrokerResponseMessages responses = null; - - GetResponsePosition position = (fromStart) ? GetResponsePosition.BEGIN - : GetResponsePosition.CURRENT; - - try { - responses = brokerController.pullResponses(action, position, count, - clientId); - } catch (IBrokerControllerPullResponsesSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - - for (BrokerResponseMessages.SOAPMessage response : responses - .getSOAPMessage()) { - // Convert the message XML to a SOAPMessage - if (action.isEmpty()) - queue.add(new BrokerResponse(mapping, response.getAny())); - else - queue.add(new BrokerResponse(mapping.get(action), response.getAny())); - } - - return responses.isEOM(); - } - - public void flush(int sendCount, String clientId, int largerTimeout, - int timeoutMilliseconds) throws SessionException { - - try { - this.brokerController.flush(sendCount, clientId, largerTimeout, - timeoutMilliseconds); - } catch (IBrokerControllerFlushSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - } - - public BrokerClientStatus GetStatus(String clientId) - throws SessionException { - try { - return this.brokerController.getBrokerClientStatus(clientId); - } catch (IBrokerControllerGetBrokerClientStatusSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - } - - public int getRequestsCount(String clientId) throws SessionException { - try { - return this.brokerController.getRequestsCount(clientId); - } catch (IBrokerControllerGetRequestsCountSessionFaultFaultFaultMessage e) { - throw Utility.translateFaultException(e.getFaultInfo()); - } - } -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// CxfBrokerControllerClient class +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +package com.microsoft.hpc.scheduler.session; + +import java.util.Collection; +import java.util.Map; +import javax.xml.namespace.QName; +import javax.xml.ws.soap.AddressingFeature; +import javax.xml.ws.soap.SOAPBinding; + +import com.microsoft.hpc.BrokerClientStatus; +import com.microsoft.hpc.brokercontroller.BrokerResponseMessages; +import com.microsoft.hpc.brokercontroller.GetResponsePosition; +import com.microsoft.hpc.brokercontroller.IBrokerController; +import com.microsoft.hpc.brokercontroller.IBrokerControllerEndRequestsSessionFaultFaultFaultMessage; +import com.microsoft.hpc.brokercontroller.IBrokerControllerFlushSessionFaultFaultFaultMessage; +import com.microsoft.hpc.brokercontroller.IBrokerControllerGetBrokerClientStatusSessionFaultFaultFaultMessage; +import com.microsoft.hpc.brokercontroller.IBrokerControllerGetRequestsCountSessionFaultFaultFaultMessage; +import com.microsoft.hpc.brokercontroller.IBrokerControllerPullResponsesSessionFaultFaultFaultMessage; +import com.microsoft.hpc.brokercontroller.IBrokerControllerPurgeSessionFaultFaultFaultMessage; + +class CxfBrokerControllerClient extends CxfClientBase +{ + IBrokerController brokerController; + String epr; + + /** + * Create the broker controller instance + * + * @param username + * user name if this is a secure session + * @param password + * password if this is a secure session + * @param EPRAddr + * brokerController epr + */ + public CxfBrokerControllerClient(String username, String password, + String EPRAddr) { + this.epr = EPRAddr.toLowerCase(); + + QName portName = new QName("http://hpc.microsoft.com", + "HpcBrokerControllerClientHttpsPort"); + + javax.xml.ws.Service soaService = javax.xml.ws.Service + .create(new QName("http://hpc.microsoft.com/brokercontroller/", "BrokerController"), + new AddressingFeature(true)); + soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, this.epr); + + brokerController = soaService.getPort(portName, IBrokerController.class); + Initialize(username, password, brokerController); + } + + public void endRequests(int sendCount, String clientId, int largerTimeout, + int timeoutMilliseconds) throws SessionException { + try { + this.brokerController.endRequests(sendCount, clientId, + largerTimeout, timeoutMilliseconds); + } catch (IBrokerControllerEndRequestsSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public void purge(String clientId) throws SessionException { + try { + this.brokerController.purge(clientId); + } catch (IBrokerControllerPurgeSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public boolean pullResponses(Map> mapping, String action, + boolean fromStart, int count, String clientId, Collection queue) + throws SessionException { + BrokerResponseMessages responses = null; + + GetResponsePosition position = (fromStart) ? GetResponsePosition.BEGIN + : GetResponsePosition.CURRENT; + + try { + responses = brokerController.pullResponses(action, position, count, + clientId); + } catch (IBrokerControllerPullResponsesSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + + for (BrokerResponseMessages.SOAPMessage response : responses + .getSOAPMessage()) { + // Convert the message XML to a SOAPMessage + if (action.isEmpty()) + queue.add(new BrokerResponse(mapping, response.getAny())); + else + queue.add(new BrokerResponse(mapping.get(action), response.getAny())); + } + + return responses.isEOM(); + } + + public void flush(int sendCount, String clientId, int largerTimeout, + int timeoutMilliseconds) throws SessionException { + + try { + this.brokerController.flush(sendCount, clientId, largerTimeout, + timeoutMilliseconds); + } catch (IBrokerControllerFlushSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public BrokerClientStatus GetStatus(String clientId) + throws SessionException { + try { + return this.brokerController.getBrokerClientStatus(clientId); + } catch (IBrokerControllerGetBrokerClientStatusSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public int getRequestsCount(String clientId) throws SessionException { + try { + return this.brokerController.getRequestsCount(clientId); + } catch (IBrokerControllerGetRequestsCountSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/DurableSession.java b/src/com/microsoft/hpc/scheduler/session/DurableSession.java index 9461726..33b5c14 100644 --- a/src/com/microsoft/hpc/scheduler/session/DurableSession.java +++ b/src/com/microsoft/hpc/scheduler/session/DurableSession.java @@ -1,187 +1,189 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// The implementation of the Durable Session Class -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session; - -import java.net.SocketTimeoutException; - -import com.microsoft.hpc.sessionlauncher.SessionInfo; - -/** - * Creates a session whose requests and responses gets stored in MSMQ. - *

- * This allows a user to disconnect the client or use a different client - * altogether to retrieve messages. - *

- *

- * Constructors are called from SessionBase during - * CreateSession - *

- * - * @See {@link #createSession(SessionStartInfo)} - */ -public class DurableSession extends SessionBase -{ - /** - * Initializes a new instance of the DurableSession class - * - * @param info - * Session info - * @param headnode - * the head node machine name. - * @param traceSource - * the trace source - */ - DurableSession(SessionInfo info, String headnode) { - super(info, headnode); - } - - /** - * Creates a new instance of durable session - * - * @param startInfo - * the session start info - * @return a durable session instance - * @throws SessionException - * If an exception occurred during the setup of a session - * @throws TimeoutException - * If the setup of a session took too long - */ - public static DurableSession createSession(SessionStartInfo startInfo) - throws SocketTimeoutException, SessionException { - return createSession(startInfo, 0); - } - - /** - * Create a durable session - * - * @param startInfo - * the session start info - * @param timeoutMilliseconds - * timeout for creating the session - * @return a durable session instance - * @throws SessionException - * If an exception occurred during the setup of a session - * @throws TimeoutException - * If the setup of a session takes too long - */ - public static DurableSession createSession(SessionStartInfo startInfo, - int timeoutMilliseconds) throws SocketTimeoutException, - SessionException { - if (!startInfo.getTransportScheme().contains( - TransportScheme.Http.getName())) - throw new IllegalArgumentException( - SR.v("TransportSchemeNotSupport")); - return (DurableSession) createSessionInternal(startInfo, - timeoutMilliseconds, true); - - } - - /** - * Attach to an existing session with session id - * - * @param attachInfo - * the attach info - * @param timeoutMilliseconds - * timeout for attaching to the session - * @return a durable session instance - * @throws SessionException - * If an exception occurred while trying to connect to an - * existing session - */ - public static DurableSession attachSession(SessionAttachInfo attachInfo, - int timeoutMilliseconds) throws SessionException, - SocketTimeoutException { - return (DurableSession) attachInternal(attachInfo, timeoutMilliseconds); - } - - /** - * Attach to an existing session with session id - * - * @param attachInfo - * the attach info - * @return the durable session instance - * @throws SessionException - * If an exception occurred while trying to connect to an - * existing session - */ - public static DurableSession attachSession(SessionAttachInfo attachInfo) - throws SessionException, SocketTimeoutException { - return attachSession(attachInfo, 0); - } - - /** - * the help function to check the sanity of SessionStartInfo before creating - * a session - * - * @param startInfo - */ - protected static void checkSessionStartInfo(SessionStartInfo startInfo) { - SessionBase.checkSessionStartInfo(startInfo); - if (TransportScheme.valueOf(startInfo.getTransportScheme().get(0)) != TransportScheme.Http) { - throw new UnsupportedOperationException( - SR.v("TransportSchemeNotSupport")); - } - } -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// The implementation of the Durable Session Class +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session; + +import java.net.SocketTimeoutException; + +import com.microsoft.hpc.sessionlauncher.SessionInfo; + +/** + * Creates a session whose requests and responses gets stored in MSMQ. + *

+ * This allows a user to disconnect the client or use a different client + * altogether to retrieve messages. + *

+ *

+ * Constructors are called from SessionBase during + * CreateSession + *

+ * + * @See {@link #createSession(SessionStartInfo)} + */ +public class DurableSession extends SessionBase +{ + /** + * Initializes a new instance of the DurableSession class + * + * @param info + * Session info + * @param headnode + * the head node machine name. + * @param traceSource + * the trace source + */ + DurableSession(SessionInfo info, String headnode) { + super(info, headnode); + } + + /** + * Creates a new instance of durable session + * + * @param startInfo + * the session start info + * @return a durable session instance + * @throws SessionException + * If an exception occurred during the setup of a session + * @throws TimeoutException + * If the setup of a session took too long + */ + public static DurableSession createSession(SessionStartInfo startInfo) + throws SocketTimeoutException, SessionException { + return createSession(startInfo, 0); + } + + /** + * Create a durable session + * + * @param startInfo + * the session start info + * @param timeoutMilliseconds + * timeout for creating the session + * @return a durable session instance + * @throws SessionException + * If an exception occurred during the setup of a session + * @throws TimeoutException + * If the setup of a session takes too long + */ + public static DurableSession createSession(SessionStartInfo startInfo, + int timeoutMilliseconds) throws SocketTimeoutException, + SessionException { + String transportScheme = startInfo.getTransportScheme().get(0); + if (transportScheme != TransportScheme.Http.getName() && + transportScheme != TransportScheme.Custom.getName()) { + throw new IllegalArgumentException( + SR.v("TransportSchemeNotSupport")); + } + return (DurableSession) createSessionInternal(startInfo, + timeoutMilliseconds, true); + + } + + /** + * Attach to an existing session with session id + * + * @param attachInfo + * the attach info + * @param timeoutMilliseconds + * timeout for attaching to the session + * @return a durable session instance + * @throws SessionException + * If an exception occurred while trying to connect to an + * existing session + */ + public static DurableSession attachSession(SessionAttachInfo attachInfo, + int timeoutMilliseconds) throws SessionException, + SocketTimeoutException { + return (DurableSession) attachInternal(attachInfo, timeoutMilliseconds); + } + + /** + * Attach to an existing session with session id + * + * @param attachInfo + * the attach info + * @return the durable session instance + * @throws SessionException + * If an exception occurred while trying to connect to an + * existing session + */ + public static DurableSession attachSession(SessionAttachInfo attachInfo) + throws SessionException, SocketTimeoutException { + return attachSession(attachInfo, 0); + } + + /** + * the help function to check the sanity of SessionStartInfo before creating + * a session + * + * @param startInfo + */ + protected static void checkSessionStartInfo(SessionStartInfo startInfo) { + SessionBase.checkSessionStartInfo(startInfo); + if (TransportScheme.valueOf(startInfo.getTransportScheme().get(0)) != TransportScheme.Http) { + throw new UnsupportedOperationException( + SR.v("TransportSchemeNotSupport")); + } + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/SessionBase.java b/src/com/microsoft/hpc/scheduler/session/SessionBase.java index 4f7f02b..71b3c62 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionBase.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionBase.java @@ -1,564 +1,565 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// The implementation of the SessionBase Class -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session; - -import java.net.SocketTimeoutException; -import java.util.Date; -import java.util.List; - -import javax.xml.ws.Holder; -import javax.xml.ws.WebServiceException; - -import com.microsoft.hpc.exceptions.SOAFaultCode; -import com.microsoft.hpc.sessionlauncher.SessionInfo; - -/** - * The common part for the session - * - */ -public class SessionBase -{ - public static Version NoServiceVersion = new Version(0, 0); - - /** - * the client version - */ - private static Version clientVersion = new Version(3, 2); - - /* - * the Magic Infinite date - */ - private static Date Infinite = new Date(); - - /** - * the endpoint address - */ - private String _endpointReference; - - /** - * The schema for broker - */ - @SuppressWarnings("unused") - private final TransportScheme _schema; - - /** - * the scheduler headnode name - */ - private final String _headnode; - - private final SessionInfo _info; - - private final int serviceJobId; - - protected CxfBrokerLauncherClient _brokerclient; - - String _username; - - String _password; - - // It can't be constructed outside - SessionBase(SessionInfo info, String headnode) { - serviceJobId = info.getId(); - _schema = TransportScheme.valueOf(info.getTransportScheme().get(0)); - - for (String uri : info.getBrokerEpr().getValue().getString()) { - if (uri != null && uri != "") { - _endpointReference = uri; - // this will automatically get the priority order - break; - } - } - - this._info = info; - this._headnode = headnode; - } - - SessionInfo getInfo() { - return _info; - } - - // public ISchedulerJob ServiceJob - // Java clients are unable to connect to the scheduler - - public int getId() { - return serviceJobId; - } - - /** - * Get the default endpoint reference for the load balancer of this session - * - * @return endpoint address - */ - public String getEndpointReference() { - return _endpointReference; - } - - /** - * the client version - * - * @return client version number - */ - public Version getClientVersion() { - return clientVersion; - } - - public Version getServerVersion() { - SessionAttachInfo attachInfo = new SessionAttachInfo(this._headnode, 0, - this._username, this._password); - CxfSessionLauncherClient client = new CxfSessionLauncherClient( - attachInfo); - - try { - return client.getServerVersion(); - } catch (SessionException e) { - return null; - } - } - - /** - * the help function to check the sanity of SessionStartInfo before creating - * session - * - * @param startInfo - */ - protected static void checkSessionStartInfo(SessionStartInfo startInfo) { - Utility.throwIfNull(startInfo, "startInfo"); - Utility.throwIfNull(startInfo.getHeadnode(), "startInfo.headnode"); - - startInfo.Validate(); - } - - static SessionBase createSessionInternal( - SessionStartInfo startInfo, int timeoutMilliseconds, Boolean durable) - throws SocketTimeoutException, SessionException { - Date targetTimeout; - - SessionBase.checkCredential(startInfo); - - SessionBase.checkSessionStartInfo(startInfo); - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException(SR.v("InvalidTimeout")); - } - - if (timeoutMilliseconds != 0) - targetTimeout = new Date(System.currentTimeMillis() - + timeoutMilliseconds); - else - targetTimeout = Infinite; - - if (!startInfo.getTransportScheme().contains( - TransportScheme.Http.getName())) { - throw new SessionException("Transport scheme not implemented: " - + TransportScheme.Http.getName()); - } - - if (NoServiceVersion.equals(startInfo.getServiceVersion())) { - startInfo.setServiceVersion(null); - } - - CxfSessionLauncherClient client = new CxfSessionLauncherClient( - startInfo); - - CxfBrokerLauncherClient brokerLauncher = null; - Exception innerException = null; - Version serviceVersion = null; - client.setTimeout(getTimeout(targetTimeout)); - - try { - int sessionid = 0; - List eprs = null; - - try { - SessionBase.checkCredential(startInfo); - client.UpdateCredential(startInfo.getUsername(), - startInfo.getPassword()); - String serviceVersionStr; - - Holder id = new Holder(); - Holder version = new Holder(); - if (durable) { - eprs = client.allocateDurable(startInfo, id, version); - } else { - eprs = client.allocate(startInfo, id, version); - } - serviceVersionStr = version.value; - sessionid = id.value; - if (serviceVersionStr != null && serviceVersionStr.length() > 0) { - serviceVersion = new Version(serviceVersionStr); - } - } catch (SessionException ex) { - if (ex.getErrorCode() == SOAFaultCode.AuthenticationFailure - .getCode()) { - throw new SecurityException(); - } else - throw ex; - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", - timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } catch (Exception e) { - throw new SessionException(e); - } - - if(!startInfo.isUseSessionPool()) { - if (eprs == null || eprs.size() == 0) { - throw new SessionException(SR.v("NoBrokerNodeFound")); - } - } - else { - if(eprs == null) { - SessionAttachInfo attachInfo = new SessionAttachInfo(startInfo.getHeadnode(), sessionid, - startInfo.getUsername(), startInfo.getPassword()); - return attachInternal(attachInfo, timeoutMilliseconds); - } - } - - for (String epr : eprs) { - brokerLauncher = new CxfBrokerLauncherClient( - startInfo.getUsername(), startInfo.getPassword(), epr); - - brokerLauncher.setTimeout(getTimeout(targetTimeout)); - - try { - SessionInfo info; - - startInfo.setServiceVersion(serviceVersion); - if (!durable) { - info = brokerLauncher.create(startInfo, sessionid); - } else { - info = brokerLauncher.createDurable(startInfo, - sessionid); - } - - SessionBase session; - if (!durable) { - session = new Session(info, startInfo.getHeadnode(), - startInfo.isShareSession()); - } else { - session = new DurableSession(info, - startInfo.getHeadnode()); - } - - // fill up the data - session._brokerclient = brokerLauncher; - session._password = startInfo.getPassword(); - session._username = startInfo.getUsername(); - return session; - - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConectBrokerLauncherTimeout", - timeoutMilliseconds)); - } else { - innerException = we; - } - } catch (Exception e) { - innerException = e; - } - } - - // if the innerException is not null, then the related job should be - // submited, then need terminate the job here. - if (innerException != null) { - try { - client.terminate(sessionid); - } catch (Exception e) { - // if terminate the session failed, do nothing - } - } - } finally { - ;// SafeCloseCommunicateObject... - } - - throw new SessionException(SR.v("NoBrokerNodeAnswered"), innerException); - - } - - // protected virtual void Dispose(Boolean disposing) - // no scheduler to dispose - public void dispose() { - if (this._brokerclient != null) { - this._brokerclient.destory(); - this._brokerclient = null; - } - } - - protected void finalize() { - dispose(); - } - - protected void checkDispose() { - if (this._brokerclient == null) - throw new IllegalStateException(); - } - - /** - * Close the session Java Changes: Resource will be released by GC - * - * @throws Exception - */ - public void close() throws SessionException, SocketTimeoutException { - close(true); - } - - /** - * Close the session - * - * @param purge - * if true, will remove the data in the server - * @throws Exception - */ - public void close(Boolean purge) throws SessionException, - SocketTimeoutException { - close(purge, 0); - } - - /** - * Close the session and release the resource - * - * @param purge - * if true, we will remove the data from the server - * @param timeoutMilliseconds - * timeout for the purge operation - * @throws SessionException - * , TimeoutException - */ - public void close(boolean purge, int timeoutMilliseconds) - throws SessionException, SocketTimeoutException { - checkDispose(); - - if (timeoutMilliseconds < 0) - throw new IllegalArgumentException( - "timeoutMilliseconds is invalid."); - - try { - if (purge) { - this._brokerclient.setTimeout(timeoutMilliseconds); - this._brokerclient.close(getId()); - } - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } catch (Exception ex) { - throw new SessionException(ex); - } - } - - // static internal void SaveCredential(SOATraceSource traceSource, - // SessionStartInfo info) - // don't really need to save credentials in the cache - - static SessionBase attachInternal( - final SessionAttachInfo attachInfo, long timeoutMilliseconds) - throws SessionException, SocketTimeoutException { - Date targetTimeout; - - Utility.throwIfNull(attachInfo, "attachInfo"); - if (attachInfo.getHeadnode() == null || attachInfo.getHeadnode() == "") { - throw new IllegalArgumentException(SR.v("HeadnodeCantBeNull")); - } - - if (timeoutMilliseconds < 0) { - throw new IllegalArgumentException( - "timeoutMilliseconds is invalid."); - } - - if (timeoutMilliseconds == 0) { - targetTimeout = Infinite; - } else { - targetTimeout = new Date(System.currentTimeMillis() - + timeoutMilliseconds); - } - - CxfSessionLauncherClient client = new CxfSessionLauncherClient( - attachInfo); - SessionInfo info = null; - - client.setTimeout(getTimeout(targetTimeout)); - try { - info = client.getInfo(attachInfo.getId()); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConnectSessionLauncherTimeout", timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } catch (Exception e) { - throw new SessionException(e); - } - - if (info.getBrokerLauncherEpr() == null - || info.getBrokerLauncherEpr().getValue() == "") { - for (String state : info.getJobState()) { - if (state.equalsIgnoreCase("Configuring") - || state.equalsIgnoreCase("ExternalValidation") - || state.equalsIgnoreCase("Queued") - || state.equalsIgnoreCase("Running") - || state.equalsIgnoreCase("Submitted") - || state.equalsIgnoreCase("Validating")) { - throw new SessionException(String.format( - SR.v("AttachConfiguringSession"), - attachInfo.getId())); - } else { - throw new SessionException(String.format( - SR.v("AttachNoBrokerSession"), attachInfo.getId())); - } - } - } - - CxfBrokerLauncherClient broker = new CxfBrokerLauncherClient( - attachInfo.getUsername(), attachInfo.getPassword(), info - .getBrokerLauncherEpr().getValue()); - try { - broker.setTimeout(getTimeout(targetTimeout)); - try { - broker.attach(info); - } catch (WebServiceException we) { - if (we.getCause().getClass() == SocketTimeoutException.class) { - throw new SocketTimeoutException(SR.v( - "ConectBrokerLauncherTimeout", timeoutMilliseconds)); - } else { - throw new SessionException(we); - } - } catch (Exception e) { - throw new SessionException(e); - } - } finally { - ;// safeclose... - } - - SessionBase session; - if (!info.isDurable()) { - session = new Session(info, attachInfo.getHeadnode(), true); - } else { - session = new DurableSession(info, attachInfo.getHeadnode()); - } - - // fill up the data - session._brokerclient = broker; - session._password = attachInfo.getPassword(); - session._username = attachInfo.getUsername(); - return session; - } - - /** - * Get the time span from the targeted time - * - * @param targetTimeout - * @return - * @throws TimeoutException - */ - static int getTimeout(Date targetTimeout) throws SocketTimeoutException { - if (targetTimeout == Infinite) - return 0; - - Date currentTime = new Date(); - if (targetTimeout.after(currentTime)) { - return (int) (targetTimeout.getTime() - currentTime.getTime()); - } else { - throw new SocketTimeoutException(); - } - } - - /** - * Verifies if a username is specified. (This function acts differently than - * .Net version because there is no way to verify credentials in java) - * - * @param info - */ - static void checkCredential(SessionStartInfo info) { - if (info.getUsername() == null || info.getPassword() == null - || info.getUsername() == "") { - throw new IllegalArgumentException("Must specify a username"); - } - } - - /** - * Class to return the versions for a specific service - * - */ - public static Version[] GetServiceVersions(String headNode, - String serviceName, String username, String password) - throws SessionException { - if (serviceName == null || serviceName.isEmpty()) - throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull")); - - SessionAttachInfo attachInfo = new SessionAttachInfo(headNode, 0, - username, password); - CxfSessionLauncherClient client = new CxfSessionLauncherClient( - attachInfo); - return client.getServiceVersions(serviceName); - } -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// The implementation of the SessionBase Class +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session; + +import java.net.SocketTimeoutException; +import java.util.Date; +import java.util.List; + +import javax.xml.ws.Holder; +import javax.xml.ws.WebServiceException; + +import com.microsoft.hpc.exceptions.SOAFaultCode; +import com.microsoft.hpc.sessionlauncher.SessionInfo; + +/** + * The common part for the session + * + */ +public class SessionBase +{ + public static Version NoServiceVersion = new Version(0, 0); + + /** + * the client version + */ + private static Version clientVersion = new Version(4, 0); + + /* + * the Magic Infinite date + */ + private static Date Infinite = new Date(); + + /** + * the endpoint address + */ + private String _endpointReference; + + /** + * The schema for broker + */ + @SuppressWarnings("unused") + private final TransportScheme _schema; + + /** + * the scheduler headnode name + */ + private final String _headnode; + + private final SessionInfo _info; + + private final int serviceJobId; + + protected CxfBrokerLauncherClient _brokerclient; + + String _username; + + String _password; + + // It can't be constructed outside + SessionBase(SessionInfo info, String headnode) { + serviceJobId = info.getId(); + _schema = TransportScheme.valueOf(info.getTransportScheme().get(0)); + + for (String uri : info.getBrokerEpr().getValue().getString()) { + if (uri != null && uri != "") { + _endpointReference = uri; + // this will automatically get the priority order + break; + } + } + + this._info = info; + this._headnode = headnode; + } + + SessionInfo getInfo() { + return _info; + } + + // public ISchedulerJob ServiceJob + // Java clients are unable to connect to the scheduler + + public int getId() { + return serviceJobId; + } + + /** + * Get the default endpoint reference for the load balancer of this session + * + * @return endpoint address + */ + public String getEndpointReference() { + return _endpointReference; + } + + /** + * the client version + * + * @return client version number + */ + public Version getClientVersion() { + return clientVersion; + } + + public Version getServerVersion() { + SessionAttachInfo attachInfo = new SessionAttachInfo(this._headnode, 0, + this._username, this._password); + CxfSessionLauncherClient client = new CxfSessionLauncherClient( + attachInfo); + + try { + return client.getServerVersion(); + } catch (SessionException e) { + return null; + } + } + + /** + * the help function to check the sanity of SessionStartInfo before creating + * session + * + * @param startInfo + */ + protected static void checkSessionStartInfo(SessionStartInfo startInfo) { + Utility.throwIfNull(startInfo, "startInfo"); + Utility.throwIfNull(startInfo.getHeadnode(), "startInfo.headnode"); + + startInfo.Validate(); + } + + static SessionBase createSessionInternal( + SessionStartInfo startInfo, int timeoutMilliseconds, Boolean durable) + throws SocketTimeoutException, SessionException { + Date targetTimeout; + + SessionBase.checkCredential(startInfo); + + SessionBase.checkSessionStartInfo(startInfo); + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException(SR.v("InvalidTimeout")); + } + + if (timeoutMilliseconds != 0) + targetTimeout = new Date(System.currentTimeMillis() + + timeoutMilliseconds); + else + targetTimeout = Infinite; + + String transportScheme = startInfo.getTransportScheme().get(0); + if (transportScheme != TransportScheme.Http.getName() && + transportScheme != TransportScheme.Custom.getName()) { + throw new IllegalArgumentException( + SR.v("TransportSchemeNotSupport")); + } + + if (NoServiceVersion.equals(startInfo.getServiceVersion())) { + startInfo.setServiceVersion(null); + } + + CxfSessionLauncherClient client = new CxfSessionLauncherClient( + startInfo); + + CxfBrokerLauncherClient brokerLauncher = null; + Exception innerException = null; + Version serviceVersion = null; + client.setTimeout(getTimeout(targetTimeout)); + + try { + int sessionid = 0; + List eprs = null; + + try { + SessionBase.checkCredential(startInfo); + client.UpdateCredential(startInfo.getUsername(), + startInfo.getPassword()); + String serviceVersionStr; + + Holder id = new Holder(); + Holder version = new Holder(); + if (durable) { + eprs = client.allocateDurable(startInfo, id, version); + } else { + eprs = client.allocate(startInfo, id, version); + } + serviceVersionStr = version.value; + sessionid = id.value; + if (serviceVersionStr != null && serviceVersionStr.length() > 0) { + serviceVersion = new Version(serviceVersionStr); + } + } catch (SessionException ex) { + if (ex.getErrorCode() == SOAFaultCode.AuthenticationFailure + .getCode()) { + throw new SecurityException(); + } else + throw ex; + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", + timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } catch (Exception e) { + throw new SessionException(e); + } + + if(!startInfo.isUseSessionPool()) { + if (eprs == null || eprs.size() == 0) { + throw new SessionException(SR.v("NoBrokerNodeFound")); + } + } + else { + if(eprs == null) { + SessionAttachInfo attachInfo = new SessionAttachInfo(startInfo.getHeadnode(), sessionid, + startInfo.getUsername(), startInfo.getPassword()); + return attachInternal(attachInfo, timeoutMilliseconds); + } + } + + for (String epr : eprs) { + brokerLauncher = new CxfBrokerLauncherClient( + startInfo.getUsername(), startInfo.getPassword(), epr); + + brokerLauncher.setTimeout(getTimeout(targetTimeout)); + + try { + SessionInfo info; + + startInfo.setServiceVersion(serviceVersion); + if (!durable) { + info = brokerLauncher.create(startInfo, sessionid); + } else { + info = brokerLauncher.createDurable(startInfo, + sessionid); + } + + SessionBase session; + if (!durable) { + session = new Session(info, startInfo.getHeadnode(), + startInfo.isShareSession()); + } else { + session = new DurableSession(info, + startInfo.getHeadnode()); + } + + // fill up the data + session._brokerclient = brokerLauncher; + session._password = startInfo.getPassword(); + session._username = startInfo.getUsername(); + return session; + + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConectBrokerLauncherTimeout", + timeoutMilliseconds)); + } else { + innerException = we; + } + } catch (Exception e) { + innerException = e; + } + } + + // if the innerException is not null, then the related job should be + // submited, then need terminate the job here. + if (innerException != null) { + try { + client.terminate(sessionid); + } catch (Exception e) { + // if terminate the session failed, do nothing + } + } + } finally { + ;// SafeCloseCommunicateObject... + } + + throw new SessionException(SR.v("NoBrokerNodeAnswered"), innerException); + + } + + // protected virtual void Dispose(Boolean disposing) + // no scheduler to dispose + public void dispose() { + if (this._brokerclient != null) { + this._brokerclient.destory(); + this._brokerclient = null; + } + } + + protected void finalize() { + dispose(); + } + + protected void checkDispose() { + if (this._brokerclient == null) + throw new IllegalStateException(); + } + + /** + * Close the session Java Changes: Resource will be released by GC + * + * @throws Exception + */ + public void close() throws SessionException, SocketTimeoutException { + close(true); + } + + /** + * Close the session + * + * @param purge + * if true, will remove the data in the server + * @throws Exception + */ + public void close(Boolean purge) throws SessionException, + SocketTimeoutException { + close(purge, 0); + } + + /** + * Close the session and release the resource + * + * @param purge + * if true, we will remove the data from the server + * @param timeoutMilliseconds + * timeout for the purge operation + * @throws SessionException + * , TimeoutException + */ + public void close(boolean purge, int timeoutMilliseconds) + throws SessionException, SocketTimeoutException { + checkDispose(); + + if (timeoutMilliseconds < 0) + throw new IllegalArgumentException( + "timeoutMilliseconds is invalid."); + + try { + if (purge) { + this._brokerclient.setTimeout(timeoutMilliseconds); + this._brokerclient.close(getId()); + } + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } catch (Exception ex) { + throw new SessionException(ex); + } + } + + // static internal void SaveCredential(SOATraceSource traceSource, + // SessionStartInfo info) + // don't really need to save credentials in the cache + + static SessionBase attachInternal( + final SessionAttachInfo attachInfo, long timeoutMilliseconds) + throws SessionException, SocketTimeoutException { + Date targetTimeout; + + Utility.throwIfNull(attachInfo, "attachInfo"); + if (attachInfo.getHeadnode() == null || attachInfo.getHeadnode() == "") { + throw new IllegalArgumentException(SR.v("HeadnodeCantBeNull")); + } + + if (timeoutMilliseconds < 0) { + throw new IllegalArgumentException( + "timeoutMilliseconds is invalid."); + } + + if (timeoutMilliseconds == 0) { + targetTimeout = Infinite; + } else { + targetTimeout = new Date(System.currentTimeMillis() + + timeoutMilliseconds); + } + + CxfSessionLauncherClient client = new CxfSessionLauncherClient( + attachInfo); + SessionInfo info = null; + + client.setTimeout(getTimeout(targetTimeout)); + try { + info = client.getInfo(attachInfo.getId()); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConnectSessionLauncherTimeout", timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } catch (Exception e) { + throw new SessionException(e); + } + + if (info.getBrokerLauncherEpr() == null + || info.getBrokerLauncherEpr().getValue() == "") { + for (String state : info.getJobState()) { + if (state.equalsIgnoreCase("Configuring") + || state.equalsIgnoreCase("ExternalValidation") + || state.equalsIgnoreCase("Queued") + || state.equalsIgnoreCase("Running") + || state.equalsIgnoreCase("Submitted") + || state.equalsIgnoreCase("Validating")) { + throw new SessionException(String.format( + SR.v("AttachConfiguringSession"), + attachInfo.getId())); + } else { + throw new SessionException(String.format( + SR.v("AttachNoBrokerSession"), attachInfo.getId())); + } + } + } + + CxfBrokerLauncherClient broker = new CxfBrokerLauncherClient( + attachInfo.getUsername(), attachInfo.getPassword(), info + .getBrokerLauncherEpr().getValue()); + try { + broker.setTimeout(getTimeout(targetTimeout)); + try { + broker.attach(info); + } catch (WebServiceException we) { + if (we.getCause().getClass() == SocketTimeoutException.class) { + throw new SocketTimeoutException(SR.v( + "ConectBrokerLauncherTimeout", timeoutMilliseconds)); + } else { + throw new SessionException(we); + } + } catch (Exception e) { + throw new SessionException(e); + } + } finally { + ;// safeclose... + } + + SessionBase session; + if (!info.isDurable()) { + session = new Session(info, attachInfo.getHeadnode(), true); + } else { + session = new DurableSession(info, attachInfo.getHeadnode()); + } + + // fill up the data + session._brokerclient = broker; + session._password = attachInfo.getPassword(); + session._username = attachInfo.getUsername(); + return session; + } + + /** + * Get the time span from the targeted time + * + * @param targetTimeout + * @return + * @throws TimeoutException + */ + static int getTimeout(Date targetTimeout) throws SocketTimeoutException { + if (targetTimeout == Infinite) + return 0; + + Date currentTime = new Date(); + if (targetTimeout.after(currentTime)) { + return (int) (targetTimeout.getTime() - currentTime.getTime()); + } else { + throw new SocketTimeoutException(); + } + } + + /** + * Verifies if a username is specified. (This function acts differently than + * .Net version because there is no way to verify credentials in java) + * + * @param info + */ + static void checkCredential(SessionStartInfo info) { + if (info.getUsername() == null || info.getPassword() == null + || info.getUsername() == "") { + throw new IllegalArgumentException("Must specify a username"); + } + } + + /** + * Class to return the versions for a specific service + * + */ + public static Version[] GetServiceVersions(String headNode, + String serviceName, String username, String password) + throws SessionException { + if (serviceName == null || serviceName.isEmpty()) + throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull")); + + SessionAttachInfo attachInfo = new SessionAttachInfo(headNode, 0, + username, password); + CxfSessionLauncherClient client = new CxfSessionLauncherClient( + attachInfo); + return client.getServiceVersions(serviceName); + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java b/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java index 646f380..b3bed17 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java @@ -1,954 +1,981 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// SessionStart Info class -// -//------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session; - -import java.util.HashMap; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import com.microsoft.hpc.SessionStartInfoContract; -import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; -import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring; - -/** - * This class includes the parameters for modifying - * SessionStartInfo for a session. - * - *

- * Subclass of com.microsoft.hpc.SessionStartInfo designed to be a - * simplified version that does not use ObjectFactories for the JAXBElements - * needed for Java SOA. - *

- * - * the use of this class is required as it contains the headnode variable, while - * the SessionStartInfo in - * com.microsoft.hpc.SessionStartInfo does not and should not be - * used (ie. import com.microsoft.hpc.SessionStartInfo; should - * NEVER be called explicitly).

- * - * @see com.microsoft.hpc.SessionStartInfo - * @see com.microsoft.hpc.ObjectFactory - * @see JAXBElement - */ -public class SessionStartInfo -{ - private static com.microsoft.hpc.ObjectFactory factory = new com.microsoft.hpc.ObjectFactory(); - private com.microsoft.hpc.SessionStartInfoContract contract = factory - .createSessionStartInfoContract(); - - private String headnode; - private String username; - private String password; - - /** - * default constructor to set the default values - */ - SessionStartInfo() { - contract.setRuntime(-1); - contract.setShareSession(false); - contract.setSecure(true); - contract.getTransportScheme().add("Http"); - } - - /** - * Initializes an instance of the SessionStartInfo class with a parameter - * for headnode, service, username, and password. - * - *

- * SessionStartInfo is initialized with the following default values: - *

- *

- * TransportScheme = [Http]; - *

- *

- * Runtime = 3600; (seconds, == 1 hr) - *

- *

- * ShareSession = false; - *

- * - * @param headnode - * headnode you wish to connect to - * @param service - * service name you wish to use - * @param username - * username - * @param password - * password - */ - public SessionStartInfo(String headnode, String service, String username, - String password) { - this(); - - this.setHeadnode(headnode); - - // specify the default value. - contract.setServiceName(factory - .createSessionStartInfoContractServiceName(service)); - - Utility.throwIfNullOrEmpty(username, "username"); - Utility.throwIfNull(password, "password"); - - this.username = username; - this.password = password; - - setRunAsUsername(this.username); - setRunAsPassword(this.password); - } - - /** - * Initializes an instance of the SessionStartInfo class with a parameter - * for headnode, service - * - *

- * SessionStartInfo is initialized with the following default values: - *

- *

- * TransportScheme = [Http]; - *

- *

- * Runtime = 3600; (seconds, == 1 hr) - *

- *

- * ShareSession = false; - *

- *

- * Username = HpcJava.user - *

- *

- * Password = HpcJava.pass - *

- * - * @param headnode - * headnode you wish to connect to - * @param service - * service name you wish to use - * @see HpcJava#setUsernamePassword(String, String) - */ - public SessionStartInfo(String headnode, String service) { - this(headnode, service, HpcJava.getUsername(), HpcJava.getPassword()); - } - - /** - * Initializes an instance of the SessionStartInfo class with a parameter - * for headnode, service - * - * @param headnode - * @param service - * @param serviceVersion - */ - public SessionStartInfo(String headnode, String service, - Version serviceVersion) { - this(headnode, service, serviceVersion, HpcJava.getUsername(), HpcJava - .getPassword()); - } - - /** - * Initializes an instance of the SessionStartInfo class with a parameter - * for headnode, service - * - *

- * SessionStartInfo is initialized with the following default values: - *

- *

- * TransportScheme = [Http]; - *

- *

- * Runtime = 3600; (seconds, == 1 hr) - *

- *

- * ShareSession = false; - *

- *

- * Username = HpcJava.user - *

- *

- * Password = HpcJava.pass - *

- * - * @param headnode - * headnode you wish to connect to - * @param service - * service name you wish to use - * @param serviceVersion - * the service version you wish to use - * @see HpcJava#setUsernamePassword(String, String) - */ - public SessionStartInfo(String headnode, String service, - Version serviceVersion, String username, String password) { - this(); - - this.setHeadnode(headnode); - - contract.setServiceName(factory - .createSessionStartInfoContractServiceName(service)); - - org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version(); - - ver.setMajor(serviceVersion.getMajor()); - ver.setMinor(serviceVersion.getMinor()); - ver.setBuild(serviceVersion.getBuild()); - ver.setRevision(serviceVersion.getRevision()); - - contract.setServiceVersion(factory - .createSessionStartInfoContractServiceVersion(ver)); - - Utility.throwIfNullOrEmpty(username, "username"); - Utility.throwIfNull(password, "password"); - - this.username = username; - this.password = password; - setRunAsUsername(this.username); - setRunAsPassword(this.password); - } - - /** - * Gets the headnode value - * - * @return headnode value - */ - public String getHeadnode() { - return headnode; - } - - /** - * Gets the Job Template - * - * @return JobTemplate value - */ - public String getJobTemplate() { - if (contract.getJobTemplate() == null) - return "Default"; - return contract.getJobTemplate().getValue(); - } - - /** - * Gets the number of maximum units (cores) to allocate - * - * @return maximumUnits value - */ - public Integer getMaxUnits() { - if (contract.getMaxUnits() == null) - return 0; - return contract.getMaxUnits().getValue(); - } - - /** - * Gets the number of minimum units (cores) to allocate - * - * @return minUnits value - */ - public Integer getMinUnits() { - if (contract.getMinUnits() == null) - return 0; - return contract.getMinUnits().getValue(); - } - - /** - * Gets the node group string - * - * @return NodeGroupsStr value - */ - public String getNodeGroups() { - if (contract.getNodeGroupsStr() == null) - return null; - return contract.getNodeGroupsStr().getValue(); - } - - /** - * Gets the plain text password value to be passed over SSL - * - * @return plain text password value - */ - String getPassword() { - return this.password; - } - - /** - * Gets the priority of the job - * - * @return priority value - */ - public Integer getPriority() { - if (contract.getPriority() == null) - return 0; - return contract.getPriority().getValue(); - } - - /** - * gets the requested nodes string - * - * @return RequestedNodesStr value - */ - public String getRequestedNodesStr() { - if (contract.getRequestedNodesStr() == null) - return null; - return contract.getRequestedNodesStr().getValue(); - } - - /** - * Gets the maximum runtime length in seconds - * - * @return Runtime value in seconds - */ - public Integer getRuntime() { - int time = contract.getRuntime(); - return time == -1 ? 0 : time; - } - - /** - * Gets the Service Job Name (name of the job is different from service) - * - * @return ServiceJobName value - */ - public String getServiceJobName() { - if (contract.getServiceJobName() == null) - return null; - return contract.getServiceJobName().getValue(); - } - - /** - * Gets the Service name - * - * @return ServiceName value - */ - public String getServiceName() { - return contract.getServiceName().getValue(); - } - - /** - * Gets the transport Scheme - * - * @return a list of TranportSchemes - */ - public List getTransportScheme() { - return contract.getTransportScheme(); - } - - /** - * Gets the username - * - * @return username value - */ - public String getUsername() { - return this.username; - } - - /** - * Sets the headnode to connect to - * - * @param headnode - * headnode to connect - */ - void setHeadnode(String headnode) { - this.headnode = headnode; - } - - /** - * Sets the job template - * - * @param template - * Job template to use - */ - public void setJobTemplate(String template) { - contract.setJobTemplate(factory - .createSessionStartInfoContractJobTemplate(template)); - } - - /** - * Sets the maximum units (cores) to allocate - * - * @param maximumUnits - * minimum number of cores to allocate - */ - public void setMaxUnits(Integer maximumUnits) { - contract.setMaxUnits(factory - .createSessionStartInfoContractMaxUnits(maximumUnits)); - } - - /** - * Sets the minimum units (cores) to allocate - * - * @param MinUnits - * minimum number of cores to allocate - */ - public void setMinUnits(Integer minUnits) { - contract.setMinUnits(factory - .createSessionStartInfoContractMinUnits(minUnits)); - } - - /** - * Sets the node groups to use - * - * @param nodeGroups - * node groups string - */ - public void setNodeGroupsStr(String nodeGroups) { - contract.setNodeGroupsStr(factory - .createSessionStartInfoContractNodeGroupsStr(nodeGroups)); - } - - /** - * Sets the password in plain text to be sent over SSL - * - * @param password - * password in plain text - */ - public void setRunAsPassword(String password) { - contract.setPassword(factory - .createSessionStartInfoContractPassword(password)); - } - - /** - * Sets the priority of the job - * - * @param priority - * Priority value - */ - public void setPriority(Integer priority) { - contract.setPriority(factory - .createSessionStartInfoContractPriority(priority)); - } - - /** - * Sets the project value - * - * @param project - * Project value - */ - public void setServiceJobProject(String project) { - contract.setServiceJobProject(factory - .createSessionStartInfoContractServiceJobProject(project)); - } - - /** - * Get service job project property - * - * @return - */ - public String getServiceJobProject() { - if (contract.getServiceJobProject() != null) - return contract.getServiceJobProject().getValue(); - else - return null; - } - - /** - * Sets the requested nodes string - * - * @param nodes - * requestedNodes string - */ - public void setRequestedNodesStr(String nodes) { - contract.setRequestedNodesStr(factory - .createSessionStartInfoContractRequestedNodesStr(nodes)); - } - - /** - * Sets the resourceUnit type - * - * @param unit - * JobUnitType enum - */ - public void setResourceUnitType(SessionUnitType unit) { - contract.setResourceUnitType(factory - .createSessionStartInfoContractResourceUnitType(unit.ordinal())); - } - - /** - * Sets the job runtime in seconds - * - * @param runtime - * in seconds - */ - public void setRuntime(Integer runtime) { - if (runtime == 0) - contract.setRuntime(-1); - contract.setRuntime(runtime); - } - - /** - * Sets the jobname - * - * @param jobname - * name of the job - */ - public void setServiceJobName(String jobname) { - contract.setServiceJobName(factory - .createSessionStartInfoContractServiceJobName(jobname)); - } - - /** - * Sets the service name to use - * - * @param servicename - * name of the service - */ - public void setServiceName(String servicename) { - contract.setServiceName(factory - .createSessionStartInfoContractServiceName(servicename)); - } - - /** - * Sets the username to Run the job - * - * @param username - * username - */ - public void setRunAsUsername(String username) { - contract.setUsername(factory - .createSessionStartInfoContractUsername(username)); - } - - /** - * Get the runas user name. if it doesn't set before, the username will be returned. - * @return - */ - public String getRunAsUsername() { - return contract.getUsername().getValue(); - } - - /** - * Returns the allocation grow load ratio threshold - * - * @return AllocationGrowLoadRatioThreshold value - * @see #allocationShrinkLoadRatioThreshold() - */ - public int getAllocationGrowLoadRatioThreshold() { - if (contract.getAllocationGrowLoadRatioThreshold() == null) - return 0; - return contract.getAllocationGrowLoadRatioThreshold().getValue(); - } - - /** - * Returns the allocation shrink load ratio threshold - * - * @return AllocationShrinkLoadRatioThreshold value - */ - public int getAllocationShrinkLoadRatioThreshold() { - if (contract.getAllocationShrinkLoadRatioThreshold() == null) - return 0; - return contract.getAllocationShrinkLoadRatioThreshold().getValue(); - } - - /** - * Returns the client idle timeout - * - * @return ClientIdleTimeout value - */ - public int clientIdleTimeout() { - if (contract.getClientIdleTimeout() == null) - return 0; - return contract.getClientIdleTimeout().getValue(); - } - - /** - * Returns messages throttle start threshold - * - * @return MessagesThrottleStartThreshold value - */ - public int messagesThrottleStartThreshold() { - if (contract.getMessagesThrottleStartThreshold() == null) - return 0; - return contract.getMessagesThrottleStartThreshold().getValue(); - } - - /** - * Returns the messages throttle stop threshold - * - * @return MessagesThrottleStopThreshold value - */ - public int messagesThrottleStopThreshold() { - if (contract.getMessagesThrottleStopThreshold() == null) - return 0; - return contract.getMessagesThrottleStopThreshold().getValue(); - } - - /** - * Returns the session idle timeout - * - * @return SessionIdleTimeout value - */ - public int sessionIdleTimeout() { - if (contract.getSessionIdleTimeout() == null) - return 0; - return contract.getSessionIdleTimeout().getValue(); - } - - /** - * Sets the allocation grow load ratio threshold - * - * @param value - * This value must be greater than or equal to - * AllocationShrinkLoadRatioThreshold - * @see #allocationShrinkLoadRatioThreshold() - */ - public void setAllocationGrowLoadRatioThreshold(int value) { - contract.setAllocationGrowLoadRatioThreshold(factory - .createSessionStartInfoContractAllocationGrowLoadRatioThreshold(value)); - } - - /** - * Sets the allocation shrink load ratio threshold - * - * @param value - * This value must be less than or equal to - * AllocationGrowLoadRatioThreshold - * @see #allocationGrowLoadRatioThreshold() - */ - public void setAllocationShrinkLoadRatioThreshold(int value) { - contract.setAllocationShrinkLoadRatioThreshold(factory - .createSessionStartInfoContractAllocationShrinkLoadRatioThreshold(value)); - } - - /** - * Sets the client idle timeout - * - * @param value - * The value must be greater than zero - */ - public void setClientIdleTimeout(int value) { - contract.setClientIdleTimeout(factory - .createSessionStartInfoContractClientIdleTimeout(value)); - } - - /** - * Sets the messages throttle start threshold - * - * @param value - * The value must be less than or greater than - * MessagesThrottleStopThreshold - * @see #messagesThrottleStopThreshold() - */ - public void setMessagesThrottleStartThreshold(int value) { - contract.setMessagesThrottleStartThreshold(factory - .createSessionStartInfoContractMessagesThrottleStartThreshold(value)); - } - - /** - * Sets the messages throttle stop threshold - * - * @param value - * The value must be greater than or less than - * MessagesThrottleStartThreshold - * @see #messagesThrottleStartThreshold() - */ - public void setMessagesThrottleStopThreshold(int value) { - contract.setMessagesThrottleStopThreshold(factory - .createSessionStartInfoContractMessagesThrottleStopThreshold(value)); - } - - /** - * Sets the session idle timeout - * - * @param value - * This value must greater than zero - */ - public void setSessionIdleTimeout(int value) { - contract.setSessionIdleTimeout(factory - .createSessionStartInfoContractSessionIdleTimeout(value)); - } - - /** - * Convert to CXF sessionStartInfo. This method is internal use. - * - * @return - */ - public SessionStartInfoContract GetContractInfo() { - return this.contract; - } - - public void Validate() { - if (contract.getServiceName() == null) { - throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull")); - } - if (contract.getClientIdleTimeout() != null - && contract.getClientIdleTimeout().getValue() <= 0) { - throw new IllegalArgumentException( - SR.v("ClientIdleTimeoutNotNegative")); - } - if (contract.getSessionIdleTimeout() != null - && contract.getSessionIdleTimeout().getValue() < 0) { - throw new IllegalArgumentException( - SR.v("SessionIdleTimeoutNotNegative")); - } - if (contract.getMessagesThrottleStopThreshold() != null - && contract.getMessagesThrottleStopThreshold().getValue() < 0) { - throw new IllegalArgumentException( - SR.v("MessageThrottleStopThresholdPositive")); - } - if (contract.getMessagesThrottleStopThreshold() != null - && (contract.getMessagesThrottleStartThreshold() == null || contract - .getMessagesThrottleStartThreshold().getValue() <= contract - .getMessagesThrottleStopThreshold().getValue())) { - throw new IllegalArgumentException( - SR.v("MessageThrottleStartGreaterStop")); - } - if (contract.getMessagesThrottleStartThreshold() != null - && contract.getMessagesThrottleStartThreshold().getValue() < 0) { - throw new IllegalArgumentException( - SR.v("MessageThrottleStartGreaterStop")); - } - if (contract.getAllocationShrinkLoadRatioThreshold() != null - && contract.getAllocationShrinkLoadRatioThreshold().getValue() < 0) { - throw new IllegalArgumentException( - SR.v("AllocationShrinkLoadRatioThresholdNonNegative")); - } - if (contract.getAllocationShrinkLoadRatioThreshold() != null - && (contract.getAllocationGrowLoadRatioThreshold() == null || contract - .getAllocationGrowLoadRatioThreshold().getValue() <= contract - .getAllocationShrinkLoadRatioThreshold().getValue())) { - throw new IllegalArgumentException( - SR.v("LoadRatioGrowGreaterThanShrink")); - } - if(this.isUseSessionPool() && !this.isShareSession()) { - throw new IllegalArgumentException(SR.v("UnsharedSession_NotSupportSessionPool")); - } - } - - /** - * Set the service version - * - * @param serviceVersion - */ - public void setServiceVersion(Version serviceVersion) { - if (serviceVersion == null) { - contract.setServiceVersion(null); - return; - } - - org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version(); - - ver.setMajor(serviceVersion.getMajor()); - ver.setMinor(serviceVersion.getMinor()); - ver.setBuild(serviceVersion.getBuild()); - ver.setRevision(serviceVersion.getRevision()); - - contract.setServiceVersion(factory - .createSessionStartInfoContractServiceVersion(ver)); - - } - - /* - * Get the service version. If not set, return null. - */ - public Version getServiceVersion() { - JAXBElement ver = contract - .getServiceVersion(); - - if (ver != null) { - org.datacontract.schemas._2004._07.system.Version version = ver - .getValue(); - return new Version(version.getMajor(), version.getMinor(), - version.getRevision(), version.getBuild()); - } - - return null; - } - - /** - * check if the session is secured - * - * @return - */ - public Boolean isSecure() { - return contract.isSecure(); - } - - /** - * Check if the session is shared - * - * @return - */ - public Boolean isShareSession() { - if(contract.isShareSession() == null) { - return false; - } - else { - return contract.isShareSession(); - } - } - - /** - * set if the session is secure - * - * @param value - */ - public void setSecure(Boolean value) { - contract.setSecure(value); - } - - /** - * set if the session is shared - * - * @param value - */ - public void setShareSession(Boolean value) { - contract.setShareSession(value); - } - - /** - * get the resource unit type - * - * @return - */ - public SessionUnitType getResourceUnitType() { - if (contract.getResourceUnitType() != null) { - - switch (contract.getResourceUnitType().getValue()) { - case 0: - return SessionUnitType.Core; - case 1: - return SessionUnitType.Socket; - case 2: - return SessionUnitType.Node; - } - } - return SessionUnitType.Core; - } - - /** - * Set if the service job is preemptable - * - * @param value - */ - public void setPreemptive(boolean value) { - contract.setCanPreempt(factory - .createSessionStartInfoContractCanPreempt(value)); - } - - /** - * if the service job is preemptable - * - * @return - */ - public boolean isPreemptive() { - if (contract.getCanPreempt() == null) - return false; - return contract.getCanPreempt().getValue(); - } - - /** - * Add one job environment variable - * - * @param name - * @param value - */ - public void addEnvironment(String name, String value) { - ArrayOfKeyValueOfstringstring envs; - if (contract.getEnvironments() == null) - envs = new ArrayOfKeyValueOfstringstring(); - else - envs = contract.getEnvironments().getValue(); - KeyValueOfstringstring v = new KeyValueOfstringstring(); - v.setKey(name); - v.setValue(value); - envs.getKeyValueOfstringstring().add(v); - contract.setEnvironments(factory - .createSessionStartInfoContractEnvironments(envs)); - } - - /** - * Get the list of environments - * - * @return - */ - public HashMap getEnvironments() { - HashMap result = new HashMap(); - ArrayOfKeyValueOfstringstring list; - if (contract.getEnvironments() != null) { - list = contract.getEnvironments().getValue(); - for (KeyValueOfstringstring s : list.getKeyValueOfstringstring()) { - result.put(s.getKey(), s.getValue()); - } - } - - return result; - } - - /** - * if the session uses session pool - * @return - */ - public Boolean isUseSessionPool() - { - if(contract.isUseSessionPool() == null) { - return false; - } - else { - return contract.isUseSessionPool(); - } - } - - /** - * Set if the session uses session pool - * @param value - */ - public void setUseSessionPool(Boolean value) - { - contract.setUseSessionPool(value); - } -} +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// SessionStart Info class +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session; + +import java.util.HashMap; +import java.util.List; + +import javax.xml.bind.JAXBElement; + +import com.microsoft.hpc.SessionStartInfoContract; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring; + +/** + * This class includes the parameters for modifying + * SessionStartInfo for a session. + * + *

+ * Subclass of com.microsoft.hpc.SessionStartInfo designed to be a + * simplified version that does not use ObjectFactories for the JAXBElements + * needed for Java SOA. + *

+ * + * the use of this class is required as it contains the headnode variable, while + * the SessionStartInfo in + * com.microsoft.hpc.SessionStartInfo does not and should not be + * used (ie. import com.microsoft.hpc.SessionStartInfo; should + * NEVER be called explicitly).

+ * + * @see com.microsoft.hpc.SessionStartInfo + * @see com.microsoft.hpc.ObjectFactory + * @see JAXBElement + */ +public class SessionStartInfo +{ + private static com.microsoft.hpc.ObjectFactory factory = new com.microsoft.hpc.ObjectFactory(); + private com.microsoft.hpc.SessionStartInfoContract contract = factory + .createSessionStartInfoContract(); + + private String headnode; + private String username; + private String password; + + /** + * default constructor to set the default values + */ + SessionStartInfo() { + contract.setRuntime(-1); + contract.setShareSession(false); + contract.setSecure(true); + contract.getTransportScheme().add("Http"); + } + + /** + * Initializes an instance of the SessionStartInfo class with a parameter + * for headnode, service, username, and password. + * + *

+ * SessionStartInfo is initialized with the following default values: + *

+ *

+ * TransportScheme = [Http]; + *

+ *

+ * Runtime = 3600; (seconds, == 1 hr) + *

+ *

+ * ShareSession = false; + *

+ * + * @param headnode + * headnode you wish to connect to + * @param service + * service name you wish to use + * @param username + * username + * @param password + * password + */ + public SessionStartInfo(String headnode, String service, String username, + String password) { + this(); + + this.setHeadnode(headnode); + + // specify the default value. + contract.setServiceName(factory + .createSessionStartInfoContractServiceName(service)); + + Utility.throwIfNullOrEmpty(username, "username"); + Utility.throwIfNull(password, "password"); + + this.username = username; + this.password = password; + + setRunAsUsername(this.username); + setRunAsPassword(this.password); + } + + /** + * Initializes an instance of the SessionStartInfo class with a parameter + * for headnode, service + * + *

+ * SessionStartInfo is initialized with the following default values: + *

+ *

+ * TransportScheme = [Http]; + *

+ *

+ * Runtime = 3600; (seconds, == 1 hr) + *

+ *

+ * ShareSession = false; + *

+ *

+ * Username = HpcJava.user + *

+ *

+ * Password = HpcJava.pass + *

+ * + * @param headnode + * headnode you wish to connect to + * @param service + * service name you wish to use + * @see HpcJava#setUsernamePassword(String, String) + */ + public SessionStartInfo(String headnode, String service) { + this(headnode, service, HpcJava.getUsername(), HpcJava.getPassword()); + } + + /** + * Initializes an instance of the SessionStartInfo class with a parameter + * for headnode, service + * + * @param headnode + * @param service + * @param serviceVersion + */ + public SessionStartInfo(String headnode, String service, + Version serviceVersion) { + this(headnode, service, serviceVersion, HpcJava.getUsername(), HpcJava + .getPassword()); + } + + /** + * Initializes an instance of the SessionStartInfo class with a parameter + * for headnode, service + * + *

+ * SessionStartInfo is initialized with the following default values: + *

+ *

+ * TransportScheme = [Http]; + *

+ *

+ * Runtime = 3600; (seconds, == 1 hr) + *

+ *

+ * ShareSession = false; + *

+ *

+ * Username = HpcJava.user + *

+ *

+ * Password = HpcJava.pass + *

+ * + * @param headnode + * headnode you wish to connect to + * @param service + * service name you wish to use + * @param serviceVersion + * the service version you wish to use + * @see HpcJava#setUsernamePassword(String, String) + */ + public SessionStartInfo(String headnode, String service, + Version serviceVersion, String username, String password) { + this(); + + this.setHeadnode(headnode); + + contract.setServiceName(factory + .createSessionStartInfoContractServiceName(service)); + + org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version(); + + ver.setMajor(serviceVersion.getMajor()); + ver.setMinor(serviceVersion.getMinor()); + ver.setBuild(serviceVersion.getBuild()); + ver.setRevision(serviceVersion.getRevision()); + + contract.setServiceVersion(factory + .createSessionStartInfoContractServiceVersion(ver)); + + Utility.throwIfNullOrEmpty(username, "username"); + Utility.throwIfNull(password, "password"); + + this.username = username; + this.password = password; + setRunAsUsername(this.username); + setRunAsPassword(this.password); + } + + /** + * Gets the headnode value + * + * @return headnode value + */ + public String getHeadnode() { + return headnode; + } + + /** + * Gets the Job Template + * + * @return JobTemplate value + */ + public String getJobTemplate() { + if (contract.getJobTemplate() == null) + return "Default"; + return contract.getJobTemplate().getValue(); + } + + /** + * Gets the number of maximum units (cores) to allocate + * + * @return maximumUnits value + */ + public Integer getMaxUnits() { + if (contract.getMaxUnits() == null) + return 0; + return contract.getMaxUnits().getValue(); + } + + /** + * Gets the number of minimum units (cores) to allocate + * + * @return minUnits value + */ + public Integer getMinUnits() { + if (contract.getMinUnits() == null) + return 0; + return contract.getMinUnits().getValue(); + } + + /** + * Gets the node group string + * + * @return NodeGroupsStr value + */ + public String getNodeGroups() { + if (contract.getNodeGroupsStr() == null) + return null; + return contract.getNodeGroupsStr().getValue(); + } + + /** + * Gets the plain text password value to be passed over SSL + * + * @return plain text password value + */ + String getPassword() { + return this.password; + } + + /** + * Gets the priority of the job + * + * @return priority value + */ + public Integer getPriority() { + if (contract.getPriority() == null) + return 0; + return contract.getPriority().getValue(); + } + + /** + * Gets the session priority of the job + * + * @return priority value + */ + public Integer getSessionPriority() { + if (contract.getExtendedPriority() == null) + return 0; + return contract.getExtendedPriority().getValue(); + } + + /** + * gets the requested nodes string + * + * @return RequestedNodesStr value + */ + public String getRequestedNodesStr() { + if (contract.getRequestedNodesStr() == null) + return null; + return contract.getRequestedNodesStr().getValue(); + } + + /** + * Gets the maximum runtime length in seconds + * + * @return Runtime value in seconds + */ + public Integer getRuntime() { + int time = contract.getRuntime(); + return time == -1 ? 0 : time; + } + + /** + * Gets the Service Job Name (name of the job is different from service) + * + * @return ServiceJobName value + */ + public String getServiceJobName() { + if (contract.getServiceJobName() == null) + return null; + return contract.getServiceJobName().getValue(); + } + + /** + * Gets the Service name + * + * @return ServiceName value + */ + public String getServiceName() { + return contract.getServiceName().getValue(); + } + + /** + * Gets the transport Scheme + * + * @return a list of TranportSchemes + */ + public List getTransportScheme() { + return contract.getTransportScheme(); + } + + public void setTransportScheme(String transportScheme) { + contract.getTransportScheme().clear(); + contract.getTransportScheme().add(transportScheme); + } + + /** + * Gets the username + * + * @return username value + */ + public String getUsername() { + return this.username; + } + + /** + * Sets the headnode to connect to + * + * @param headnode + * headnode to connect + */ + void setHeadnode(String headnode) { + this.headnode = headnode; + } + + /** + * Sets the job template + * + * @param template + * Job template to use + */ + public void setJobTemplate(String template) { + contract.setJobTemplate(factory + .createSessionStartInfoContractJobTemplate(template)); + } + + /** + * Sets the maximum units (cores) to allocate + * + * @param maximumUnits + * minimum number of cores to allocate + */ + public void setMaxUnits(Integer maximumUnits) { + contract.setMaxUnits(factory + .createSessionStartInfoContractMaxUnits(maximumUnits)); + } + + /** + * Sets the minimum units (cores) to allocate + * + * @param MinUnits + * minimum number of cores to allocate + */ + public void setMinUnits(Integer minUnits) { + contract.setMinUnits(factory + .createSessionStartInfoContractMinUnits(minUnits)); + } + + /** + * Sets the node groups to use + * + * @param nodeGroups + * node groups string + */ + public void setNodeGroupsStr(String nodeGroups) { + contract.setNodeGroupsStr(factory + .createSessionStartInfoContractNodeGroupsStr(nodeGroups)); + } + + /** + * Sets the password in plain text to be sent over SSL + * + * @param password + * password in plain text + */ + public void setRunAsPassword(String password) { + contract.setPassword(factory + .createSessionStartInfoContractPassword(password)); + } + + /** + * Sets the priority of the job + * + * @param priority + * Priority value + */ + public void setPriority(Integer priority) { + contract.setPriority(factory + .createSessionStartInfoContractPriority(priority)); + } + + /** + * Sets the session priority of the job + * + * @param priority + * Priority value + */ + public void setSessionPriority(Integer priority) { + contract.setExtendedPriority(factory + .createSessionStartInfoContractExtendedPriority(priority)); + } + + /** + * Sets the project value + * + * @param project + * Project value + */ + public void setServiceJobProject(String project) { + contract.setServiceJobProject(factory + .createSessionStartInfoContractServiceJobProject(project)); + } + + /** + * Get service job project property + * + * @return + */ + public String getServiceJobProject() { + if (contract.getServiceJobProject() != null) + return contract.getServiceJobProject().getValue(); + else + return null; + } + + /** + * Sets the requested nodes string + * + * @param nodes + * requestedNodes string + */ + public void setRequestedNodesStr(String nodes) { + contract.setRequestedNodesStr(factory + .createSessionStartInfoContractRequestedNodesStr(nodes)); + } + + /** + * Sets the resourceUnit type + * + * @param unit + * JobUnitType enum + */ + public void setResourceUnitType(SessionUnitType unit) { + contract.setResourceUnitType(factory + .createSessionStartInfoContractResourceUnitType(unit.ordinal())); + } + + /** + * Sets the job runtime in seconds + * + * @param runtime + * in seconds + */ + public void setRuntime(Integer runtime) { + if (runtime == 0) + contract.setRuntime(-1); + contract.setRuntime(runtime); + } + + /** + * Sets the jobname + * + * @param jobname + * name of the job + */ + public void setServiceJobName(String jobname) { + contract.setServiceJobName(factory + .createSessionStartInfoContractServiceJobName(jobname)); + } + + /** + * Sets the service name to use + * + * @param servicename + * name of the service + */ + public void setServiceName(String servicename) { + contract.setServiceName(factory + .createSessionStartInfoContractServiceName(servicename)); + } + + /** + * Sets the username to Run the job + * + * @param username + * username + */ + public void setRunAsUsername(String username) { + contract.setUsername(factory + .createSessionStartInfoContractUsername(username)); + } + + /** + * Get the runas user name. if it doesn't set before, the username will be returned. + * @return + */ + public String getRunAsUsername() { + return contract.getUsername().getValue(); + } + + /** + * Returns the allocation grow load ratio threshold + * + * @return AllocationGrowLoadRatioThreshold value + * @see #allocationShrinkLoadRatioThreshold() + */ + public int getAllocationGrowLoadRatioThreshold() { + if (contract.getAllocationGrowLoadRatioThreshold() == null) + return 0; + return contract.getAllocationGrowLoadRatioThreshold().getValue(); + } + + /** + * Returns the allocation shrink load ratio threshold + * + * @return AllocationShrinkLoadRatioThreshold value + */ + public int getAllocationShrinkLoadRatioThreshold() { + if (contract.getAllocationShrinkLoadRatioThreshold() == null) + return 0; + return contract.getAllocationShrinkLoadRatioThreshold().getValue(); + } + + /** + * Returns the client idle timeout + * + * @return ClientIdleTimeout value + */ + public int clientIdleTimeout() { + if (contract.getClientIdleTimeout() == null) + return 0; + return contract.getClientIdleTimeout().getValue(); + } + + /** + * Returns messages throttle start threshold + * + * @return MessagesThrottleStartThreshold value + */ + public int messagesThrottleStartThreshold() { + if (contract.getMessagesThrottleStartThreshold() == null) + return 0; + return contract.getMessagesThrottleStartThreshold().getValue(); + } + + /** + * Returns the messages throttle stop threshold + * + * @return MessagesThrottleStopThreshold value + */ + public int messagesThrottleStopThreshold() { + if (contract.getMessagesThrottleStopThreshold() == null) + return 0; + return contract.getMessagesThrottleStopThreshold().getValue(); + } + + /** + * Returns the session idle timeout + * + * @return SessionIdleTimeout value + */ + public int sessionIdleTimeout() { + if (contract.getSessionIdleTimeout() == null) + return 0; + return contract.getSessionIdleTimeout().getValue(); + } + + /** + * Sets the allocation grow load ratio threshold + * + * @param value + * This value must be greater than or equal to + * AllocationShrinkLoadRatioThreshold + * @see #allocationShrinkLoadRatioThreshold() + */ + public void setAllocationGrowLoadRatioThreshold(int value) { + contract.setAllocationGrowLoadRatioThreshold(factory + .createSessionStartInfoContractAllocationGrowLoadRatioThreshold(value)); + } + + /** + * Sets the allocation shrink load ratio threshold + * + * @param value + * This value must be less than or equal to + * AllocationGrowLoadRatioThreshold + * @see #allocationGrowLoadRatioThreshold() + */ + public void setAllocationShrinkLoadRatioThreshold(int value) { + contract.setAllocationShrinkLoadRatioThreshold(factory + .createSessionStartInfoContractAllocationShrinkLoadRatioThreshold(value)); + } + + /** + * Sets the client idle timeout + * + * @param value + * The value must be greater than zero + */ + public void setClientIdleTimeout(int value) { + contract.setClientIdleTimeout(factory + .createSessionStartInfoContractClientIdleTimeout(value)); + } + + /** + * Sets the messages throttle start threshold + * + * @param value + * The value must be less than or greater than + * MessagesThrottleStopThreshold + * @see #messagesThrottleStopThreshold() + */ + public void setMessagesThrottleStartThreshold(int value) { + contract.setMessagesThrottleStartThreshold(factory + .createSessionStartInfoContractMessagesThrottleStartThreshold(value)); + } + + /** + * Sets the messages throttle stop threshold + * + * @param value + * The value must be greater than or less than + * MessagesThrottleStartThreshold + * @see #messagesThrottleStartThreshold() + */ + public void setMessagesThrottleStopThreshold(int value) { + contract.setMessagesThrottleStopThreshold(factory + .createSessionStartInfoContractMessagesThrottleStopThreshold(value)); + } + + /** + * Sets the session idle timeout + * + * @param value + * This value must greater than zero + */ + public void setSessionIdleTimeout(int value) { + contract.setSessionIdleTimeout(factory + .createSessionStartInfoContractSessionIdleTimeout(value)); + } + + /** + * Convert to CXF sessionStartInfo. This method is internal use. + * + * @return + */ + public SessionStartInfoContract GetContractInfo() { + return this.contract; + } + + public void Validate() { + if (contract.getServiceName() == null) { + throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull")); + } + if (contract.getClientIdleTimeout() != null + && contract.getClientIdleTimeout().getValue() <= 0) { + throw new IllegalArgumentException( + SR.v("ClientIdleTimeoutNotNegative")); + } + if (contract.getSessionIdleTimeout() != null + && contract.getSessionIdleTimeout().getValue() < 0) { + throw new IllegalArgumentException( + SR.v("SessionIdleTimeoutNotNegative")); + } + if (contract.getMessagesThrottleStopThreshold() != null + && contract.getMessagesThrottleStopThreshold().getValue() < 0) { + throw new IllegalArgumentException( + SR.v("MessageThrottleStopThresholdPositive")); + } + if (contract.getMessagesThrottleStopThreshold() != null + && (contract.getMessagesThrottleStartThreshold() == null || contract + .getMessagesThrottleStartThreshold().getValue() <= contract + .getMessagesThrottleStopThreshold().getValue())) { + throw new IllegalArgumentException( + SR.v("MessageThrottleStartGreaterStop")); + } + if (contract.getMessagesThrottleStartThreshold() != null + && contract.getMessagesThrottleStartThreshold().getValue() < 0) { + throw new IllegalArgumentException( + SR.v("MessageThrottleStartGreaterStop")); + } + if (contract.getAllocationShrinkLoadRatioThreshold() != null + && contract.getAllocationShrinkLoadRatioThreshold().getValue() < 0) { + throw new IllegalArgumentException( + SR.v("AllocationShrinkLoadRatioThresholdNonNegative")); + } + if (contract.getAllocationShrinkLoadRatioThreshold() != null + && (contract.getAllocationGrowLoadRatioThreshold() == null || contract + .getAllocationGrowLoadRatioThreshold().getValue() <= contract + .getAllocationShrinkLoadRatioThreshold().getValue())) { + throw new IllegalArgumentException( + SR.v("LoadRatioGrowGreaterThanShrink")); + } + if(this.isUseSessionPool() && !this.isShareSession()) { + throw new IllegalArgumentException(SR.v("UnsharedSession_NotSupportSessionPool")); + } + } + + /** + * Set the service version + * + * @param serviceVersion + */ + public void setServiceVersion(Version serviceVersion) { + if (serviceVersion == null) { + contract.setServiceVersion(null); + return; + } + + org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version(); + + ver.setMajor(serviceVersion.getMajor()); + ver.setMinor(serviceVersion.getMinor()); + ver.setBuild(serviceVersion.getBuild()); + ver.setRevision(serviceVersion.getRevision()); + + contract.setServiceVersion(factory + .createSessionStartInfoContractServiceVersion(ver)); + + } + + /* + * Get the service version. If not set, return null. + */ + public Version getServiceVersion() { + JAXBElement ver = contract + .getServiceVersion(); + + if (ver != null) { + org.datacontract.schemas._2004._07.system.Version version = ver + .getValue(); + return new Version(version.getMajor(), version.getMinor(), + version.getRevision(), version.getBuild()); + } + + return null; + } + + /** + * check if the session is secured + * + * @return + */ + public Boolean isSecure() { + return contract.isSecure(); + } + + /** + * Check if the session is shared + * + * @return + */ + public Boolean isShareSession() { + if(contract.isShareSession() == null) { + return false; + } + else { + return contract.isShareSession(); + } + } + + /** + * set if the session is secure + * + * @param value + */ + public void setSecure(Boolean value) { + contract.setSecure(value); + } + + /** + * set if the session is shared + * + * @param value + */ + public void setShareSession(Boolean value) { + contract.setShareSession(value); + } + + /** + * get the resource unit type + * + * @return + */ + public SessionUnitType getResourceUnitType() { + if (contract.getResourceUnitType() != null) { + + switch (contract.getResourceUnitType().getValue()) { + case 0: + return SessionUnitType.Core; + case 1: + return SessionUnitType.Socket; + case 2: + return SessionUnitType.Node; + } + } + return SessionUnitType.Core; + } + + /** + * Set if the service job is preemptable + * + * @param value + */ + public void setPreemptive(boolean value) { + contract.setCanPreempt(factory + .createSessionStartInfoContractCanPreempt(value)); + } + + /** + * if the service job is preemptable + * + * @return + */ + public boolean isPreemptive() { + if (contract.getCanPreempt() == null) + return false; + return contract.getCanPreempt().getValue(); + } + + /** + * Add one job environment variable + * + * @param name + * @param value + */ + public void addEnvironment(String name, String value) { + ArrayOfKeyValueOfstringstring envs; + if (contract.getEnvironments() == null) + envs = new ArrayOfKeyValueOfstringstring(); + else + envs = contract.getEnvironments().getValue(); + KeyValueOfstringstring v = new KeyValueOfstringstring(); + v.setKey(name); + v.setValue(value); + envs.getKeyValueOfstringstring().add(v); + contract.setEnvironments(factory + .createSessionStartInfoContractEnvironments(envs)); + } + + /** + * Get the list of environments + * + * @return + */ + public HashMap getEnvironments() { + HashMap result = new HashMap(); + ArrayOfKeyValueOfstringstring list; + if (contract.getEnvironments() != null) { + list = contract.getEnvironments().getValue(); + for (KeyValueOfstringstring s : list.getKeyValueOfstringstring()) { + result.put(s.getKey(), s.getValue()); + } + } + + return result; + } + + /** + * if the session uses session pool + * @return + */ + public Boolean isUseSessionPool() + { + if(contract.isUseSessionPool() == null) { + return false; + } + else { + return contract.isUseSessionPool(); + } + } + + /** + * Set if the session uses session pool + * @param value + */ + public void setUseSessionPool(Boolean value) + { + contract.setUseSessionPool(value); + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java index 2e6f2af..3ef1556 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java @@ -1,89 +1,123 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Java trace level converter -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session.servicecontext; - -/** - * @author t-junchw - * @date May 16, 2011 - * @description Convert the ETW trace level to java trace level - */ -public enum JavaTraceLevelConverterEnum { - - Verbose("ALL"), - Critical("SEVERE"), - Information("INFO"), - Off("OFF"), - Warning("WARNING"), - Error("SEVERE"); - - private final String value; - - JavaTraceLevelConverterEnum(String value) { - this.value = value; - } - public String getValue() { - return value; - } +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Java trace level converter +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session.servicecontext; + +/** + * @author t-junchw + * @date May 16, 2011 + * @description Convert the ETW trace level to java trace level + */ +public enum JavaTraceLevelConverterEnum { + Off("OFF"), + + Critical("SEVERE"), + Error("SEVERE"), + Warning("WARNING"), + + // below are only available in System.Diagnostics.TraceEventType + Start("START"), + Stop("STOP"), + Suspend("SUSPEND"), + Resume("RESUME"), + Transfer("TRANSFER"), + + Information("INFO"), + Verbose("ALL"); + + private final String value; + + JavaTraceLevelConverterEnum(String value) { + this.value = value; + } + public String getValue() { + return value; + } + + public static JavaTraceLevelConverterEnum convertFromInteger(int value) { + switch(value) { + case 0: + return Off; + case 1: + return Critical; + case 2: + return Error; + case 4: + return Warning; + case 8: + return Information; + case 16: + return Verbose; + case 256: + case 512: + case 1024: + case 2048: + case 4096: + return Information; + } + return null; + } + + } \ No newline at end of file diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java index bfce949..0fd2036 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java @@ -1,201 +1,219 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// capture Ctrl-C signal to invoke Exiting event handler -// Log runtime information -// expose common data interface -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session.servicecontext; - -import java.util.logging.Level; -import com.microsoft.hpc.exceptions.DataErrorCode; -import com.microsoft.hpc.exceptions.DataException; -import com.microsoft.hpc.scheduler.session.DataClient; -import com.microsoft.hpc.scheduler.session.Constant; - - -/** - * @author t-junchw The implementation of the Service Context Class - */ -public final class ServiceContext -{ - public static ExitEventRegister exitingEvents = new ExitEventRegister(); - - /** - * @field the instance of logger to do the service tracing - */ - public static LoggerContext Logger; - - /** - * @field lock object for bDataServerInfoInitialized - */ - private static Object lockDataServerInfoInitialized = new Object(); - - // - // a flag indicating if dataServerInfo has been initialized - // - private static Boolean bDataServerInfoInitialized = false; - - /** - * @field the soa data server information - */ - private static String dataServerAddress; - - /** - * @field unrecoverable data exception that happens on data server info - * initialization - */ - private static DataException DataServerInfoConfigException; - - /** - * @param traceLevel - */ - public static void setTraceLevel(String traceLevel) - { - if (Logger == null) - { - Logger = new LoggerContext(traceLevel); - } - } - - /** - * @description Used to manually fire Exiting event. Called within session - * API and from service host when shrinking service instances - * - * @param sender - * event sender - * @param args - * event args. - * @param traceSource - * the trace source - */ - @SuppressWarnings("unused") - private static void fireExitingEvent(Sender sender, SOAEventArg args, - int millis) - { - ServiceContext.Logger.traceEvent(Level.WARNING, - StringResource.getResource("ServiceHostcanceledbyscheduler")); - - if (exitingEvents != null) - { - try - { - // millis stands for limited time for execution - if (millis > 0) - // execute event asynchronously - exitingEvents.onExitingAsynchronized(sender, args, millis); - else - { - // execute event synchronously - exitingEvents.onExiting(sender, args); - } - } catch (Exception e) - { - ServiceContext.Logger - .traceEvent( - Level.WARNING, - String.format( - "[HpcServiceHost]: Exception thrown when firing OnExiting event - %s", - e.toString())); - } - } - } - - /** - * @description Get the DataClient instance with the specified DataClient ID - * @param dataClientId - * @param username - * @param password - * @return - * @throws DataException - */ - public static DataClient getDataClient(String dataClientId) throws DataException - { - synchronized (lockDataServerInfoInitialized) - { - if (!bDataServerInfoInitialized) { - String strDataServerInfo = Environment - .getEnvironmentVariable(Constant.SoaDataServerInfoEnvVar); - if (strDataServerInfo != null && !strDataServerInfo.isEmpty()) { - dataServerAddress = strDataServerInfo; - } else { - dataServerAddress = null; - ServiceContext.Logger - .traceEvent(Level.SEVERE, - "[ServiceContext] .GetDataClient: no data server configured"); - DataServerInfoConfigException = new DataException( - DataErrorCode.NoDataServerConfigured.getCode(), - StringResource - .getResource("NoDataServerConfigured")); - } - // ensure this code block is only executed once - bDataServerInfoInitialized = true; - } - } - - if(dataServerAddress != null) { - return DataClient.open(dataServerAddress, dataClientId); - } else { - throw DataServerInfoConfigException; - } - } -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// capture Ctrl-C signal to invoke Exiting event handler +// Log runtime information +// expose common data interface +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session.servicecontext; + +import java.util.logging.Level; +import com.microsoft.hpc.exceptions.DataErrorCode; +import com.microsoft.hpc.exceptions.DataException; +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.Constant; + + +/** + * @author t-junchw The implementation of the Service Context Class + */ +public final class ServiceContext +{ + public static ExitEventRegister exitingEvents = new ExitEventRegister(); + + /** + * @field the instance of logger to do the service tracing + */ + public static LoggerContext Logger; + + + /** + * @field lock object for bDataServerInfoInitialized + */ + private static Object lockDataServerInfoInitialized = new Object(); + + // + // a flag indicating if dataServerInfo has been initialized + // + private static Boolean bDataServerInfoInitialized = false; + + /** + * @field the soa data server information + */ + private static String dataServerAddress; + + /** + * @field unrecoverable data exception that happens on data server info + * initialization + */ + private static DataException DataServerInfoConfigException; + + /** + * @param traceLevel + */ + public static void setTraceLevel(String traceLevel) + { + if (Logger == null) + { + Logger = new LoggerContext(traceLevel); + } + } + + private static JavaTraceLevelConverterEnum soaDiagTraceLevel = JavaTraceLevelConverterEnum.Off; + + public static void setSoaDiagTraceLevel(String traceLevel) + { + try { + soaDiagTraceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel); + } catch (Exception e) { + // just swallow the enum parse exception, and fallback to Off trace level + } + } + + public static JavaTraceLevelConverterEnum getSoaDiagTraceLevel() + { + return soaDiagTraceLevel; + } + + + /** + * @description Used to manually fire Exiting event. Called within session + * API and from service host when shrinking service instances + * + * @param sender + * event sender + * @param args + * event args. + * @param traceSource + * the trace source + */ + @SuppressWarnings("unused") + private static void fireExitingEvent(Sender sender, SOAEventArg args, + int millis) + { + ServiceContext.Logger.traceEvent(Level.WARNING, + StringResource.getResource("ServiceHostcanceledbyscheduler")); + + if (exitingEvents != null) + { + try + { + // millis stands for limited time for execution + if (millis > 0) + // execute event asynchronously + exitingEvents.onExitingAsynchronized(sender, args, millis); + else + { + // execute event synchronously + exitingEvents.onExiting(sender, args); + } + } catch (Exception e) + { + ServiceContext.Logger + .traceEvent( + Level.WARNING, + String.format( + "[HpcServiceHost]: Exception thrown when firing OnExiting event - %s", + e.toString())); + } + } + } + + /** + * @description Get the DataClient instance with the specified DataClient ID + * @param dataClientId + * @param username + * @param password + * @return + * @throws DataException + */ + public static DataClient getDataClient(String dataClientId) throws DataException + { + synchronized (lockDataServerInfoInitialized) + { + if (!bDataServerInfoInitialized) { + String strDataServerInfo = Environment + .getEnvironmentVariable(Constant.SoaDataServerInfoEnvVar); + if (strDataServerInfo != null && !strDataServerInfo.isEmpty()) { + dataServerAddress = strDataServerInfo; + } else { + dataServerAddress = null; + ServiceContext.Logger + .traceEvent(Level.SEVERE, + "[ServiceContext] .GetDataClient: no data server configured"); + DataServerInfoConfigException = new DataException( + DataErrorCode.NoDataServerConfigured.getCode(), + StringResource + .getResource("NoDataServerConfigured")); + } + // ensure this code block is only executed once + bDataServerInfoInitialized = true; + } + } + + if(dataServerAddress != null) { + return DataClient.open(dataServerAddress, dataClientId); + } else { + throw DataServerInfoConfigException; + } + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java index 3e415c6..f0827f6 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java @@ -1,247 +1,297 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Save the Service Registration Information -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.scheduler.session.servicecontext; - -import org.w3c.dom.DOMException; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import com.microsoft.hpc.properties.ErrorCode; - -/** - * @author t-junchw - * @date May 10, 2011 - * @description store the service registration information - */ -public class ServiceRegistration -{ - - public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration"; - public final String serviceDiagnosticsName = "system.diagnostics"; - private final String sourcesNodeName = "sources"; - private final String sourceNodeName = "source"; - private final String traceLevelAttributeName = "switchValue"; - private final String serviceNodeName = "service"; - private final String assemblyAttributeName = "assembly"; - private final String serviceContractAttributeName = "contract"; - private final String serviceTypeAttributeName = "ServiceType"; - private final String includeFaultedExceptionAttributeName = "includeFaultedException"; - public Node serviceConfigNode = null; - public String serviceAssemblyFullPath = null; - public String traceLevel = "OFF"; - private boolean includeFaultedException; - - public boolean isIncludeFaultedException() - { - return includeFaultedException; - } - - /** - * @field user service type name - */ - public String serviceTypeName; - - /** - * @field user service Contact name - */ - public String serviceContractName; - - /** - * @return serviceTypeName - */ - public String getServiceTypeName() - { - return serviceTypeName; - } - - /** - * @return serviceContractName - */ - public String getServiceContractName() - { - return serviceContractName; - } - - /** - * @field user jar file name - */ - public String serviceAssemblyFileName; - - /** - * @description parse the XML node list to get the service registration settings - * @param nodelist - */ - public void setserviceConfigNode(NodeList nodelist) - { - NodeList serviceConfigurationNodeList = nodelist; - if (serviceConfigurationNodeList != null) - { - // get the user jar setting information - Node rootNode = serviceConfigurationNodeList.item(0); - for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode - .getNextSibling()) - { - if (rootNode.getNodeName() == serviceNodeName) - { - serviceConfigNode = rootNode; - NamedNodeMap map = serviceConfigNode.getAttributes(); - try - { - serviceAssemblyFullPath = map.getNamedItem( - assemblyAttributeName).getNodeValue(); - } catch (DOMException e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); - } - - try - { - serviceContractName = map.getNamedItem( - serviceContractAttributeName).getNodeValue(); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - - try - { - serviceTypeName = map.getNamedItem( - serviceTypeAttributeName).getNodeValue(); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - - try - { - includeFaultedException = Boolean.parseBoolean(map - .getNamedItem( - includeFaultedExceptionAttributeName) - .getNodeValue()); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - } - } - } - } - - /** - * @description parse the XML node list to get the java trace level - * @param nodeList - */ - public void setLoggerLevel(NodeList nodeList) - { - if (nodeList != null) - { - // get the java trace setting information - Node rootNode = nodeList.item(0); - for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode - .getNextSibling()) - { - if (rootNode.getNodeName() == sourcesNodeName) - { - for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode - .getNextSibling()) - { - if (subNode.getNodeName() == sourceNodeName) - { - NamedNodeMap map = subNode.getAttributes(); - try - { - traceLevel = map.getNamedItem( - traceLevelAttributeName).getNodeValue(); - traceLevel = traceLevel.substring(0, - traceLevel.indexOf(',')); - - // transfer the ETW trace level to java version - traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue(); - break; - } catch (DOMException e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); - } - } - } - } - } - } - } - - /** - * @return serviceAssemblyFullPath - */ - public String getServiceAssemblyFullPath() - { - return serviceAssemblyFullPath; - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Save the Service Registration Information +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session.servicecontext; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import com.microsoft.hpc.properties.ErrorCode; + +/** + * @author t-junchw + * @date May 10, 2011 + * @description store the service registration information + */ +public class ServiceRegistration +{ + + public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration"; + public final String serviceDiagnosticsName = "system.diagnostics"; + private final String sourcesNodeName = "sources"; + private final String sourceNodeName = "source"; + private final String traceLevelAttributeName = "switchValue"; + private final String serviceNodeName = "service"; + private final String assemblyAttributeName = "assembly"; + private final String serviceContractAttributeName = "contract"; + private final String serviceTypeAttributeName = "ServiceType"; + private final String includeFaultedExceptionAttributeName = "includeFaultedException"; + private final String textEncodingPath = "//configuration/system.serviceModel/bindings/customBinding/binding[@name='Microsoft.Hpc.BackEndBinding']/textMessageEncoding[@messageVersion='Soap11WSAddressing10']"; + private final String soaDiagTraceLevelAttributeName = "soaDiagTraceLevel"; + public Node serviceConfigNode = null; + public String serviceAssemblyFullPath = null; + public String traceLevel = "OFF"; + private boolean includeFaultedException; + private boolean enableWSAddressing = false; + public String soaDiagTraceLevel = "Off"; + + + public boolean isIncludeFaultedException() + { + return includeFaultedException; + } + + /** + * @field user service type name + */ + public String serviceTypeName; + + /** + * @field user service Contact name + */ + public String serviceContractName; + + /** + * @return serviceTypeName + */ + public String getServiceTypeName() + { + return serviceTypeName; + } + + /** + * @return serviceContractName + */ + public String getServiceContractName() + { + return serviceContractName; + } + + /** + * + * @return enableWSAddressing + */ + public Boolean getEnableWSAddressing() + { + return enableWSAddressing; + } + + /** + * @field user jar file name + */ + public String serviceAssemblyFileName; + + /** + * @description parse the XML node list to get the service registration settings + * @param nodelist + */ + public void setserviceConfigNode(NodeList nodelist) + { + NodeList serviceConfigurationNodeList = nodelist; + if (serviceConfigurationNodeList != null) + { + // get the user jar setting information + Node rootNode = serviceConfigurationNodeList.item(0); + for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode + .getNextSibling()) + { + if (rootNode.getNodeName() == serviceNodeName) + { + serviceConfigNode = rootNode; + NamedNodeMap map = serviceConfigNode.getAttributes(); + try + { + serviceAssemblyFullPath = map.getNamedItem( + assemblyAttributeName).getNodeValue(); + } catch (DOMException e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); + } + + try + { + serviceContractName = map.getNamedItem( + serviceContractAttributeName).getNodeValue(); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + serviceTypeName = map.getNamedItem( + serviceTypeAttributeName).getNodeValue(); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + includeFaultedException = Boolean.parseBoolean(map + .getNamedItem( + includeFaultedExceptionAttributeName) + .getNodeValue()); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + if(map.getNamedItem(soaDiagTraceLevelAttributeName) != null && + map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue() != null) { + soaDiagTraceLevel = map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue().split(",")[0]; + } + } catch(Exception e) { + TraceHelper.traceError(e.toString()); + } + } + } + } + } + + /** + * @description parse the XML node list to get the java trace level + * @param nodeList + */ + public void setLoggerLevel(NodeList nodeList) + { + if (nodeList != null) + { + // get the java trace setting information + Node rootNode = nodeList.item(0); + for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode + .getNextSibling()) + { + if (rootNode.getNodeName() == sourcesNodeName) + { + for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode + .getNextSibling()) + { + if (subNode.getNodeName() == sourceNodeName) + { + NamedNodeMap map = subNode.getAttributes(); + try + { + traceLevel = map.getNamedItem( + traceLevelAttributeName).getNodeValue(); + traceLevel = traceLevel.substring(0, + traceLevel.indexOf(',')); + + // transfer the ETW trace level to java version + traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue(); + break; + } catch (DOMException e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); + } + } + } + } + } + } + } + + /** + * @return serviceAssemblyFullPath + */ + public String getServiceAssemblyFullPath() + { + return serviceAssemblyFullPath; + } + + /** + * setEnableWSAddressing + * @param doc + */ + public void setEnableWSAddressing(Document doc) + { + XPath path = XPathFactory.newInstance().newXPath(); + XPathExpression expr = null; + NodeList list = null; + try { + expr = path.compile(textEncodingPath); + list = (NodeList)expr.evaluate(doc, XPathConstants.NODESET); + } catch (XPathExpressionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + enableWSAddressing = (list.getLength() == 1); + } + +} diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java new file mode 100644 index 0000000..3426500 --- /dev/null +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java @@ -0,0 +1,200 @@ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session.servicecontext.etw; + +import java.util.List; +import java.util.UUID; + +import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; +import org.apache.cxf.jaxws.context.WrappedMessageContext; +import org.apache.cxf.message.Message; +import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.CastUtils; +import org.w3c.dom.Element; + +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.servicecontext.Environment; +import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; + +/** + * @author t-hengz + * @date Aug 6, 2012 + * @description Write event with ETW + */ +public class ETWTraceEvent { + /** + * @field messageid dispatchid sessionid used for ETW + */ + private UUID messageid; + private UUID dispatchid; + private int sessionid; + private JavaTraceLevelConverterEnum traceLevel; + + /** + * @description get messageid dispatchid sessionid from headers + * @param wsContext + */ + public ETWTraceEvent(WebServiceContext wsContext) + { + //get headers + MessageContext mc = wsContext.getMessageContext(); + Message message = ((WrappedMessageContext) mc).getWrappedMessage(); + List
headers = CastUtils.cast((List) message.get(Header.HEADER_LIST)); + + //get dispatchid & messageid + for (Header h : headers) { + QName name = h.getName(); + if (name.getLocalPart().equals(Constant.DISPATCHIDLOCALPART) && + name.getNamespaceURI().equals(Constant.HpcHeaderNS)) + { + Element e = (Element) h.getObject(); + try{ + dispatchid = UUID.fromString(e.getTextContent()); + } + catch(Exception exception){ + dispatchid = null; + } + } + if (name.getLocalPart().equals(Constant.MESSAGEIDLOCALPART)) + { + Element e = (Element) h.getObject(); + //cause the format is urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + try{ + messageid = UUID.fromString(e.getTextContent().toString().substring(9)); + } + catch(Exception exception){ + messageid = null; + } + } + } + + //getsessionid + sessionid = Integer.parseInt(Environment.getEnvironmentVariable(Constant.JobIDEnvVar)); + traceLevel = ServiceContext.getSoaDiagTraceLevel(); + } + + /** + * @param TraceLevel + * @param id + * @param message + */ + public int TraceEvent(JavaTraceLevelConverterEnum TraceLevel, int id, String message) + { + return UserEvent.WriteUserEvent(TraceLevel, sessionid, messageid, dispatchid, message); + } + + /** + * + */ + public void Flush() + { + return ; + } + + /** + * @param message + */ + public int TraceInformation(String message) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, message); + } + + /** + * @param TraceLevel + * @param id + * @param data + */ + public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object data) + { + return TraceData(TraceLevel, id, new Object[]{data}); + } + + /** + * @param TraceLevel + * @param id + * @param data + */ + public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object[] data) + { + String message = ""; + boolean isfirst = true; + if (data!=null) + { + for (Object object : data) + { + if (object==null) + continue; + if (isfirst) + isfirst = false; + else + message += ","; + message += object.toString(); + + } + } + return UserEvent.WriteUserEvent(TraceLevel, sessionid, messageid, dispatchid, message); + } + + public int TraceTransfer(int id, String message, UUID relatedActivityId) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, message); + } + +} diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java new file mode 100644 index 0000000..51f8d66 --- /dev/null +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java @@ -0,0 +1,142 @@ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.scheduler.session.servicecontext.etw; + +import java.util.UUID; + +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; + +/** + * @author t-hengz + * @date Aug 6, 2012 + * @description invoke c++ method to call ETW API with JNI + */ +public class UserEvent { + /** + * @field used for checking tracehelper.dll + */ + static private boolean dllexist; + + /** + * @description load tracehelper.dll + */ + static + { + dllexist = true; + try{ + System.loadLibrary("tracehelper"); + } + catch(java.lang.UnsatisfiedLinkError e){ + dllexist = false; + } + } + + static private native int CWriteUserEvent(int Flag, int SessionId, String MessageId, String DispatchId, String msg); + + /** + * @param level + * @param sessionId + * @param messageId + * @param dispatchId + * @param msg + * + */ + static public int WriteUserEvent(JavaTraceLevelConverterEnum level, int SessionId, UUID messageid, UUID dispatchid, String msg) + { + //check if .dll exist + if(!dllexist) + return ErrorCode.ERROR_DLLNOTEXIST; + // filter by trace level + if(ServiceContext.getSoaDiagTraceLevel().ordinal() < level.ordinal()) { + return 0; + } + + //check input + if (msg==null) + return ErrorCode.ERROR_NULLMSG; + + if (messageid==null) + return ErrorCode.ERROR_INVALIDMESSAGEID; + + if (dispatchid==null) + return ErrorCode.ERROR_INVALIDDISPATCHID; + + //call c method + int status = ErrorCode.ERROR_INVALIDFLAG; + + if (level.equals(JavaTraceLevelConverterEnum.Critical)) + status = CWriteUserEvent(Constant.TRACE_CRITICAL,SessionId,messageid.toString(),dispatchid.toString(),msg); + + if (level.equals(JavaTraceLevelConverterEnum.Error)) + status = CWriteUserEvent(Constant.TRACE_ERROR,SessionId,messageid.toString(),dispatchid.toString(),msg); + + if (level.equals(JavaTraceLevelConverterEnum.Warning)) + status = CWriteUserEvent(Constant.TRACE_WARNING,SessionId,messageid.toString(),dispatchid.toString(),msg); + + if (level.equals(JavaTraceLevelConverterEnum.Information)) + status = CWriteUserEvent(Constant.TRACE_INFO,SessionId,messageid.toString(),dispatchid.toString(),msg); + + if (level.equals(JavaTraceLevelConverterEnum.Verbose)) + status = CWriteUserEvent(Constant.TRACE_VERBOSE,SessionId,messageid.toString(),dispatchid.toString(),msg); + + return status; + } + +} diff --git a/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java b/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java index 89684f6..4a94886 100644 --- a/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java +++ b/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java @@ -1,109 +1,153 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Add action header to the message when the message level preemption is enabled -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.phase.Phase; - -/** - * @author t-junchw - * @date May 16, 2011 - * @description add header to the soap message during message preemption - */ -public class AddHeaderOutInterceptor extends AbstractSoapInterceptor -{ - HpcServiceHostWrapper hpcHostWrapper; - - /** - * @param wrapper - */ - public AddHeaderOutInterceptor(HpcServiceHostWrapper wrapper) - { - super(Phase.WRITE); - this.hpcHostWrapper = wrapper; - } - - /**(non-Javadoc) - * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message) - */ - @Override - public void handleMessage(SoapMessage message) throws Fault - { - - if (hpcHostWrapper.enableMessageLevelPreemption) - { - String guid = (String) message.getExchange().get("ID"); - if (guid == null) - return ; - - InterceptorUtility.addMessageHeader(message, "Action", - "http://www.w3.org/2005/08/addressing", - com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.Action); - } - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Add action header to the message when the message level preemption is enabled +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; + +import org.apache.cxf.binding.soap.SoapFault; +import org.apache.cxf.binding.soap.SoapHeader; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor; +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.Phase; +import org.w3c.dom.Element; + +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.session.RetryOperationError; + +/** + * @author t-junchw + * @date May 16, 2011 + * @description add header to the soap message during message preemption + */ +public class AddHeaderOutInterceptor extends AbstractSoapInterceptor +{ + private static final Logger LOG = LogUtils.getL7dLogger(AddHeaderOutInterceptor.class); + HpcServiceHostWrapper hpcHostWrapper; + + /** + * @param wrapper + */ + public AddHeaderOutInterceptor(HpcServiceHostWrapper wrapper) + { + super(Phase.PRE_PROTOCOL); + this.hpcHostWrapper = wrapper; + } + + /**(non-Javadoc) + * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message) + */ + @Override + public void handleMessage(SoapMessage message) throws Fault + { + + if (hpcHostWrapper.enableMessageLevelPreemption) { + String guid = (String) message.getExchange().get("ID"); + if (guid == null) + return; + + // InterceptorUtility.addOrUpdateMessageHeader(message, "Action", + // "http://www.w3.org/2005/08/addressing", + // com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.Action); + } + + Fault f = (Fault) message.getContent(Exception.class); + QName qn = new QName("http://www.w3.org/2005/08/addressing", "Action"); + Header header = message.getHeader(qn); + if (header.getObject() != null) { + Element root = (Element) header.getObject(); + if (Pattern + .compile(Pattern.quote("RetryOperationError"), + Pattern.CASE_INSENSITIVE) + .matcher(root.getTextContent()).find()) { + root.setTextContent("http://hpc.microsoft.com/session/RetryOperationError"); + RetryOperationError error = new RetryOperationError(); + Element detailElement = InterceptorUtility + .createDetailElement(error); + f.setDetail(detailElement); + message.setContextualProperty( + org.apache.cxf.message.Message.FAULT_STACKTRACE_ENABLED, + "false"); // disable stack trace to make it compatible + // with broker + } + } + + } + +} diff --git a/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java b/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java index e02169e..3d3e24d 100644 --- a/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java +++ b/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java @@ -1,192 +1,191 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Controller Servicer to handle the Exit invoking -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import java.lang.reflect.Method; -import java.util.logging.Level; -import javax.jws.WebService; -import com.microsoft.hpc.properties.ErrorCode; -import com.microsoft.hpc.scheduler.session.servicecontext.SOAEventArg; -import com.microsoft.hpc.scheduler.session.servicecontext.Sender; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; -import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; - -/** - * @author t-junchw - * @date May 9, 2011 - * @description Controller Service working with the broker worker - */ -@WebService(targetNamespace = "http://hpc.microsoft.com/hpcservicehost/", name = "IHpcServiceHost") -public class HpcControllerSvc implements IHpcController -{ - - /** - * @field How long to wait for Exiting event to return - */ - int cancelTaskGracePeriod = 0; - - /** - * @field sessionID - */ - int sessionId = 0; - - private HpcServiceHostWrapper hostWrapper; - - /** - * @description Constructor for service host - * @param sessionId - * @param cancelTaskGracePeriod - * @param hostWrapper - */ - public HpcControllerSvc(int sessionId, int cancelTaskGracePeriod, - HpcServiceHostWrapper hostWrapper) - { - this.sessionId = sessionId; - this.cancelTaskGracePeriod = cancelTaskGracePeriod; - this.hostWrapper = hostWrapper; - } - - /** - * @description Shutdowns down service host - */ - @Override - public void Exit() - { - try - { - synchronized (this.hostWrapper.syncObjOnExitingCalled) - { - // No need to call OnExiting again if it is already called when - // Ctrl-C signal is received. - if (!this.hostWrapper.isOnExitingCalled) - { - // Invoke user's Exiting event async with a timeout - // specified by TaskCancelGracePeriod cluster parameter. - Method method = ServiceContext.class.getDeclaredMethod( - "fireExitingEvent", new Class[] { Sender.class, - SOAEventArg.class, int.class }); - method.setAccessible(true); - - // Invoke the OnExitingAsynchronized method - Sender sender = new Sender(new Object()); - SOAEventArg soaEventArg = new SOAEventArg(0); - Object[] argsObjects = { sender, soaEventArg, - cancelTaskGracePeriod }; - method.invoke(ServiceContext.class.newInstance(), - argsObjects); - - this.hostWrapper.isOnExitingCalled = true; - } - } - } catch (Exception ex) - { - ServiceContext.Logger.traceEvent(Level.WARNING, ex.toString()); - } finally - { - // remove the Ctrl-C hook from runtime - synchronized (this.hostWrapper.shutdownThread) - { - try - { - Runtime.getRuntime().removeShutdownHook( - this.hostWrapper.shutdownThread); - } catch (IllegalStateException e) - { - // If the virtual machine is already in the process of - // shutting down - this.hostWrapper.shutdownThread.notify(); - return; - } catch (Exception ex) - { - ServiceContext.Logger.traceEvent(Level.SEVERE, - ex.toString()); - return; - } - } - - // Keep the exit code the same as before. If the host is canceled by - // user or scheduler, - // it exits with -1. If the host is closed by graceful shrink, it - // exits with 0. - if (this.hostWrapper.receivedCancelEvent) - { - System.out.println(StringResource - .getResource("TaskCanceledOrPreempted")); - System.out.flush(); - ServiceContext.Logger.traceEvent(Level.INFO, - StringResource.getResource("TaskCanceledOrPreempted")); - System.exit(-1); - } else - { - System.out.println(StringResource - .getResource("ServiceShutdownFromBrokerShrink")); - System.out.flush(); - ServiceContext.Logger.traceEvent(Level.INFO, StringResource - .getResource("ServiceShutdownFromBrokerShrink")); - System.exit(ErrorCode.Success); - } - } - } -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Controller Servicer to handle the Exit invoking +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.lang.reflect.Method; +import java.util.logging.Level; +import javax.jws.WebService; +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.servicecontext.SOAEventArg; +import com.microsoft.hpc.scheduler.session.servicecontext.Sender; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; + +/** + * @author t-junchw + * @date May 9, 2011 + * @description Controller Service working with the broker worker + */ +@WebService(targetNamespace = "http://hpc.microsoft.com/hpcservicehost/", name = "IHpcServiceHost") +public class HpcControllerSvc implements IHpcController +{ + + /** + * @field How long to wait for Exiting event to return + */ + int cancelTaskGracePeriod = 0; + + /** + * @field sessionID + */ + int sessionId = 0; + + private HpcServiceHostWrapper hostWrapper; + + /** + * @description Constructor for service host + * @param sessionId + * @param cancelTaskGracePeriod + * @param hostWrapper + */ + public HpcControllerSvc(int sessionId, int cancelTaskGracePeriod, + HpcServiceHostWrapper hostWrapper) + { + this.sessionId = sessionId; + this.cancelTaskGracePeriod = cancelTaskGracePeriod; + this.hostWrapper = hostWrapper; + } + + /** + * @description Shutdowns down service host + */ + @Override + public void Exit() + { + try + { + synchronized (this.hostWrapper.syncObjOnExitingCalled) + { + // No need to call OnExiting again if it is already called when + // Ctrl-C signal is received. + if (!this.hostWrapper.isOnExitingCalled) + { + // Invoke user's Exiting event async with a timeout + // specified by TaskCancelGracePeriod cluster parameter. + Method method = ServiceContext.class.getDeclaredMethod( + "fireExitingEvent", new Class[] { Sender.class, + SOAEventArg.class, int.class }); + method.setAccessible(true); + + // Invoke the OnExitingAsynchronized method + Sender sender = new Sender(new Object()); + SOAEventArg soaEventArg = new SOAEventArg(0); + Object[] argsObjects = { sender, soaEventArg, + cancelTaskGracePeriod }; + method.invoke(ServiceContext.class.newInstance(), + argsObjects); + this.hostWrapper.isOnExitingCalled = true; + } + } + } catch (Exception ex) + { + ServiceContext.Logger.traceEvent(Level.WARNING, ex.toString()); + } finally + { + // remove the Ctrl-C hook from runtime + synchronized (this.hostWrapper.shutdownThread) + { + try + { + Runtime.getRuntime().removeShutdownHook( + this.hostWrapper.shutdownThread); + } catch (IllegalStateException e) + { + // If the virtual machine is already in the process of + // shutting down + this.hostWrapper.shutdownThread.notify(); + return; + } catch (Exception ex) + { + ServiceContext.Logger.traceEvent(Level.SEVERE, + ex.toString()); + return; + } + } + + // Keep the exit code the same as before. If the host is canceled by + // user or scheduler, + // it exits with -1. If the host is closed by graceful shrink, it + // exits with 0. + if (this.hostWrapper.receivedCancelEvent) + { + System.out.println(StringResource + .getResource("TaskCanceledOrPreempted")); + System.out.flush(); + ServiceContext.Logger.traceEvent(Level.INFO, + StringResource.getResource("TaskCanceledOrPreempted")); + System.exit(-1); + } else + { + System.out.println(StringResource + .getResource("ServiceShutdownFromBrokerShrink")); + System.out.flush(); + ServiceContext.Logger.traceEvent(Level.INFO, StringResource + .getResource("ServiceShutdownFromBrokerShrink")); + System.exit(ErrorCode.Success); + } + } + } +} diff --git a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java index e56c1b7..7406e45 100644 --- a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java +++ b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java @@ -1,803 +1,818 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Set up the Java Servie Host. -// Host the Customer's Jar or Dummy Service -// Host the Controller Service -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.logging.Level; -import javax.jws.WebService; -import org.apache.cxf.endpoint.Server; -import org.apache.cxf.interceptor.LoggingInInterceptor; -import org.apache.cxf.interceptor.LoggingOutInterceptor; -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; -import org.apache.cxf.transport.http_jetty.JettyHTTPDestination; -import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine; -import org.apache.cxf.transports.http.configuration.HTTPServerPolicy; -import com.microsoft.hpc.properties.ErrorCode; -import com.microsoft.hpc.scheduler.session.Constant; -import com.microsoft.hpc.scheduler.session.servicecontext.Environment; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; -import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; -import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; - -/** - * @author t-junchw - * @date May 9, 2011 - * @description Wrapper class for the construction of host service and - * controller service - */ -public class HpcServiceHostWrapper -{ - - /** - * @field Represents how an endpoint address is finalructed - * http://.:// - */ - private final String BaseAddrTemplate = "http://%s:%s/%s/%s"; - - /** - * @field Timeout for Exiting event to execute. This must be the same as - * node manager's default CTRL+C timeout - */ - private int cancelTaskGracePeriod = Constant.DefaultCancelTaskGracePeriod; - - private int jobId; - private int taskId; - private int procNum; - - /** - * @field CXF service retry Time out In MilliSecond - */ - private int retryTimeoutInMilliSecond; - - /** - * @field 60 second - */ - private final int defaultRetryTimeout = 60 * 1000; - - /** - * @field The real jar service host - */ - public JaxWsServerFactoryBean host; - - /** - * @field the controller service - */ - public JaxWsServerFactoryBean controllerhost; - - /** - * @field Enable the new feature MessageLevelPreemption or not. - */ - public boolean enableMessageLevelPreemption; - - /** - * @field This flag is set when host receives Ctrl-C event. - */ - public boolean receivedCancelEvent; - - /** - * @field object used for synchronization - */ - public Object syncObjOnExitingCalled = new Object(); - - /** - * @field This flag indicates if the OnExiting event is triggered. - */ - public boolean isOnExitingCalled = false; - - /** - * @field This list stores ids of messages which are invoking the hosted - * service. When the response is sent back to the broker, the id is - * removed from this list. If a message come to host after Ctrl-C - * event, its id won't be saved in this list. - */ - public List processingMessageIds = Collections - .synchronizedList(new ArrayList()); - - /** - * @field the offset to the port - */ - private int portOffset; - - /** - * @field the service registration - */ - private ServiceRegistration serviceRegistration; - - /** - * @field Http receive Timeout - */ - private long receiveTimeout; - - /** - * @field times to retry to host the user service - */ - private int retrytimes = 3; - - /** - * @field Ctrl-C hook - */ - public ShutdownThread shutdownThread; - - public HpcServiceHostWrapper(ServiceRegistration serviceRegistration) - { - this.serviceRegistration = serviceRegistration; - - // Initialize Ctrl-C handler to receive shutdown events from node - // manager - this.invokeInitializeControlBreakHandler(); - } - - /** - * @description method to host the service - * @throws InterruptedException - * @throws UnknownHostException - */ - public void publish() throws InterruptedException, UnknownHostException - { - String errorMsg = null; - - int errorCode = ErrorCode.Success; - errorCode = getEnvironmentVariables(); - - // initially retry wait period is 0.5 second - long retryWaitPeriodInMilliSecond = 500; - - if (errorCode != ErrorCode.Success) - { - return; - } - - int retry = 0; - long serviceStartTime = System.currentTimeMillis(); - while (true) - { - try - { - // try to host the user jar - errorCode = RunInternal(); - - if (retry == Integer.MAX_VALUE) - { - retry = 0; - } else - { - retry++; - } - - if (errorCode != ErrorCode.Success) - { - if (errorCode < ErrorCode.ServiceHost_ExitCode_Start - || errorCode > ErrorCode.ServiceHost_ExitCode_End) - { - errorCode = ErrorCode.ServiceHost_UnexpectedException; - } - - errorMsg = StringResource - .getResource("FailedInStartingService"); - ServiceContext.Logger.traceEvent(Level.SEVERE, errorMsg); - } - } catch (Exception e) - { - TraceHelper.traceError(e.getMessage()); - errorCode = ErrorCode.ServiceHost_UnexpectedException; - errorMsg = e.getMessage(); - } - - if (errorCode == ErrorCode.ServiceHost_AssemblyLoadingError - || errorCode == ErrorCode.ServiceHost_NoContractImplemented) - { - if (retry >= retrytimes) - { - break; - } - } - - if (errorCode == ErrorCode.Success) - { - break; - } - - long serviceStopTime = System.currentTimeMillis(); - - // if retry timeout is reached, work is done - long elapsedStartTimeInMilliSecond = serviceStopTime - - serviceStartTime; - if (elapsedStartTimeInMilliSecond > retryTimeoutInMilliSecond) - { - break; - } - - serviceStartTime = System.currentTimeMillis(); - - if (elapsedStartTimeInMilliSecond + retryWaitPeriodInMilliSecond > retryTimeoutInMilliSecond) - { - retryWaitPeriodInMilliSecond = retryTimeoutInMilliSecond - - elapsedStartTimeInMilliSecond; - } - - ServiceContext.Logger.traceEvent(Level.INFO, String.format( - "Wait %s milliseconds and retry", - retryWaitPeriodInMilliSecond)); - - TraceHelper.traceInformation(String.format( - "Wait %d milliseconds and retry.", - retryWaitPeriodInMilliSecond)); - - // wait and retry - Thread.sleep(retryWaitPeriodInMilliSecond); - - // back off - retryWaitPeriodInMilliSecond *= 2; - } - if (errorCode != ErrorCode.Success) - { - RunAsDummy(); - } - } - - /** - * @description host the dummy service method invoked when failed to host - * the user jar - * @throws UnknownHostException - */ - private void RunAsDummy() throws UnknownHostException - { - - String defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort - + portOffset); - TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); - - // destroy the existing host - if (host != null) - { - try - { - host.getServer().destroy(); - } catch (Exception e) - { - // do nothing - } - } - - host = null; - try - { - DummyProvider dummyService = new DummyProvider(); - - host = new JaxWsServerFactoryBean(); - String listenUri = defaultBaseAddr + "/_defaultEndpoint/"; - TraceHelper.traceInformation("listenUri = " + listenUri); - host.setAddress(listenUri); - host.setServiceBean(dummyService); - - // log the in/out bound message - host.getInInterceptors().add(new LoggingInInterceptor()); - host.getOutInterceptors().add(new LoggingOutInterceptor()); - - TraceHelper.traceInformation(StringResource - .getResource("TryCreateHost")); - Server server = host.create(); - - JettyHTTPDestination destination = (JettyHTTPDestination) server - .getDestination(); - // Update back end binding's receive timeout with global settings if - // they are enabled - // update the Service setting - getServiceSettings(); - HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy(); - httpServerPolicy.setReceiveTimeout(receiveTimeout); - destination.setServer(httpServerPolicy); - - TraceHelper.traceInformation(StringResource - .getResource("TryOpenCtrlHost")); - String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort - + portOffset); - OpenHostController(endpointAddress); - - ServiceContext.Logger.traceEvent(Level.INFO, String.format( - "[HpcServiceHost]: Dummy service opened on %s", listenUri)); - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - ServiceContext.Logger.traceEvent(Level.SEVERE, - String.format("[HpcServiceHost]: " + e.toString())); - - if (host != null) - { - try - { - host.getServer().destroy(); - } catch (Exception ex) - { - // do nothing - } - } - } - } - - /** - * @description Open the service host. All exceptions will be directly - * thrown out. So the outer program must know how to deal with - * those exceptions. - * @return error code - */ - private int RunInternal() - { - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Start opening"); - - // Load the service jar from the specified path - JarClassLoader jarClassLoader = null; - - - try - { - jarClassLoader = new JarClassLoader( - serviceRegistration.serviceAssemblyFullPath); - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Jar is loaded."); - } catch (IOException e) - { - TraceHelper.traceError(e.getMessage()); - return ErrorCode.ServiceHost_AssemblyLoadingError; - } - - boolean isimplemented = false; - Class userclass = null; - try - { - // if the user specify the ServiceTypeName - if (serviceRegistration.getServiceTypeName() != null) - { - userclass = jarClassLoader - .loadClass(serviceRegistration.serviceTypeName); - // if the user specify the ServiceContractName - if (serviceRegistration.getServiceContractName() != null) - { - Class[] userinterfacesClass = userclass.getInterfaces(); - for (Class tempinterface : userinterfacesClass) - { - if (tempinterface.getName() == serviceRegistration - .getServiceContractName()) - { - isimplemented = true; - break; - } - } - } - if (!isimplemented) - { - String message = String.format(StringResource - .getResource("CantFindServiceContract"), - serviceRegistration.serviceContractName, - serviceRegistration.serviceAssemblyFileName); - TraceHelper.traceError(message); - ServiceContext.Logger.traceEvent(Level.SEVERE, message); - return ErrorCode.ServiceHost_NoContractImplemented; - } - } - // if the user only specify the ServiceTypeName - else if (serviceRegistration.getServiceContractName() != null) - { - userclass = jarClassLoader - .loadClassbyInterface(serviceRegistration - .getServiceContractName()); - } - // Try to auto discover the service contract interface from the jar - else - { - userclass = jarClassLoader.findClass(); - } - } catch (ClassNotFoundException e) - { - TraceHelper.traceError(e.getMessage()); - return ErrorCode.ServiceHost_ServiceTypeDiscoverError; - } - - String defaultBaseAddr = null; - try - { - defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort - + portOffset); - } catch (UnknownHostException e) - { - TraceHelper.traceError(e.toString()); - return ErrorCode.ServiceHost_UnexpectedException; - } - TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); - - String listenUri = defaultBaseAddr + "/_defaultEndpoint"; - TraceHelper.traceInformation("listenUri = " + listenUri); - - try - { - host = new JaxWsServerFactoryBean(); - host.setAddress(listenUri); - host.setServiceBean(userclass.newInstance()); - - // log the in/out bound message - host.getInInterceptors().add(new LoggingInInterceptor()); - host.getOutInterceptors().add(new LoggingOutInterceptor()); - - // if users specify the WSDL location, try to find it from jar - WebService annotation = userclass - .getAnnotation(javax.jws.WebService.class); - String wSDLLocation = null; - if (annotation != null) - wSDLLocation = annotation.wsdlLocation(); - String folder = ""; - if (wSDLLocation != null && !wSDLLocation.isEmpty()) - { - wSDLLocation = wSDLLocation.substring(wSDLLocation - .indexOf("file:") + 5); - int index = serviceRegistration.getServiceAssemblyFullPath() - .lastIndexOf('\\'); - - if (index == -1) - index = serviceRegistration.getServiceAssemblyFullPath() - .lastIndexOf("/"); - folder = serviceRegistration.getServiceAssemblyFullPath() - .substring(0, index + 1); - host.setWsdlLocation(folder + wSDLLocation); - } - - // Add interceptors if the config enables the message - // level preemption. - if (this.enableMessageLevelPreemption == true) - { - host.getInInterceptors().add( - new MessagePreemptionInInterceptor(this)); - host.getOutInterceptors().add( - new MessagePreemptionOutInterceptor(this)); - host.getOutFaultInterceptors().add( - new AddHeaderOutInterceptor(this)); - } - - //enable the debug to stack trace in fault soap message - host.getBus().setProperty( "faultStackTraceEnabled", "true"); - - TraceHelper.traceInformation(StringResource - .getResource("TryCreateHost")); - Server server = host.create(); - - // Update backend binding's receive timeout and max message settings - // with global settings if they are enabled - // update the Service setting - getServiceSettings(); - JettyHTTPDestination destination = (JettyHTTPDestination) server - .getDestination(); - - // Configure Jetty server max idle time out - JettyHTTPServerEngine engine = (JettyHTTPServerEngine) destination.getEngine(); - engine.getConnector().setMaxIdleTime((int)receiveTimeout); - - HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy(); - httpServerPolicy.setReceiveTimeout(receiveTimeout); - - ServiceContext.Logger.traceEvent(Level.ALL, "Service Operation Timeout"+receiveTimeout); - destination.setServer(httpServerPolicy); - - TraceHelper.traceInformation("Service host successfully opened on " - + listenUri); - - TraceHelper.traceInformation(StringResource - .getResource("TryOpenCtrlHost")); - String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort - + portOffset); - OpenHostController(endpointAddress); - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - TraceHelper.traceStackError(e); - ServiceContext.Logger.traceEvent(Level.SEVERE, "[HpcServiceHost]: " - + e.toString()); - - return ErrorCode.ServiceHost_ServiceHostFailedToOpen; - } - - ServiceContext.Logger.traceEvent(Level.INFO, String.format( - "[HpcServiceHost]: Service host successfully opened on %s ", - listenUri)); - - TraceHelper.traceInformation("Service host successfully opened on " - + listenUri); - - return ErrorCode.Success; - } - - /** - * @description opens the service host controller service - * @remark port disabled sharing on CNs/WNs, we need to open another port - * @param defaultBaseAddr - */ - private void OpenHostController(String defaultBaseAddr) - { - TraceHelper.traceInformation("defaultBaseAddr of HostController is " - + defaultBaseAddr); - - // Open the Control Service Host; - TraceHelper.traceInformation("Created ServiceHost for controller."); - HpcControllerSvc ControllerService = new HpcControllerSvc(this.jobId, - cancelTaskGracePeriod, this); - - TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); - controllerhost = new JaxWsServerFactoryBean(); - - String listenUri = defaultBaseAddr + "/_defaultEndpoint/"; - TraceHelper.traceInformation("listenUri = " + listenUri); - - TraceHelper.traceInformation("Adding endpoint to controller."); - controllerhost.setAddress(listenUri); - controllerhost.setServiceBean(ControllerService); - - // log the in/out bound message - controllerhost.getInInterceptors().add(new LoggingInInterceptor()); - controllerhost.getOutInterceptors().add(new LoggingOutInterceptor()); - - TraceHelper.traceInformation(StringResource - .getResource("TryCreateCtrlHost")); - controllerhost.create(); - TraceHelper.traceInformation("Controller opened."); - - } - - /** - * @description create the end point address for the service - * @param port - * @return - * @throws UnknownHostException - */ - private String createEndpointAddress(int port) throws UnknownHostException - { - // The format of default base addr: - // http://.:// - - String jarNetworkPrefix = Environment - .getEnvironmentVariable(Constant.NetworkPrefixEnv); - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Java network prefix = " + jarNetworkPrefix); - - if (jarNetworkPrefix.equals(Constant.EnterpriseNetwork)) - { - jarNetworkPrefix = ""; - } - - String hostnameWithPrefix = InetAddress.getLocalHost().getHostName(); - if (jarNetworkPrefix != null && !jarNetworkPrefix.isEmpty()) - { - hostnameWithPrefix = String.format("%s.%s", jarNetworkPrefix, - hostnameWithPrefix); - } - - return String.format(BaseAddrTemplate, hostnameWithPrefix, port, jobId, - taskId); - } - - - /** - * @description Get service's service operation Timeout - */ - private void getServiceSettings() - { - String serviceOperationTimeoutString = Environment - .getEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar); - try - { - receiveTimeout = Integer.parseInt(serviceOperationTimeoutString); - } catch (NumberFormatException e) - { - ServiceContext.Logger - .traceEvent( - Level.ALL, - "[HpcServiceHost]: Error retrieving ServiceOperationTimeout. Defaulting to binding's default - " - + e.toString()); - TraceHelper.traceError(e.getMessage()); - receiveTimeout = Constant.DefaultServiceOperationTimeout; - } - } - - /** - * @description get environment variables - * jobID - * taskTD - * CoreId - * procNum - * cancelTaskGracePeriod - * enableMessageLevelPreemption - * @return error code - */ - private int getEnvironmentVariables() - { - String jobidenvvar = Environment.getEnvironmentVariable(Constant.JobIDEnvVar); - try - { - jobId = Integer.parseInt(jobidenvvar); - - } catch (Exception e) - { - ServiceContext.Logger.traceEvent(Level.SEVERE, - StringResource.getResource("CantFindJobId")); - return ErrorCode.ServiceHost_UnexpectedException; - } - - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Job Id = " + jobId); - - String taskidenvvar = Environment.getEnvironmentVariable(Constant.TaskSystemIDEnvVar); - try - { - taskId = Integer.parseInt(taskidenvvar); - } catch (Exception e) - { - ServiceContext.Logger.traceEvent(Level.SEVERE, - StringResource.getResource("CantFindTaskId")); - return ErrorCode.ServiceHost_UnexpectedException; - } - - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Task Id = " + taskId); - - String procnumenvvar = Environment - .getEnvironmentVariable(Constant.ProcNumEnvVar); - try - { - procNum = Integer.parseInt(procnumenvvar); - } catch (Exception e) - { - ServiceContext.Logger.traceEvent(Level.SEVERE, - StringResource.getResource("CantFindProcNum")); - return ErrorCode.ServiceHost_UnexpectedException; - } - - ServiceContext.Logger.traceEvent(Level.ALL, - "[HpcServiceHost]: Number of processors (service capability) = " - + procNum); - - String strServiceInitializationTimeout = Environment - .getEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar); - try - { - retryTimeoutInMilliSecond = Integer - .parseInt(strServiceInitializationTimeout); - } catch (Exception e) - { - ServiceContext.Logger - .traceEvent( - Level.WARNING, - "[HpcServiceHost]: invalid serviceInitializationTimeout value. Fall back to default value = 60s"); - retryTimeoutInMilliSecond = defaultRetryTimeout; - } - - String cancelTaskGracePeriodEnvVarStr = Environment - .getEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar); - try - { - cancelTaskGracePeriod = Integer - .parseInt(cancelTaskGracePeriodEnvVarStr); - // Convert to millisecond from second - cancelTaskGracePeriod *= 1000; - - } catch (Exception e) - { - cancelTaskGracePeriod = 0; - } - - ServiceContext.Logger.traceEvent(Level.INFO, - "[HpcServiceHost]: Cancel Task Grace Period = " - + cancelTaskGracePeriod); - - // parse the coreID list to get the first allocate core - // the core ids is like "0 1 2 5" if allocate 4 cores - String CoreIds = Environment.getEnvironmentVariable(Constant.CoreIdsEnvVar); - try - { - String[] cores = CoreIds.split(" "); - portOffset = Integer.parseInt(cores[0]); - } catch (Exception e) - { - ServiceContext.Logger.traceEvent(Level.WARNING, - "[HpcServiceHost]: Fail to get CoreId use default value."); - } - ServiceContext.Logger.traceEvent(Level.INFO, - "[HpcServiceHost]: First Allocated CoreId = " + portOffset); - - // get the preemption switcher from the env var, the default value is - // true. - String preemption = Environment - .getEnvironmentVariable(Constant.EnableMessageLevelPreemptionEnvVar); - try - { - enableMessageLevelPreemption = Boolean.parseBoolean(preemption); - } catch (Exception e) - { - this.enableMessageLevelPreemption = true; - } - ServiceContext.Logger.traceEvent(Level.INFO, - "[HpcServiceHost]: EnableMessageLevelPreemption = " - + enableMessageLevelPreemption); - - return ErrorCode.Success; - } - - private void invokeInitializeControlBreakHandler() - { - this.shutdownThread = new ShutdownThread(this); - Runtime.getRuntime().addShutdownHook(this.shutdownThread); - } - - public void openDummyService() throws UnknownHostException - { - getEnvironmentVariables(); - RunAsDummy(); - } -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Set up the Java Servie Host. +// Host the Customer's Jar or Dummy Service +// Host the Controller Service +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import javax.jws.WebService; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.soap.AddressingFeature; + +import org.apache.cxf.Bus; +import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.feature.AbstractFeature; +import org.apache.cxf.interceptor.LoggingInInterceptor; +import org.apache.cxf.interceptor.LoggingOutInterceptor; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.transport.http_jetty.JettyHTTPDestination; +import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine; +import org.apache.cxf.transports.http.configuration.HTTPServerPolicy; +import org.apache.cxf.ws.addressing.MAPAggregator; +import org.apache.cxf.ws.addressing.WSAddressingFeature; +import org.apache.cxf.ws.addressing.soap.MAPCodec; + +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.servicecontext.Environment; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; +import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; +import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; + +/** + * @author t-junchw + * @date May 9, 2011 + * @description Wrapper class for the construction of host service and + * controller service + */ +public class HpcServiceHostWrapper +{ + + /** + * @field Represents how an endpoint address is finalructed + * http://.:// + */ + private final String BaseAddrTemplate = "http://%s:%s/%s/%s"; + + /** + * @field Timeout for Exiting event to execute. This must be the same as + * node manager's default CTRL+C timeout + */ + private int cancelTaskGracePeriod = Constant.DefaultCancelTaskGracePeriod; + + private int jobId; + private int taskId; + private int procNum; + + /** + * @field CXF service retry Time out In MilliSecond + */ + private int retryTimeoutInMilliSecond; + + /** + * @field 60 second + */ + private final int defaultRetryTimeout = 60 * 1000; + + /** + * @field The real jar service host + */ + public JaxWsServerFactoryBean host; + + /** + * @field the controller service + */ + public JaxWsServerFactoryBean controllerhost; + + /** + * @field Enable the new feature MessageLevelPreemption or not. + */ + public boolean enableMessageLevelPreemption; + + /** + * @field This flag is set when host receives Ctrl-C event. + */ + public boolean receivedCancelEvent; + + /** + * @field object used for synchronization + */ + public Object syncObjOnExitingCalled = new Object(); + + /** + * @field This flag indicates if the OnExiting event is triggered. + */ + public boolean isOnExitingCalled = false; + + /** + * @field This list stores ids of messages which are invoking the hosted + * service. When the response is sent back to the broker, the id is + * removed from this list. If a message come to host after Ctrl-C + * event, its id won't be saved in this list. + */ + public List processingMessageIds = Collections + .synchronizedList(new ArrayList()); + + /** + * @field the offset to the port + */ + private int portOffset; + + /** + * @field the service registration + */ + private ServiceRegistration serviceRegistration; + + /** + * @field Http receive Timeout + */ + private long receiveTimeout; + + /** + * @field times to retry to host the user service + */ + private int retrytimes = 3; + + /** + * @field Ctrl-C hook + */ + public ShutdownThread shutdownThread; + + public HpcServiceHostWrapper(ServiceRegistration serviceRegistration) + { + this.serviceRegistration = serviceRegistration; + + // Initialize Ctrl-C handler to receive shutdown events from node + // manager + this.invokeInitializeControlBreakHandler(); + } + + /** + * @description method to host the service + * @throws InterruptedException + * @throws UnknownHostException + */ + public void publish() throws InterruptedException, UnknownHostException + { + String errorMsg = null; + + int errorCode = ErrorCode.Success; + errorCode = getEnvironmentVariables(); + + // initially retry wait period is 0.5 second + long retryWaitPeriodInMilliSecond = 500; + + if (errorCode != ErrorCode.Success) + { + return; + } + + int retry = 0; + long serviceStartTime = System.currentTimeMillis(); + while (true) + { + try + { + // try to host the user jar + errorCode = RunInternal(); + + if (retry == Integer.MAX_VALUE) + { + retry = 0; + } else + { + retry++; + } + + if (errorCode != ErrorCode.Success) + { + if (errorCode < ErrorCode.ServiceHost_ExitCode_Start + || errorCode > ErrorCode.ServiceHost_ExitCode_End) + { + errorCode = ErrorCode.ServiceHost_UnexpectedException; + } + + errorMsg = StringResource + .getResource("FailedInStartingService"); + ServiceContext.Logger.traceEvent(Level.SEVERE, errorMsg); + } + } catch (Exception e) + { + TraceHelper.traceError(e.getMessage()); + errorCode = ErrorCode.ServiceHost_UnexpectedException; + errorMsg = e.getMessage(); + } + + if (errorCode == ErrorCode.ServiceHost_AssemblyLoadingError + || errorCode == ErrorCode.ServiceHost_NoContractImplemented) + { + if (retry >= retrytimes) + { + break; + } + } + + if (errorCode == ErrorCode.Success) + { + break; + } + + long serviceStopTime = System.currentTimeMillis(); + + // if retry timeout is reached, work is done + long elapsedStartTimeInMilliSecond = serviceStopTime + - serviceStartTime; + if (elapsedStartTimeInMilliSecond > retryTimeoutInMilliSecond) + { + break; + } + + serviceStartTime = System.currentTimeMillis(); + + if (elapsedStartTimeInMilliSecond + retryWaitPeriodInMilliSecond > retryTimeoutInMilliSecond) + { + retryWaitPeriodInMilliSecond = retryTimeoutInMilliSecond + - elapsedStartTimeInMilliSecond; + } + + ServiceContext.Logger.traceEvent(Level.INFO, String.format( + "Wait %s milliseconds and retry", + retryWaitPeriodInMilliSecond)); + + TraceHelper.traceInformation(String.format( + "Wait %d milliseconds and retry.", + retryWaitPeriodInMilliSecond)); + + // wait and retry + Thread.sleep(retryWaitPeriodInMilliSecond); + + // back off + retryWaitPeriodInMilliSecond *= 2; + } + if (errorCode != ErrorCode.Success) + { + RunAsDummy(); + } + } + + /** + * @description host the dummy service method invoked when failed to host + * the user jar + * @throws UnknownHostException + */ + private void RunAsDummy() throws UnknownHostException + { + + String defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort + + portOffset); + TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); + + // destroy the existing host + if (host != null) + { + try + { + host.getServer().destroy(); + } catch (Exception e) + { + // do nothing + } + } + + host = null; + try + { + DummyProvider dummyService = new DummyProvider(); + + host = new JaxWsServerFactoryBean(); + String listenUri = defaultBaseAddr + "/_defaultEndpoint/"; + TraceHelper.traceInformation("listenUri = " + listenUri); + host.setAddress(listenUri); + host.setServiceBean(dummyService); + + // log the in/out bound message + host.getInInterceptors().add(new LoggingInInterceptor()); + host.getOutInterceptors().add(new LoggingOutInterceptor()); + + TraceHelper.traceInformation(StringResource + .getResource("TryCreateHost")); + Server server = host.create(); + + JettyHTTPDestination destination = (JettyHTTPDestination) server + .getDestination(); + // Update back end binding's receive timeout with global settings if + // they are enabled + // update the Service setting + getServiceSettings(); + HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy(); + httpServerPolicy.setReceiveTimeout(receiveTimeout); + destination.setServer(httpServerPolicy); + + TraceHelper.traceInformation(StringResource + .getResource("TryOpenCtrlHost")); + String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort + + portOffset); + OpenHostController(endpointAddress); + + ServiceContext.Logger.traceEvent(Level.INFO, String.format( + "[HpcServiceHost]: Dummy service opened on %s", listenUri)); + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + ServiceContext.Logger.traceEvent(Level.SEVERE, + String.format("[HpcServiceHost]: " + e.toString())); + + if (host != null) + { + try + { + host.getServer().destroy(); + } catch (Exception ex) + { + // do nothing + } + } + } + } + + /** + * @description Open the service host. All exceptions will be directly + * thrown out. So the outer program must know how to deal with + * those exceptions. + * @return error code + */ + private int RunInternal() + { + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Start opening"); + + // Load the service jar from the specified path + JarClassLoader jarClassLoader = null; + + + try + { + jarClassLoader = new JarClassLoader( + serviceRegistration.serviceAssemblyFullPath); + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Jar is loaded."); + } catch (IOException e) + { + TraceHelper.traceError(e.getMessage()); + return ErrorCode.ServiceHost_AssemblyLoadingError; + } + + boolean isimplemented = false; + Class userclass = null; + try + { + // if the user specify the ServiceTypeName + if (serviceRegistration.getServiceTypeName() != null) + { + userclass = jarClassLoader + .loadClass(serviceRegistration.serviceTypeName); + // if the user specify the ServiceContractName + if (serviceRegistration.getServiceContractName() != null) + { + Class[] userinterfacesClass = userclass.getInterfaces(); + for (Class tempinterface : userinterfacesClass) + { + if (tempinterface.getName() == serviceRegistration + .getServiceContractName()) + { + isimplemented = true; + break; + } + } + } + if (!isimplemented) + { + String message = String.format(StringResource + .getResource("CantFindServiceContract"), + serviceRegistration.serviceContractName, + serviceRegistration.serviceAssemblyFileName); + TraceHelper.traceError(message); + ServiceContext.Logger.traceEvent(Level.SEVERE, message); + return ErrorCode.ServiceHost_NoContractImplemented; + } + } + // if the user only specify the ServiceTypeName + else if (serviceRegistration.getServiceContractName() != null) + { + userclass = jarClassLoader + .loadClassbyInterface(serviceRegistration + .getServiceContractName()); + } + // Try to auto discover the service contract interface from the jar + else + { + userclass = jarClassLoader.findClass(); + } + } catch (ClassNotFoundException e) + { + TraceHelper.traceError(e.getMessage()); + return ErrorCode.ServiceHost_ServiceTypeDiscoverError; + } + + String defaultBaseAddr = null; + try + { + defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort + + portOffset); + } catch (UnknownHostException e) + { + TraceHelper.traceError(e.toString()); + return ErrorCode.ServiceHost_UnexpectedException; + } + TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); + + String listenUri = defaultBaseAddr + "/_defaultEndpoint"; + TraceHelper.traceInformation("listenUri = " + listenUri); + + try + { + host = new JaxWsServerFactoryBean(); + if(serviceRegistration.getEnableWSAddressing() == true) + { + // add ws-addressing feature + host.getFeatures().add(new WSAddressingFeature()); + } + + host.setAddress(listenUri); + host.setServiceBean(userclass.newInstance()); + + LoggingInInterceptor login = new LoggingInInterceptor(); + LoggingOutInterceptor logout = new LoggingOutInterceptor(); + // log the in/out bound message + host.getInInterceptors().add(login); + host.getOutInterceptors().add(logout); + host.getOutFaultInterceptors().add(logout); + host.getOutFaultInterceptors().add( + new AddHeaderOutInterceptor(this)); + + + // if users specify the WSDL location, try to find it from jar + WebService annotation = userclass + .getAnnotation(javax.jws.WebService.class); + String wSDLLocation = null; + if (annotation != null) + wSDLLocation = annotation.wsdlLocation(); + String folder = ""; + if (wSDLLocation != null && !wSDLLocation.isEmpty()) + { + wSDLLocation = wSDLLocation.substring(wSDLLocation + .indexOf("file:") + 5); + int index = serviceRegistration.getServiceAssemblyFullPath() + .lastIndexOf('\\'); + + if (index == -1) + index = serviceRegistration.getServiceAssemblyFullPath() + .lastIndexOf("/"); + folder = serviceRegistration.getServiceAssemblyFullPath() + .substring(0, index + 1); + host.setWsdlLocation(folder + wSDLLocation); + } + + // Add interceptors if the config enables the message + // level preemption. + if (this.enableMessageLevelPreemption == true) + { + host.getInInterceptors().add( + new MessagePreemptionInInterceptor(this)); + host.getOutInterceptors().add( + new MessagePreemptionOutInterceptor(this)); + } + + //enable the debug to stack trace in fault soap message + host.getBus().setProperty( "faultStackTraceEnabled", "true"); + TraceHelper.traceInformation(StringResource + .getResource("TryCreateHost")); + Server server = host.create(); + + // Update backend binding's receive timeout and max message settings + // with global settings if they are enabled + // update the Service setting + getServiceSettings(); + JettyHTTPDestination destination = (JettyHTTPDestination) server + .getDestination(); + + // Configure Jetty server max idle time out + JettyHTTPServerEngine engine = (JettyHTTPServerEngine) destination.getEngine(); + engine.getConnector().setMaxIdleTime((int)receiveTimeout); + + HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy(); + httpServerPolicy.setReceiveTimeout(receiveTimeout); + + ServiceContext.Logger.traceEvent(Level.ALL, "Service Operation Timeout"+receiveTimeout); + destination.setServer(httpServerPolicy); + + TraceHelper.traceInformation("Service host successfully opened on " + + listenUri); + + TraceHelper.traceInformation(StringResource + .getResource("TryOpenCtrlHost")); + String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort + + portOffset); + OpenHostController(endpointAddress); + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + TraceHelper.traceStackError(e); + ServiceContext.Logger.traceEvent(Level.SEVERE, "[HpcServiceHost]: " + + e.toString()); + + return ErrorCode.ServiceHost_ServiceHostFailedToOpen; + } + + ServiceContext.Logger.traceEvent(Level.INFO, String.format( + "[HpcServiceHost]: Service host successfully opened on %s ", + listenUri)); + + TraceHelper.traceInformation("Service host successfully opened on " + + listenUri); + + return ErrorCode.Success; + } + + /** + * @description opens the service host controller service + * @remark port disabled sharing on CNs/WNs, we need to open another port + * @param defaultBaseAddr + */ + private void OpenHostController(String defaultBaseAddr) + { + TraceHelper.traceInformation("defaultBaseAddr of HostController is " + + defaultBaseAddr); + + // Open the Control Service Host; + TraceHelper.traceInformation("Created ServiceHost for controller."); + HpcControllerSvc ControllerService = new HpcControllerSvc(this.jobId, + cancelTaskGracePeriod, this); + + TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr); + controllerhost = new JaxWsServerFactoryBean(); + + String listenUri = defaultBaseAddr + "/_defaultEndpoint/"; + TraceHelper.traceInformation("listenUri = " + listenUri); + + TraceHelper.traceInformation("Adding endpoint to controller."); + controllerhost.setAddress(listenUri); + controllerhost.setServiceBean(ControllerService); + + + // log the in/out bound message + controllerhost.getInInterceptors().add(new LoggingInInterceptor()); + controllerhost.getOutInterceptors().add(new LoggingOutInterceptor()); + + TraceHelper.traceInformation(StringResource + .getResource("TryCreateCtrlHost")); + controllerhost.create(); + TraceHelper.traceInformation("Controller opened."); + + } + + /** + * @description create the end point address for the service + * @param port + * @return + * @throws UnknownHostException + */ + private String createEndpointAddress(int port) throws UnknownHostException + { + // The format of default base addr: + // http://.:// + + String jarNetworkPrefix = Environment + .getEnvironmentVariable(Constant.NetworkPrefixEnv); + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Java network prefix = " + jarNetworkPrefix); + + String hostnameWithPrefix = InetAddress.getLocalHost().getHostName(); + if (jarNetworkPrefix != null && !jarNetworkPrefix.isEmpty()) + { + hostnameWithPrefix = String.format("%s.%s", jarNetworkPrefix, + hostnameWithPrefix); + } + + return String.format(BaseAddrTemplate, hostnameWithPrefix, port, jobId, + taskId); + } + + + /** + * @description Get service's service operation Timeout + */ + private void getServiceSettings() + { + String serviceOperationTimeoutString = Environment + .getEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar); + try + { + receiveTimeout = Integer.parseInt(serviceOperationTimeoutString); + } catch (NumberFormatException e) + { + ServiceContext.Logger + .traceEvent( + Level.ALL, + "[HpcServiceHost]: Error retrieving ServiceOperationTimeout. Defaulting to binding's default - " + + e.toString()); + TraceHelper.traceError(e.getMessage()); + receiveTimeout = Constant.DefaultServiceOperationTimeout; + } + } + + /** + * @description get environment variables + * jobID + * taskTD + * CoreId + * procNum + * cancelTaskGracePeriod + * enableMessageLevelPreemption + * @return error code + */ + private int getEnvironmentVariables() + { + String jobidenvvar = Environment.getEnvironmentVariable(Constant.JobIDEnvVar); + try + { + jobId = Integer.parseInt(jobidenvvar); + + } catch (Exception e) + { + ServiceContext.Logger.traceEvent(Level.SEVERE, + StringResource.getResource("CantFindJobId")); + return ErrorCode.ServiceHost_UnexpectedException; + } + + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Job Id = " + jobId); + + String taskidenvvar = Environment.getEnvironmentVariable(Constant.TaskSystemIDEnvVar); + try + { + taskId = Integer.parseInt(taskidenvvar); + } catch (Exception e) + { + ServiceContext.Logger.traceEvent(Level.SEVERE, + StringResource.getResource("CantFindTaskId")); + return ErrorCode.ServiceHost_UnexpectedException; + } + + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Task Id = " + taskId); + + String procnumenvvar = Environment + .getEnvironmentVariable(Constant.ProcNumEnvVar); + try + { + procNum = Integer.parseInt(procnumenvvar); + } catch (Exception e) + { + ServiceContext.Logger.traceEvent(Level.SEVERE, + StringResource.getResource("CantFindProcNum")); + return ErrorCode.ServiceHost_UnexpectedException; + } + + ServiceContext.Logger.traceEvent(Level.ALL, + "[HpcServiceHost]: Number of processors (service capability) = " + + procNum); + + String strServiceInitializationTimeout = Environment + .getEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar); + try + { + retryTimeoutInMilliSecond = Integer + .parseInt(strServiceInitializationTimeout); + } catch (Exception e) + { + ServiceContext.Logger + .traceEvent( + Level.WARNING, + "[HpcServiceHost]: invalid serviceInitializationTimeout value. Fall back to default value = 60s"); + retryTimeoutInMilliSecond = defaultRetryTimeout; + } + + String cancelTaskGracePeriodEnvVarStr = Environment + .getEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar); + try + { + cancelTaskGracePeriod = Integer + .parseInt(cancelTaskGracePeriodEnvVarStr); + // Convert to millisecond from second + cancelTaskGracePeriod *= 1000; + + } catch (Exception e) + { + cancelTaskGracePeriod = 0; + } + + ServiceContext.Logger.traceEvent(Level.INFO, + "[HpcServiceHost]: Cancel Task Grace Period = " + + cancelTaskGracePeriod); + + // parse the coreID list to get the first allocate core + // the core ids is like "0 1 2 5" if allocate 4 cores + String CoreIds = Environment.getEnvironmentVariable(Constant.CoreIdsEnvVar); + try + { + String[] cores = CoreIds.split(" "); + portOffset = Integer.parseInt(cores[0]); + } catch (Exception e) + { + ServiceContext.Logger.traceEvent(Level.WARNING, + "[HpcServiceHost]: Fail to get CoreId use default value."); + } + ServiceContext.Logger.traceEvent(Level.INFO, + "[HpcServiceHost]: First Allocated CoreId = " + portOffset); + + // get the preemption switcher from the env var, the default value is + // true. + String preemption = Environment + .getEnvironmentVariable(Constant.EnableMessageLevelPreemptionEnvVar); + try + { + enableMessageLevelPreemption = Boolean.parseBoolean(preemption); + } catch (Exception e) + { + this.enableMessageLevelPreemption = true; + } + ServiceContext.Logger.traceEvent(Level.INFO, + "[HpcServiceHost]: EnableMessageLevelPreemption = " + + enableMessageLevelPreemption); + + return ErrorCode.Success; + } + + private void invokeInitializeControlBreakHandler() + { + this.shutdownThread = new ShutdownThread(this); + Runtime.getRuntime().addShutdownHook(this.shutdownThread); + } + + public void openDummyService() throws UnknownHostException + { + getEnvironmentVariables(); + RunAsDummy(); + } +} diff --git a/src/com/microsoft/hpc/servicehost/InterceptorUtility.java b/src/com/microsoft/hpc/servicehost/InterceptorUtility.java index 4122664..352461a 100644 --- a/src/com/microsoft/hpc/servicehost/InterceptorUtility.java +++ b/src/com/microsoft/hpc/servicehost/InterceptorUtility.java @@ -1,161 +1,213 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Utility for service host -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.namespace.QName; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.cxf.binding.soap.SoapHeader; -import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.headers.Header; -import org.apache.cxf.helpers.DOMUtils; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.microsoft.hpc.scheduler.session.Constant; - -/** - * @author t-junchw - * @date May 9, 2011 - * @description utility for CXF interceptor - */ -public final class InterceptorUtility -{ - - /** - * @description add message header - * @param message - * @param name - * @param namespace - * @param data - */ - static public void addMessageHeader(SoapMessage message, String name, - String namespace, Object data) - { - Document document = DOMUtils.createDocument(); - Element root = document.createElementNS(namespace, name); - root.setTextContent(data.toString()); - - List
headers = message.getHeaders(); - QName headname = new QName(namespace, name); - SoapHeader header = new SoapHeader(headname, root); - headers.add(header); - } - - /** - * @description create fault message detail - * @param sessionFault - * @return - */ - public static Element createDetailElement(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault sessionFault) - { - Element detail = null; - try - { - Document detailDocument = DOMUtils.createDocument(); - detail = detailDocument.createElement("detail"); - Document doc = DOMUtils.createDocument(); - JAXBContext jaxbContext = JAXBContext - .newInstance(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.class); - - // Java Class converted to XML - Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.marshal(sessionFault, doc); - - Node DocImportedNode = detailDocument.importNode( - doc.getDocumentElement(), true); - detail.appendChild(DocImportedNode); - - if (DocImportedNode.getLocalName().equals("SessionFault")) - { - // SessionFault - Attr sessionAttr = detailDocument.createAttribute("xmlns:i"); - sessionAttr - .setValue(Constant.XMLSchemaInstanceNS); - DocImportedNode.getAttributes().setNamedItem(sessionAttr); - } - - // debug the jaxb convert result - TransformerFactory tfactory = TransformerFactory.newInstance(); - Transformer transformer = tfactory.newTransformer(); - DOMSource source = new DOMSource(doc); - transformer.transform(source, new StreamResult(System.out)); - - return detail; - } catch (Exception e) - { - return detail; - } - } -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility for service host +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.cxf.binding.soap.SoapHeader; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.DOMUtils; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.session.RetryOperationError; + +/** + * @author t-junchw + * @date May 9, 2011 + * @description utility for CXF interceptor + */ +public final class InterceptorUtility +{ + + /** + * @description add message header + * @param message + * @param name + * @param namespace + * @param data + */ + static public void addOrUpdateMessageHeader(SoapMessage message, String name, + String namespace, Object data) + { + Document document = DOMUtils.createDocument(); + Element root = document.createElementNS(namespace, name); + root.setTextContent(data.toString()); + + QName headname = new QName(namespace, name); + SoapHeader header = null; + List
headers = message.getHeaders(); + for(Header h : headers) + { + if (h.getName().getLocalPart() == name && + h.getName().getNamespaceURI() == namespace) { + header = (SoapHeader) h; + break; + } + } + if(header == null) { + header = new SoapHeader(headname, root); + headers.add(header); + } else { + ((Element)header.getObject()).setTextContent(data.toString()); + } + + } + + /** + * @description create fault message detail + * @param sessionFault + * @return + */ + public static Element createDetailElement(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault sessionFault) + { + Element detail = null; + try + { + Document detailDocument = DOMUtils.createDocument(); + detail = detailDocument.createElement("detail"); + Document doc = DOMUtils.createDocument(); + JAXBContext jaxbContext = JAXBContext + .newInstance(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.class); + + // Java Class converted to XML + Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.marshal(sessionFault, doc); + + Node DocImportedNode = detailDocument.importNode( + doc.getDocumentElement(), true); + detail.appendChild(DocImportedNode); + + if (DocImportedNode.getLocalName().equals("SessionFault")) + { + // SessionFault + Attr sessionAttr = detailDocument.createAttribute("xmlns:i"); + sessionAttr + .setValue(Constant.XMLSchemaInstanceNS); + DocImportedNode.getAttributes().setNamedItem(sessionAttr); + } + + // debug the jaxb convert result + TransformerFactory tfactory = TransformerFactory.newInstance(); + Transformer transformer = tfactory.newTransformer(); + DOMSource source = new DOMSource(doc); + transformer.transform(source, new StreamResult(System.out)); + + return detail; + } catch (Exception e) + { + return detail; + } + } + + /** + * @description create fault message detail + * @param sessionFault + * @return + */ + public static Element createDetailElement(RetryOperationError error) + { + Element detail = null; + try + { + Document detailDocument = DOMUtils.createDocument(); + detail = detailDocument.createElement("detail"); + Document doc = DOMUtils.createDocument(); + JAXBContext jaxbContext = JAXBContext + .newInstance(RetryOperationError.class); + + // Java Class converted to XML + Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.marshal(error, doc); + + Node DocImportedNode = detailDocument.importNode( + doc.getDocumentElement(), true); + detail.appendChild(DocImportedNode); + + // debug the jaxb convert result + TransformerFactory tfactory = TransformerFactory.newInstance(); + Transformer transformer = tfactory.newTransformer(); + DOMSource source = new DOMSource(doc); + transformer.transform(source, new StreamResult(System.out)); + + return detail; + } catch (Exception e) + { + return detail; + } + } +} diff --git a/src/com/microsoft/hpc/servicehost/Main.java b/src/com/microsoft/hpc/servicehost/Main.java index 4951e14..0d3fd32 100644 --- a/src/com/microsoft/hpc/servicehost/Main.java +++ b/src/com/microsoft/hpc/servicehost/Main.java @@ -1,315 +1,315 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// the set-up method for the java service host -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.text.ParseException; -import java.util.concurrent.atomic.AtomicReference; -import com.microsoft.hpc.properties.ErrorCode; -import com.microsoft.hpc.scheduler.session.Constant; -import com.microsoft.hpc.scheduler.session.servicecontext.Environment; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistrationRepo; -import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; -import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; - -/** - * @author t-junchw - * @date May 9, 2011 - * @description entry point of service host - */ -public class Main -{ - /** - * @param args - * java -jar Microsoft-HpcHost-3.0.jar - * /JobId jid /TaskSystemId tid /CoreId cid - * /RegistrationFileName filename /RegistrationPath path - * /Ccp_Data ccpdata /TaskInstanceId taskinstancsid - * @throws IOException - */ - public static void main(String[] args) throws IOException - { - - TraceHelper.traceInformation("HpcServiceHost entry point is called."); - - AtomicReference exitCode = new AtomicReference(0); - if (RunPrePostTask(exitCode)) - { - // return the exitcode - System.exit(Integer.parseInt(exitCode.get().toString())); - } - - // jar running without a job - if (args.length > 0) - { - // set the debug mode true - Environment.isDebug = true; - - ParameterContainer param = new ParameterContainer(args); - try - { - if (param.printHelp()) - { - System.exit(ErrorCode.ServiceHost_PrintCommandHelp); - } else - { - param.Parse(); - } - } catch (ParseException e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_IncorrectCommandLineParameter); - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_UnexpectedException); - } - - // set the Environment Variable for the debug - Environment.setEnvironmentVariable(Constant.JobIDEnvVar, param.getJobIdParameter().getValue().toString()); - Environment.setEnvironmentVariable(Constant.TaskSystemIDEnvVar, param.getJobIdParameter().getValue().toString()); - Environment.setEnvironmentVariable(Constant.CoreIdsEnvVar, param.getCoreIdParameter().getValue().toString()); - Environment.setEnvironmentVariable(Constant.RegistryPathEnv, param.getPathParameter().getValue()); - Environment.setEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar, param.getFileNameParameter() - .getValue()); - Environment.setEnvironmentVariable(Constant.CCP_DATAEnvVar, param.getCCPDATAParameter().getValue()); - Environment.setEnvironmentVariable(Constant.TASKINSTANCEIDEnvVar, param.getTaskinstanceIdParameter() - .getValue().toString()); - // use default values for following environment variables - Environment.setEnvironmentVariable(Constant.ProcNumEnvVar, "1"); - Environment.setEnvironmentVariable(Constant.NetworkPrefixEnv, Constant.EnterpriseNetwork); - Environment.setEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar, "60000"); - Environment.setEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar, "15"); - Environment.setEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar, "86400000"); - } - - String serviceConfigFullPath; - HpcServiceHostWrapper hpcServiceHostWrapper = null; - boolean isOpenDummy = false; - try - { - String serviceConfigFileName = Environment.getEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar); - - // exit if there is not such env var - if (serviceConfigFileName == null || serviceConfigFileName.isEmpty()) - { - isOpenDummy = true; - TraceHelper.traceError(StringResource.getResource("ServiceConfigFileNameNotSpecified")); - throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceConfigFileNameNotSpecified)); - } - - //get the service config file full path - serviceConfigFullPath = GetServiceInfo(serviceConfigFileName); - if (!new File(serviceConfigFullPath).exists()) - { - isOpenDummy = true; - TraceHelper.traceError(StringResource - .getResource("CantFindServiceRegistrationFileserviceConfigFullPath")); - throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceRegistrationFileNotFound)); - } - - TraceHelper.traceInformation("serviceConfigFullPath = " + serviceConfigFullPath); - - //import the configuration to the service registration - ServiceRegistration serviceRegistration = Utility.getServiceRegistration(serviceConfigFullPath, exitCode); - if ((Integer) exitCode.get() != ErrorCode.Success) - { - isOpenDummy = true; - throw new Exception(exitCode.get().toString()); - } - - // Open the host - hpcServiceHostWrapper = new HpcServiceHostWrapper(serviceRegistration); - hpcServiceHostWrapper.publish(); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - TraceHelper.traceStackError(e); - } - finally - { - if(isOpenDummy) - { - if(hpcServiceHostWrapper==null) - { - hpcServiceHostWrapper = new HpcServiceHostWrapper(new ServiceRegistration()); - } - hpcServiceHostWrapper.openDummyService(); - } - } - } - - /** - * @description get the service config file full path by the file name - * @param serviceConfigFileName - * @return service config file full path - */ - private static String GetServiceInfo(String serviceConfigFileName) - { - String serviceConfigFile = null; - - try - { - - String headnode = Environment.getEnvironmentVariable(Constant.HeadnodeEnvVar); - TraceHelper.traceInformation(Environment.getEnvironmentVariable(Constant.RegistryPathEnv)); - ServiceRegistrationRepo serviceRegistration = new ServiceRegistrationRepo(headnode, - Environment.getEnvironmentVariable(Constant.RegistryPathEnv)); - - // Get the path to the service config file name - serviceConfigFile = serviceRegistration.getServiceRegistrationPath(serviceConfigFileName); - - if (serviceConfigFile == null) - { - // Make a part for the error message - String CentrialPath = serviceRegistration.getCentrialPath(); - - StringBuilder serviceRegDirsBuilder = new StringBuilder(); - if (CentrialPath != null && !CentrialPath.isEmpty()) - { - serviceRegDirsBuilder.append("\n\t"); - serviceRegDirsBuilder.append(CentrialPath); - } - serviceRegDirsBuilder.append("\n"); - - TraceHelper.traceError(String.format( - StringResource.getResource("CannotFindServiceRegistrationFileUnderFolders"), - serviceRegDirsBuilder.toString())); - } - } catch (Exception e) - { - e.printStackTrace(); - TraceHelper.traceError(String.format(StringResource.getResource("ExceptionInReadingRegistrationFile"), - serviceConfigFile, e.toString())); - } - - return serviceConfigFile; - } - - /** - * @description run a pre or post task if it exists - * @param exitCode - * @return - */ - private static boolean RunPrePostTask(AtomicReference exitCode) - { - boolean prePostTaskExists = false; - String prePostTaskCommandLine = Environment.getEnvironmentVariable(Constant.PrePostTaskCommandLineEnvVar); - - // Check if a pre/post task exists - prePostTaskExists = prePostTaskCommandLine != null; - - if (prePostTaskExists) - { - String serviceWorkingDirectory = null; - serviceWorkingDirectory = Environment.getEnvironmentVariable(Constant.PrePostTaskOnPremiseWorkingDirEnvVar); - - // Run command from comspec (like node manager babysitter) to ensure - // env vars are expanded and command runs as if launched from node manager - String commandLine = String.format("\"%s\" /S /c \"%s\"", Environment.getEnvironmentVariable("ComSpec"), - prePostTaskCommandLine); - ProcessBuilder pb = new ProcessBuilder(commandLine); - pb.directory(new File(serviceWorkingDirectory)); - pb.redirectErrorStream(); - TraceHelper.traceInformation(String.format("Executing '%s'", prePostTaskCommandLine)); - - try - { - Process subp = pb.start(); - subp.getErrorStream(); - InputStream is = subp.getErrorStream(); - InputStreamReader isr = new InputStreamReader(is, "GBK"); - BufferedReader br = new BufferedReader(isr); - - //wait the sub process to finish - exitCode.set(subp.waitFor()); - TraceHelper.traceError(br.toString()); - TraceHelper.traceInformation(String.format("ExitCode = %d", exitCode)); - - if (exitCode.equals(0)) - { - TraceHelper.traceInformation(String.format("Error output:%s", br.toString())); - } - - } catch (InterruptedException e) - { - TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine, - e.toString())); - } catch (IOException e) - { - TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine, - e.toString())); - } - - } - return prePostTaskExists; - } -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// the set-up method for the java service host +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.text.ParseException; +import java.util.concurrent.atomic.AtomicReference; +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.servicecontext.Environment; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistrationRepo; +import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; +import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; + +/** + * @author t-junchw + * @date May 9, 2011 + * @description entry point of service host + */ +public class Main +{ + /** + * @param args + * java -jar Microsoft-HpcHost-3.0.jar + * /JobId jid /TaskSystemId tid /CoreId cid + * /RegistrationFileName filename /RegistrationPath path + * /Ccp_Data ccpdata /TaskInstanceId taskinstancsid + * @throws IOException + */ + public static void main(String[] args) throws IOException + { + + TraceHelper.traceInformation("HpcServiceHost entry point is called."); + + AtomicReference exitCode = new AtomicReference(0); + if (RunPrePostTask(exitCode)) + { + // return the exitcode + System.exit(Integer.parseInt(exitCode.get().toString())); + } + + // jar running without a job + if (args.length > 0) + { + // set the debug mode true + Environment.isDebug = true; + + ParameterContainer param = new ParameterContainer(args); + try + { + if (param.printHelp()) + { + System.exit(ErrorCode.ServiceHost_PrintCommandHelp); + } else + { + param.Parse(); + } + } catch (ParseException e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_IncorrectCommandLineParameter); + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_UnexpectedException); + } + + // set the Environment Variable for the debug + Environment.setEnvironmentVariable(Constant.JobIDEnvVar, param.getJobIdParameter().getValue().toString()); + Environment.setEnvironmentVariable(Constant.TaskSystemIDEnvVar, param.getTaskIdParameter().getValue().toString()); + Environment.setEnvironmentVariable(Constant.CoreIdsEnvVar, param.getCoreIdParameter().getValue().toString()); + Environment.setEnvironmentVariable(Constant.RegistryPathEnv, param.getPathParameter().getValue()); + Environment.setEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar, param.getFileNameParameter() + .getValue()); + Environment.setEnvironmentVariable(Constant.CCP_DATAEnvVar, param.getCCPDATAParameter().getValue()); + Environment.setEnvironmentVariable(Constant.TASKINSTANCEIDEnvVar, param.getTaskinstanceIdParameter() + .getValue().toString()); + // use default values for following environment variables + Environment.setEnvironmentVariable(Constant.ProcNumEnvVar, "1"); + Environment.setEnvironmentVariable(Constant.NetworkPrefixEnv, Constant.EnterpriseNetwork); + Environment.setEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar, "60000"); + Environment.setEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar, "15"); + Environment.setEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar, "86400000"); + } + + String serviceConfigFullPath; + HpcServiceHostWrapper hpcServiceHostWrapper = null; + boolean isOpenDummy = false; + try + { + String serviceConfigFileName = Environment.getEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar); + + // exit if there is not such env var + if (serviceConfigFileName == null || serviceConfigFileName.isEmpty()) + { + isOpenDummy = true; + TraceHelper.traceError(StringResource.getResource("ServiceConfigFileNameNotSpecified")); + throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceConfigFileNameNotSpecified)); + } + + //get the service config file full path + serviceConfigFullPath = GetServiceInfo(serviceConfigFileName); + if (!new File(serviceConfigFullPath).exists()) + { + isOpenDummy = true; + TraceHelper.traceError(StringResource + .getResource("CantFindServiceRegistrationFileserviceConfigFullPath")); + throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceRegistrationFileNotFound)); + } + + TraceHelper.traceInformation("serviceConfigFullPath = " + serviceConfigFullPath); + + //import the configuration to the service registration + ServiceRegistration serviceRegistration = Utility.getServiceRegistration(serviceConfigFullPath, exitCode); + if ((Integer) exitCode.get() != ErrorCode.Success) + { + isOpenDummy = true; + throw new Exception(exitCode.get().toString()); + } + + // Open the host + hpcServiceHostWrapper = new HpcServiceHostWrapper(serviceRegistration); + hpcServiceHostWrapper.publish(); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + TraceHelper.traceStackError(e); + } + finally + { + if(isOpenDummy) + { + if(hpcServiceHostWrapper==null) + { + hpcServiceHostWrapper = new HpcServiceHostWrapper(new ServiceRegistration()); + } + hpcServiceHostWrapper.openDummyService(); + } + } + } + + /** + * @description get the service config file full path by the file name + * @param serviceConfigFileName + * @return service config file full path + */ + private static String GetServiceInfo(String serviceConfigFileName) + { + String serviceConfigFile = null; + + try + { + + String headnode = Environment.getEnvironmentVariable(Constant.HeadnodeEnvVar); + TraceHelper.traceInformation(Environment.getEnvironmentVariable(Constant.RegistryPathEnv)); + ServiceRegistrationRepo serviceRegistration = new ServiceRegistrationRepo(headnode, + Environment.getEnvironmentVariable(Constant.RegistryPathEnv)); + + // Get the path to the service config file name + serviceConfigFile = serviceRegistration.getServiceRegistrationPath(serviceConfigFileName); + + if (serviceConfigFile == null) + { + // Make a part for the error message + String CentrialPath = serviceRegistration.getCentrialPath(); + + StringBuilder serviceRegDirsBuilder = new StringBuilder(); + if (CentrialPath != null && !CentrialPath.isEmpty()) + { + serviceRegDirsBuilder.append("\n\t"); + serviceRegDirsBuilder.append(CentrialPath); + } + serviceRegDirsBuilder.append("\n"); + + TraceHelper.traceError(String.format( + StringResource.getResource("CannotFindServiceRegistrationFileUnderFolders"), + serviceRegDirsBuilder.toString())); + } + } catch (Exception e) + { + e.printStackTrace(); + TraceHelper.traceError(String.format(StringResource.getResource("ExceptionInReadingRegistrationFile"), + serviceConfigFile, e.toString())); + } + + return serviceConfigFile; + } + + /** + * @description run a pre or post task if it exists + * @param exitCode + * @return + */ + private static boolean RunPrePostTask(AtomicReference exitCode) + { + boolean prePostTaskExists = false; + String prePostTaskCommandLine = Environment.getEnvironmentVariable(Constant.PrePostTaskCommandLineEnvVar); + + // Check if a pre/post task exists + prePostTaskExists = prePostTaskCommandLine != null; + + if (prePostTaskExists) + { + String serviceWorkingDirectory = null; + serviceWorkingDirectory = Environment.getEnvironmentVariable(Constant.PrePostTaskOnPremiseWorkingDirEnvVar); + + // Run command from comspec (like node manager babysitter) to ensure + // env vars are expanded and command runs as if launched from node manager + String commandLine = String.format("\"%s\" /S /c \"%s\"", Environment.getEnvironmentVariable("ComSpec"), + prePostTaskCommandLine); + ProcessBuilder pb = new ProcessBuilder(commandLine); + pb.directory(new File(serviceWorkingDirectory)); + pb.redirectErrorStream(); + TraceHelper.traceInformation(String.format("Executing '%s'", prePostTaskCommandLine)); + + try + { + Process subp = pb.start(); + subp.getErrorStream(); + InputStream is = subp.getErrorStream(); + InputStreamReader isr = new InputStreamReader(is, "GBK"); + BufferedReader br = new BufferedReader(isr); + + //wait the sub process to finish + exitCode.set(subp.waitFor()); + TraceHelper.traceError(br.toString()); + TraceHelper.traceInformation(String.format("ExitCode = %d", exitCode)); + + if (exitCode.equals(0)) + { + TraceHelper.traceInformation(String.format("Error output:%s", br.toString())); + } + + } catch (InterruptedException e) + { + TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine, + e.toString())); + } catch (IOException e) + { + TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine, + e.toString())); + } + + } + return prePostTaskExists; + } +} diff --git a/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java b/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java index 56adb4a..c8f8585 100644 --- a/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java +++ b/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java @@ -1,155 +1,155 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Outbound interceptor -// Capture the outbound message -// For message Preemption -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import java.util.logging.Level; -import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.phase.Phase; -import org.w3c.dom.Element; -import com.microsoft.hpc.exceptions.SOAFaultCode; -import com.microsoft.hpc.scheduler.session.Constant; -import com.microsoft.hpc.scheduler.session.fault.FaultMessageException; -import com.microsoft.hpc.scheduler.session.fault.ObjectFactory; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; -import com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault; - -/** - * @author t-junchw - * @date May 10, 2011 - * @description create fault message during message preemption The client should - * not try to create or attach to a session. It should report the - * error to their helpdesk. There is something wrong with app's - * implementation or installation - */ -public class MessagePreemptionOutInterceptor extends AbstractSoapInterceptor -{ - private HpcServiceHostWrapper hpcHostWrapper; - - public MessagePreemptionOutInterceptor(HpcServiceHostWrapper wrapper) - { - super(Phase.PRE_PROTOCOL); - this.hpcHostWrapper = wrapper; - - } - - /** - * (non-Javadoc) - * - * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message) - */ - @Override - public void handleMessage(SoapMessage message) throws Fault - { - if (hpcHostWrapper.enableMessageLevelPreemption) - { - String id = (String) message.getExchange().get("ID"); - ServiceContext.Logger.traceEvent(Level.INFO, id); - // If the message is not being processed, reply a fault message to - // the broker. - if (!this.hpcHostWrapper.processingMessageIds.contains(id)) - { - // create session fault instance - ObjectFactory objectFactory = new ObjectFactory(); - SvcHostSessionFault sessionFault = objectFactory - .createSessionFault(); - - sessionFault.setCode(SOAFaultCode.Service_Preempted.getCode()); - sessionFault - .setReason(objectFactory.createSessionFaultReason(String - .valueOf(this.hpcHostWrapper.processingMessageIds - .size()))); - - // create the fault detail - Element detailElement = InterceptorUtility - .createDetailElement(sessionFault); - Fault fault = new Fault(new FaultMessageException("", - sessionFault)); - fault.setDetail(detailElement); - throw fault; - - } else - { - // The service host receives the cancel event when the request - // is - // being processed, so add a header to notice the broker. - // It is mandatory when this response message is the last one. - // (no incoming request anymore) - if (this.hpcHostWrapper.receivedCancelEvent) - { - int messageCount = this.hpcHostWrapper.processingMessageIds - .size(); - InterceptorUtility.addMessageHeader(message, - Constant.MessageHeaderPreemption, - Constant.HpcHeaderNS, messageCount); - } - } - } - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Outbound interceptor +// Capture the outbound message +// For message Preemption +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import java.util.logging.Level; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.phase.Phase; +import org.w3c.dom.Element; +import com.microsoft.hpc.exceptions.SOAFaultCode; +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.fault.FaultMessageException; +import com.microsoft.hpc.scheduler.session.fault.ObjectFactory; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault; + +/** + * @author t-junchw + * @date May 10, 2011 + * @description create fault message during message preemption The client should + * not try to create or attach to a session. It should report the + * error to their helpdesk. There is something wrong with app's + * implementation or installation + */ +public class MessagePreemptionOutInterceptor extends AbstractSoapInterceptor +{ + private HpcServiceHostWrapper hpcHostWrapper; + + public MessagePreemptionOutInterceptor(HpcServiceHostWrapper wrapper) + { + super(Phase.PRE_PROTOCOL); + this.hpcHostWrapper = wrapper; + + } + + /** + * (non-Javadoc) + * + * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message) + */ + @Override + public void handleMessage(SoapMessage message) throws Fault + { + if (hpcHostWrapper.enableMessageLevelPreemption) + { + String id = (String) message.getExchange().get("ID"); + ServiceContext.Logger.traceEvent(Level.INFO, id); + // If the message is not being processed, reply a fault message to + // the broker. + if (!this.hpcHostWrapper.processingMessageIds.contains(id)) + { + // create session fault instance + ObjectFactory objectFactory = new ObjectFactory(); + SvcHostSessionFault sessionFault = objectFactory + .createSessionFault(); + + sessionFault.setCode(SOAFaultCode.Service_Preempted.getCode()); + sessionFault + .setReason(objectFactory.createSessionFaultReason(String + .valueOf(this.hpcHostWrapper.processingMessageIds + .size()))); + + // create the fault detail + Element detailElement = InterceptorUtility + .createDetailElement(sessionFault); + Fault fault = new Fault(new FaultMessageException("", + sessionFault)); + fault.setDetail(detailElement); + throw fault; + + } else + { + // The service host receives the cancel event when the request + // is + // being processed, so add a header to notice the broker. + // It is mandatory when this response message is the last one. + // (no incoming request anymore) + if (this.hpcHostWrapper.receivedCancelEvent) + { + int messageCount = this.hpcHostWrapper.processingMessageIds + .size(); + InterceptorUtility.addOrUpdateMessageHeader(message, + Constant.MessageHeaderPreemption, + Constant.HpcHeaderNS, messageCount); + } + } + } + } + +} diff --git a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java index 014d0cb..b399dcc 100644 --- a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java +++ b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java @@ -1,249 +1,264 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Save the Service Registration Information -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ -package com.microsoft.hpc.servicehost; - -import org.w3c.dom.DOMException; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import com.microsoft.hpc.properties.ErrorCode; -import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum; -import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; - -/** - * @author t-junchw - * @date May 10, 2011 - * @description store the service registration information - */ -public class ServiceRegistration -{ - - public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration"; - public final String serviceDiagnosticsName = "system.diagnostics"; - private final String sourcesNodeName = "sources"; - private final String sourceNodeName = "source"; - private final String traceLevelAttributeName = "switchValue"; - private final String serviceNodeName = "service"; - private final String assemblyAttributeName = "assembly"; - private final String serviceContractAttributeName = "contract"; - private final String serviceTypeAttributeName = "ServiceType"; - private final String includeFaultedExceptionAttributeName = "includeFaultedException"; - public Node serviceConfigNode = null; - public String serviceAssemblyFullPath = null; - public String traceLevel = "OFF"; - private boolean includeFaultedException; - - public boolean isIncludeFaultedException() - { - return includeFaultedException; - } - - /** - * @field user service type name - */ - public String serviceTypeName; - - /** - * @field user service Contact name - */ - public String serviceContractName; - - /** - * @return serviceTypeName - */ - public String getServiceTypeName() - { - return serviceTypeName; - } - - /** - * @return serviceContractName - */ - public String getServiceContractName() - { - return serviceContractName; - } - - /** - * @field user jar file name - */ - public String serviceAssemblyFileName; - - /** - * @description parse the XML node list to get the service registration settings - * @param nodelist - */ - public void setserviceConfigNode(NodeList nodelist) - { - NodeList serviceConfigurationNodeList = nodelist; - if (serviceConfigurationNodeList != null) - { - // get the user jar setting information - Node rootNode = serviceConfigurationNodeList.item(0); - for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode - .getNextSibling()) - { - if (rootNode.getNodeName() == serviceNodeName) - { - serviceConfigNode = rootNode; - NamedNodeMap map = serviceConfigNode.getAttributes(); - try - { - serviceAssemblyFullPath = map.getNamedItem( - assemblyAttributeName).getNodeValue(); - } catch (DOMException e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); - } - - try - { - serviceContractName = map.getNamedItem( - serviceContractAttributeName).getNodeValue(); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - - try - { - serviceTypeName = map.getNamedItem( - serviceTypeAttributeName).getNodeValue(); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - - try - { - includeFaultedException = Boolean.parseBoolean(map - .getNamedItem( - includeFaultedExceptionAttributeName) - .getNodeValue()); - - } catch (Exception e) - { - TraceHelper.traceError(e.toString()); - } - } - } - } - } - - /** - * @description parse the XML node list to get the java trace level - * @param nodeList - */ - public void setLoggerLevel(NodeList nodeList) - { - if (nodeList != null) - { - // get the java trace setting information - Node rootNode = nodeList.item(0); - for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode - .getNextSibling()) - { - if (rootNode.getNodeName() == sourcesNodeName) - { - for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode - .getNextSibling()) - { - if (subNode.getNodeName() == sourceNodeName) - { - NamedNodeMap map = subNode.getAttributes(); - try - { - traceLevel = map.getNamedItem( - traceLevelAttributeName).getNodeValue(); - traceLevel = traceLevel.substring(0, - traceLevel.indexOf(',')); - - // transfer the ETW trace level to java version - traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue(); - break; - } catch (DOMException e) - { - TraceHelper.traceError(e.toString()); - System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); - } - } - } - } - } - } - } - - /** - * @return serviceAssemblyFullPath - */ - public String getServiceAssemblyFullPath() - { - return serviceAssemblyFullPath; - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Save the Service Registration Information +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ +package com.microsoft.hpc.servicehost; + +import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum; +import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; + +/** + * @author t-junchw + * @date May 10, 2011 + * @description store the service registration information + */ +public class ServiceRegistration +{ + + public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration"; + public final String serviceDiagnosticsName = "system.diagnostics"; + private final String sourcesNodeName = "sources"; + private final String sourceNodeName = "source"; + private final String traceLevelAttributeName = "switchValue"; + private final String serviceNodeName = "service"; + private final String assemblyAttributeName = "assembly"; + private final String serviceContractAttributeName = "contract"; + private final String serviceTypeAttributeName = "ServiceType"; + private final String includeFaultedExceptionAttributeName = "includeFaultedException"; + private final String soaDiagTraceLevelAttributeName = "soaDiagTraceLevel"; + public Node serviceConfigNode = null; + public String serviceAssemblyFullPath = null; + public String traceLevel = "OFF"; + public String soaDiagTraceLevel = "Off"; + + private boolean includeFaultedException; + + public boolean isIncludeFaultedException() + { + return includeFaultedException; + } + + /** + * @field user service type name + */ + public String serviceTypeName; + + /** + * @field user service Contact name + */ + public String serviceContractName; + + /** + * @return serviceTypeName + */ + public String getServiceTypeName() + { + return serviceTypeName; + } + + /** + * @return serviceContractName + */ + public String getServiceContractName() + { + return serviceContractName; + } + + + + /** + * @field user jar file name + */ + public String serviceAssemblyFileName; + + /** + * @description parse the XML node list to get the service registration settings + * @param nodelist + */ + public void setserviceConfigNode(NodeList nodelist) + { + NodeList serviceConfigurationNodeList = nodelist; + if (serviceConfigurationNodeList != null) + { + // get the user jar setting information + Node rootNode = serviceConfigurationNodeList.item(0); + for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode + .getNextSibling()) + { + if (rootNode.getNodeName() == serviceNodeName) + { + serviceConfigNode = rootNode; + NamedNodeMap map = serviceConfigNode.getAttributes(); + try + { + serviceAssemblyFullPath = map.getNamedItem( + assemblyAttributeName).getNodeValue(); + } catch (DOMException e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); + } + + try + { + serviceContractName = map.getNamedItem( + serviceContractAttributeName).getNodeValue(); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + serviceTypeName = map.getNamedItem( + serviceTypeAttributeName).getNodeValue(); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + includeFaultedException = Boolean.parseBoolean(map + .getNamedItem( + includeFaultedExceptionAttributeName) + .getNodeValue()); + + } catch (Exception e) + { + TraceHelper.traceError(e.toString()); + } + + try + { + if(map.getNamedItem(soaDiagTraceLevelAttributeName) != null && + map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue() != null) { + soaDiagTraceLevel = map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue().split(",")[0]; + } + } catch(Exception e) { + TraceHelper.traceError(e.toString()); + } + } + } + } + } + + /** + * @description parse the XML node list to get the java trace level + * @param nodeList + */ + public void setLoggerLevel(NodeList nodeList) + { + if (nodeList != null) + { + // get the java trace setting information + Node rootNode = nodeList.item(0); + for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode + .getNextSibling()) + { + if (rootNode.getNodeName() == sourcesNodeName) + { + for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode + .getNextSibling()) + { + if (subNode.getNodeName() == sourceNodeName) + { + NamedNodeMap map = subNode.getAttributes(); + try + { + traceLevel = map.getNamedItem( + traceLevelAttributeName).getNodeValue(); + traceLevel = traceLevel.substring(0, + traceLevel.indexOf(',')); + + // transfer the ETW trace level to java version + traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue(); + break; + } catch (DOMException e) + { + TraceHelper.traceError(e.toString()); + System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); + } + } + } + } + } + } + } + + /** + * @return serviceAssemblyFullPath + */ + public String getServiceAssemblyFullPath() + { + return serviceAssemblyFullPath; + } + +} diff --git a/src/com/microsoft/hpc/servicehost/Utility.java b/src/com/microsoft/hpc/servicehost/Utility.java index 3319668..1243e27 100644 --- a/src/com/microsoft/hpc/servicehost/Utility.java +++ b/src/com/microsoft/hpc/servicehost/Utility.java @@ -1,160 +1,161 @@ -// ------------------------------------------------------------------------------ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Utility for service host -// -// ------------------------------------------------------------------------------ -/* -JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER - -Copyright (c) Microsoft Corporation. All rights reserved. - -This license governs use of the accompanying software. If you use the -software, you accept this license. If you do not accept the license, do not -use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. -A "contribution. is the original software, or any additions or changes to -the software. -A "contributor. is any person that distributes its contribution under this -license. -"Licensed patents. are a contributor.s patent claims that read directly on -its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the -license conditions and limitations in section 3, each contributor grants you -a non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute -its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose -of its contribution in the software or derivative works of the contribution -in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that -you claim are infringed by the software, your patent license from such -contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in -the software. -(D) If you distribute any portion of the software in source code form, -you may do so only under this license by including a complete copy of this -license with your distribution. If you distribute any portion of the software -in compiled or object code form, you may only do so under a license that -complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may -have additional consumer rights under your local laws which this license -cannot change. To the extent permitted under your local laws, the contributors -exclude the implied warranties of merchantability, fitness for a particular -purpose and non-infringement. -(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend -only to the software or derivative works that you create that operate with -Windows HPC Server. -*/ - -package com.microsoft.hpc.servicehost; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.concurrent.atomic.AtomicReference; -import java.util.logging.Level; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import com.microsoft.hpc.properties.ErrorCode; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; -import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; -import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; -import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; - -/** - * @author t-junchw - * @date May 10, 2011 - * @description utility for service host - */ -public class Utility -{ - /** - * @description get service registration info from config file - * @param serviceConfigName service configuration file - * @param exitCode error code - * @return ServiceRegistration - */ - public static ServiceRegistration getServiceRegistration(String serviceConfigName, - AtomicReference exitCode) - { - // open the service registration configuration section - ServiceRegistration serviceRegistration = new ServiceRegistration(); - // initiate the exitCode - exitCode.set(ErrorCode.Success); - - DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance(); - String serviceAssemblyFullPath = null; - try - { - // parse the service registration XML - DocumentBuilder dombuilder = domfac.newDocumentBuilder(); - InputStream is = new FileInputStream(serviceConfigName); - Document doc = dombuilder.parse(is); - Element root = doc.getDocumentElement(); - serviceRegistration.setserviceConfigNode(root - .getElementsByTagName(serviceRegistration.serviceConfigurationsName)); - - serviceAssemblyFullPath = serviceRegistration.getServiceAssemblyFullPath(); - try - { - serviceRegistration.setLoggerLevel(root - .getElementsByTagName(serviceRegistration.serviceDiagnosticsName)); - } catch (Exception e) - { - // system.diagnostics tag in hpc xml is not necessary - } - TraceHelper.traceInformation("Trace Level is "+serviceRegistration.traceLevel); - ServiceContext.setTraceLevel(serviceRegistration.traceLevel); - - } catch (Exception e) - { - // exception occurs when parsing the XML - ServiceContext.Logger.traceEvent(Level.SEVERE, e.toString()); - TraceHelper.traceError(e.toString()); - exitCode.set(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); - //return null; - } - - if (serviceAssemblyFullPath == null || serviceAssemblyFullPath.isEmpty()) - { - String message = String.format(StringResource.getResource("AssemblyFileNotRegistered"), - serviceConfigName); - TraceHelper.traceError(message); - ServiceContext.Logger.traceEvent(Level.SEVERE, message); - exitCode.set(ErrorCode.ServiceHost_AssemblyFileNameNullOrEmpty); - //return null; - } - - if (!new File(serviceAssemblyFullPath).exists()) - { - // If the obtained service assembly path is not valid or not - // existing - String message = String.format(StringResource.getResource("AssemblyFileCantFind"), - serviceAssemblyFullPath); - TraceHelper.traceError(message); - ServiceContext.Logger.traceEvent(Level.SEVERE, message); - exitCode.set(ErrorCode.ServiceHost_AssemblyFileNotFound); - } - return serviceRegistration; - } - -} +// ------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility for service host +// +// ------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +package com.microsoft.hpc.servicehost; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.concurrent.atomic.AtomicReference; +import java.util.logging.Level; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import com.microsoft.hpc.properties.ErrorCode; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration; +import com.microsoft.hpc.scheduler.session.servicecontext.StringResource; +import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper; + +/** + * @author t-junchw + * @date May 10, 2011 + * @description utility for service host + */ +public class Utility +{ + /** + * @description get service registration info from config file + * @param serviceConfigName service configuration file + * @param exitCode error code + * @return ServiceRegistration + */ + public static ServiceRegistration getServiceRegistration(String serviceConfigName, + AtomicReference exitCode) + { + // open the service registration configuration section + ServiceRegistration serviceRegistration = new ServiceRegistration(); + // initiate the exitCode + exitCode.set(ErrorCode.Success); + + DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance(); + String serviceAssemblyFullPath = null; + try + { + // parse the service registration XML + DocumentBuilder dombuilder = domfac.newDocumentBuilder(); + InputStream is = new FileInputStream(serviceConfigName); + Document doc = dombuilder.parse(is); + Element root = doc.getDocumentElement(); + serviceRegistration.setserviceConfigNode(root + .getElementsByTagName(serviceRegistration.serviceConfigurationsName)); + serviceRegistration.setEnableWSAddressing(doc); + serviceAssemblyFullPath = serviceRegistration.getServiceAssemblyFullPath(); + try + { + serviceRegistration.setLoggerLevel(root + .getElementsByTagName(serviceRegistration.serviceDiagnosticsName)); + } catch (Exception e) + { + // system.diagnostics tag in hpc xml is not necessary + } + TraceHelper.traceInformation("Trace Level is "+serviceRegistration.traceLevel); + ServiceContext.setTraceLevel(serviceRegistration.traceLevel); + ServiceContext.setSoaDiagTraceLevel(serviceRegistration.soaDiagTraceLevel); + + } catch (Exception e) + { + // exception occurs when parsing the XML + ServiceContext.Logger.traceEvent(Level.SEVERE, e.toString()); + TraceHelper.traceError(e.toString()); + exitCode.set(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat); + //return null; + } + + if (serviceAssemblyFullPath == null || serviceAssemblyFullPath.isEmpty()) + { + String message = String.format(StringResource.getResource("AssemblyFileNotRegistered"), + serviceConfigName); + TraceHelper.traceError(message); + ServiceContext.Logger.traceEvent(Level.SEVERE, message); + exitCode.set(ErrorCode.ServiceHost_AssemblyFileNameNullOrEmpty); + //return null; + } + + if (!new File(serviceAssemblyFullPath).exists()) + { + // If the obtained service assembly path is not valid or not + // existing + String message = String.format(StringResource.getResource("AssemblyFileCantFind"), + serviceAssemblyFullPath); + TraceHelper.traceError(message); + ServiceContext.Logger.traceEvent(Level.SEVERE, message); + exitCode.set(ErrorCode.ServiceHost_AssemblyFileNotFound); + } + return serviceRegistration; + } + +} diff --git a/src/com/microsoft/hpc/session/RetryOperationError.java b/src/com/microsoft/hpc/session/RetryOperationError.java index d8d60f4..7eb14b1 100644 --- a/src/com/microsoft/hpc/session/RetryOperationError.java +++ b/src/com/microsoft/hpc/session/RetryOperationError.java @@ -1,90 +1,98 @@ - -package com.microsoft.hpc.session; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RetryOperationError complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RetryOperationError">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="retryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RetryOperationError", propOrder = { - "reason", - "retryCount" -}) -public class RetryOperationError { - - @XmlElementRef(name = "reason", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) - protected JAXBElement reason; - protected Integer retryCount; - - /** - * Gets the value of the reason property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public JAXBElement getReason() { - return reason; - } - - /** - * Sets the value of the reason property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setReason(JAXBElement value) { - this.reason = ((JAXBElement ) value); - } - - /** - * Gets the value of the retryCount property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRetryCount() { - return retryCount; - } - - /** - * Sets the value of the retryCount property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRetryCount(Integer value) { - this.retryCount = value; - } - -} + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RetryOperationError complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RetryOperationError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="retryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name="RetryOperationError",namespace="http://hpc.microsoft.com/session/") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RetryOperationError", propOrder = { + "reason", + "retryCount" +}, namespace="http://hpc.microsoft.com/session/") +public class RetryOperationError { + + @XmlTransient + public static final String Action = "http://hpc.microsoft.com/session/RetryOperationError"; + + @XmlElementRef(name = "reason", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement reason; + @XmlElement(name = "retryCount", namespace = "http://hpc.microsoft.com/session/") + protected Integer retryCount; + + /** + * Gets the value of the reason property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReason() { + return reason; + } + + /** + * Sets the value of the reason property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReason(JAXBElement value) { + this.reason = ((JAXBElement ) value); + } + + /** + * Gets the value of the retryCount property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRetryCount() { + return retryCount; + } + + /** + * Sets the value of the retryCount property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRetryCount(Integer value) { + this.retryCount = value; + } + +} diff --git a/src/com/microsoft/hpc/sessionlauncher/ObjectFactory.java b/src/com/microsoft/hpc/sessionlauncher/ObjectFactory.java index 03b17a3..57c444b 100644 --- a/src/com/microsoft/hpc/sessionlauncher/ObjectFactory.java +++ b/src/com/microsoft/hpc/sessionlauncher/ObjectFactory.java @@ -33,8 +33,10 @@ public class ObjectFactory { private final static QName _SessionInfoBrokerEpr_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "BrokerEpr"); private final static QName _SessionInfoServerVersion_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "ServerVersion"); private final static QName _SessionInfoBrokerLauncherEpr_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "BrokerLauncherEpr"); + private final static QName _SessionInfoSessionOwner_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "SessionOwner"); private final static QName _SessionInfoServiceVersion_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "ServiceVersion"); private final static QName _SessionInfoResponseEpr_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "ResponseEpr"); + private final static QName _SessionInfoSessionACL_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "SessionACL"); private final static QName _SessionInfoControllerEpr_QNAME = new QName("http://hpc.microsoft.com/SessionLauncher", "ControllerEpr"); private final static QName _GetServiceVersionsServiceName_QNAME = new QName("http://hpc.microsoft.com/sessionlauncher/", "serviceName"); private final static QName _AllocateDurableResponseAllocateDurableResult_QNAME = new QName("http://hpc.microsoft.com/sessionlauncher/", "AllocateDurableResult"); @@ -202,6 +204,16 @@ public JAXBElement createGetInfoResponseGetInfoResult(SessionInfo v public JAXBElement createSessionInfoBrokerEpr(ArrayOfstring value) { return new JAXBElement(_SessionInfoBrokerEpr_QNAME, ArrayOfstring.class, SessionInfo.class, value); } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SessionLauncher", name = "SessionOwner", scope = SessionInfo.class) + public JAXBElement createSessionInfoSessionOwner(String value) { + return new JAXBElement(_SessionInfoSessionOwner_QNAME, String.class, SessionInfo.class, value); + } + /** * Create an instance of {@link JAXBElement }{@code <}{@link Version }{@code >}} @@ -230,6 +242,15 @@ public JAXBElement createSessionInfoServiceVersion(Version value) { return new JAXBElement(_SessionInfoServiceVersion_QNAME, Version.class, SessionInfo.class, value); } + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SessionLauncher", name = "SessionACL", scope = SessionInfo.class) + public JAXBElement createSessionInfoSessionACL(ArrayOfstring value) { + return new JAXBElement(_SessionInfoSessionACL_QNAME, ArrayOfstring.class, SessionInfo.class, value); + } + /** * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} * diff --git a/src/com/microsoft/hpc/sessionlauncher/SessionInfo.java b/src/com/microsoft/hpc/sessionlauncher/SessionInfo.java index 354447c..6b73f55 100644 --- a/src/com/microsoft/hpc/sessionlauncher/SessionInfo.java +++ b/src/com/microsoft/hpc/sessionlauncher/SessionInfo.java @@ -37,6 +37,8 @@ * <element name="ServerVersion" type="{http://schemas.datacontract.org/2004/07/System}Version" minOccurs="0"/> * <element name="ServiceOperationTimeout" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * <element name="ServiceVersion" type="{http://schemas.datacontract.org/2004/07/System}Version" minOccurs="0"/> + * <element name="SessionACL" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/> + * <element name="SessionOwner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="TransportScheme" type="{http://schemas.datacontract.org/2004/07/Microsoft.Hpc.Scheduler.Session}TransportScheme" minOccurs="0"/> * <element name="UseInprocessBroker" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * </sequence> @@ -62,6 +64,8 @@ "serverVersion", "serviceOperationTimeout", "serviceVersion", + "sessionACL", + "sessionOwner", "transportScheme", "useInprocessBroker" }) @@ -94,6 +98,10 @@ public class SessionInfo { protected Integer serviceOperationTimeout; @XmlElementRef(name = "ServiceVersion", namespace = "http://hpc.microsoft.com/SessionLauncher", type = JAXBElement.class, required = false) protected JAXBElement serviceVersion; + @XmlElementRef(name = "SessionACL", namespace = "http://hpc.microsoft.com/SessionLauncher", type = JAXBElement.class, required = false) + protected JAXBElement sessionACL; + @XmlElementRef(name = "SessionOwner", namespace = "http://hpc.microsoft.com/SessionLauncher", type = JAXBElement.class, required = false) + protected JAXBElement sessionOwner; @XmlList @XmlElement(name = "TransportScheme") protected List transportScheme; @@ -417,6 +425,54 @@ public void setServiceVersion(JAXBElement value) { this.serviceVersion = ((JAXBElement ) value); } + /** + * Gets the value of the sessionACL property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getSessionACL() { + return sessionACL; + } + + /** + * Sets the value of the sessionACL property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setSessionACL(JAXBElement value) { + this.sessionACL = ((JAXBElement ) value); + } + + /** + * Gets the value of the sessionOwner property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getSessionOwner() { + return sessionOwner; + } + + /** + * Sets the value of the sessionOwner property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setSessionOwner(JAXBElement value) { + this.sessionOwner = ((JAXBElement ) value); + } + /** * Gets the value of the transportScheme property. * diff --git a/src/hpc.microsoft.com.brokercontroller.wsdl b/src/hpc.microsoft.com.brokercontroller.wsdl new file mode 100644 index 0000000..ba093a0 --- /dev/null +++ b/src/hpc.microsoft.com.brokercontroller.wsdl @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/hpc.microsoft.com.brokercontroller.xsd b/src/hpc.microsoft.com.brokercontroller.xsd new file mode 100644 index 0000000..8fc4e4c --- /dev/null +++ b/src/hpc.microsoft.com.brokercontroller.xsd @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/hpc.microsoft.com.dataservice.wsdl b/src/hpc.microsoft.com.dataservice.wsdl new file mode 100644 index 0000000..6216c0b --- /dev/null +++ b/src/hpc.microsoft.com.dataservice.wsdl @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/hpc.microsoft.com.dataservice.xsd b/src/hpc.microsoft.com.dataservice.xsd new file mode 100644 index 0000000..221c2a9 --- /dev/null +++ b/src/hpc.microsoft.com.dataservice.xsd @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/makejar.cmd b/src/makejar.cmd index 5a14f7e..2fc7f31 100644 --- a/src/makejar.cmd +++ b/src/makejar.cmd @@ -1,19 +1,33 @@ @echo off + + + set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 + set CXF_HOME=c:\java\apache-cxf-2.4.0 set JAVAC="%JAVA_HOME%\bin\javac.exe" + set JAR="%JAVA_HOME%\bin\jar.exe" + set CLASSPATH=.;%CXF_HOME%\lib\cxf-manifest.jar + set JARFILEClient=Microsoft-HpcSession-3.0.jar + set JARFILEHost=Microsoft-HpcServiceHost-3.0.jar - echo Compiling - del src.list + + echo Compiling + + dir src.list > nul 2>&1 && del src.list + FOR /F %%i IN ('dir /b/s *.java') DO echo %%i >> src.list + %javac% -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" @src.list - - + + echo Create Jar - + %jar% cfm %JARFILEClient% manifestclient com\microsoft\schemas com\microsoft\hpc\*.class com\microsoft\hpc\*.java com\microsoft\hpc\brokercontroller com\microsoft\hpc\brokerlauncher com\microsoft\hpc\dataservice com\microsoft\hpc\exceptions com\microsoft\hpc\genericservice com\microsoft\hpc\properties com\microsoft\hpc\scheduler com\microsoft\hpc\session com\microsoft\hpc\sessionlauncher org FaultCodeMessageBundle.properties *.wsdl *.xsd StringTableBundle.properties + %jar% cfm %JARFILEHost% manifesthost com\microsoft\hpc\servicehost + echo Build completed diff --git a/src/makejar.sh b/src/makejar.sh index 59cfa50..7945e7c 100644 --- a/src/makejar.sh +++ b/src/makejar.sh @@ -1,9 +1,9 @@ #!/bin/sh -export CXF_HOME=~/apache-cxf-2.4.0 +export CXF_HOME=/usr/java/apache-cxf-2.4.0 export CLASSPATH=$CXF_HOME/lib/cxf-manifest.jar find . -name *.java -print | xargs javac -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" -jar cvfm Microsoft-HpcSession-3.0.jar manifesthost_linux org com/microsoft/schemas com/microsoft/hpc/brokercontroller com/microsoft/hpc/brokerlauncher com/microsoft/hpc/dataservice com/microsoft/hpc/exceptions com/microsoft/hpc/genericservice com/microsoft/hpc/properties com/microsoft/hpc/scheduler com/microsoft/hpc/session com/microsoft/hpc/sessionlauncher com/microsoft/hpc/*.class com/microsoft/hpc/*.java FaultCodeMessageBundle.properties StringTableBundle.properties +jar cvfm Microsoft-HpcSession-3.0.jar manifestclient_linux org com/microsoft/schemas com/microsoft/hpc/brokercontroller com/microsoft/hpc/brokerlauncher com/microsoft/hpc/dataservice com/microsoft/hpc/exceptions com/microsoft/hpc/genericservice com/microsoft/hpc/properties com/microsoft/hpc/scheduler com/microsoft/hpc/session com/microsoft/hpc/sessionlauncher com/microsoft/hpc/*.class com/microsoft/hpc/*.java *.wsdl *.xsd FaultCodeMessageBundle.properties StringTableBundle.properties -jar cvfm Microsoft-HpcServiceHost-3.0.jar manifestclient_linux com/microsoft/hpc/servicehost +jar cvfm Microsoft-HpcServiceHost-3.0.jar manifesthost_linux com/microsoft/hpc/servicehost diff --git a/src/manifestclient b/src/manifestclient index 0c14921..0efcae7 100644 --- a/src/manifestclient +++ b/src/manifestclient @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Class-Path: /%CXF_HOME%\lib\cxf-manifest.jar +Class-Path: file:///c:\java\apache-cxf-2.4.0\lib\cxf-manifest.jar diff --git a/src/manifestclient_linux b/src/manifestclient_linux index 2140153..38100d2 100644 --- a/src/manifestclient_linux +++ b/src/manifestclient_linux @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Class-Path: $CXF_HOME/lib/cxf-manifest.jar +Class-Path: /usr/java/apache-cxf-2.4.0/lib/cxf-manifest.jar diff --git a/src/manifesthost b/src/manifesthost index 29c6b8c..1513635 100644 --- a/src/manifesthost +++ b/src/manifesthost @@ -1,4 +1,4 @@ Manifest-Version: 1.0 Main-Class: com.microsoft.hpc.servicehost.Main -Class-Path: Microsoft-HpcSession-3.0.jar /%CXF_HOME%\lib\cxf-manifest.jar +Class-Path: Microsoft-HpcSession-3.0.jar file:///c:\java\apache-cxf-2.4.0\lib\cxf-manifest.jar diff --git a/src/manifesthost_linux b/src/manifesthost_linux index ba62f70..34d7098 100644 --- a/src/manifesthost_linux +++ b/src/manifesthost_linux @@ -1,4 +1,4 @@ Manifest-Version: 1.0 Main-Class: com.microsoft.hpc.servicehost.Main -Class-Path: Microsoft-HpcSession-3.0.jar $CXF_HOME/libcxf-manifest.jar +Class-Path: Microsoft-HpcSession-3.0.jar /usr/java/apache-cxf-2.4.0/lib/cxf-manifest.jar diff --git a/src/tracehelper/RuntimeEvents.h b/src/tracehelper/RuntimeEvents.h new file mode 100644 index 0000000..74a9ee1 --- /dev/null +++ b/src/tracehelper/RuntimeEvents.h @@ -0,0 +1,239 @@ +//**********************************************************************` +//* This is an include file generated by Message Compiler. *` +//* *` +//* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +//**********************************************************************` +#pragma once +//+ +// Provider Microsoft-HPC-Runtime Event Count 60 +//+ +EXTERN_C __declspec(selectany) const GUID RuntimeTrace = {0x8979efb0, 0x97da, 0x4729, {0x82, 0x96, 0xf1, 0x18, 0xf3, 0x56, 0x2a, 0x53}}; + +// +// Channel +// +#define RuntimeTrace_CHANNEL_AdminChannel 0x10 +#define HPC_CHANNEL_Runtime_OP 0x11 +#define DebugChannel 0x12 +#define AnalyticChannel 0x13 + +// +// Tasks +// +#define DebugTrace 0x1 +#define SessionLifecycle 0x2 +#define Client 0x3 +#define Dispatcher 0x4 +#define FrontEnd 0x5 +#define ServiceHost 0x6 +#define RequestProcessing 0x7 +#define BrokerWorker 0x8 +#define UserTrace 0x9 +#define HpcSessionTrace 0xa +// +// Keyword +// +#define TextTracing 0x1 + +// +// Event Descriptors +// +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR TextVerbose = {0xa, 0x0, 0x13, 0x5, 0x0, 0x1, 0x1000000000000001}; +#define TextVerbose_value 0xa +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR TextInfo = {0xb, 0x0, 0x13, 0x4, 0x0, 0x1, 0x1000000000000001}; +#define TextInfo_value 0xb +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR TextWarning = {0xc, 0x0, 0x13, 0x3, 0x0, 0x1, 0x1000000000000001}; +#define TextWarning_value 0xc +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR TextError = {0xd, 0x0, 0x13, 0x2, 0x0, 0x1, 0x1000000000000001}; +#define TextError_value 0xd +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR TextCritial = {0xe, 0x0, 0x13, 0x1, 0x0, 0x1, 0x1000000000000001}; +#define TextCritial_value 0xe +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EventTextCritial = {0x271e, 0x0, 0x10, 0x1, 0x0, 0xa, 0x8000000000000001}; +#define EventTextCritial_value 0x271e +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EventTextVerbose = {0x271a, 0x0, 0x12, 0x5, 0x0, 0xa, 0x2000000000000001}; +#define EventTextVerbose_value 0x271a +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EventTextInfo = {0x271b, 0x0, 0x12, 0x4, 0x0, 0xa, 0x2000000000000001}; +#define EventTextInfo_value 0x271b +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EventTextWarning = {0x271c, 0x0, 0x12, 0x3, 0x0, 0xa, 0x2000000000000001}; +#define EventTextWarning_value 0x271c +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EventTextError = {0x271d, 0x0, 0x11, 0x2, 0x0, 0xa, 0x4000000000000001}; +#define EventTextError_value 0x271d +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostRequestReceived = {0x3e8, 0x0, 0x13, 0x5, 0xf0, 0x6, 0x1000000000000000}; +#define HostRequestReceived_value 0x3e8 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostResponseSent = {0x3e9, 0x0, 0x13, 0x5, 0x6, 0x6, 0x1000000000000000}; +#define HostResponseSent_value 0x3e9 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostStart = {0x3ea, 0x0, 0x13, 0x4, 0x1, 0x6, 0x1000000000000000}; +#define HostStart_value 0x3ea +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostStop = {0x3eb, 0x0, 0x13, 0x4, 0x2, 0x6, 0x1000000000000000}; +#define HostStop_value 0x3eb +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostServiceConfigCheck = {0x3ec, 0x0, 0x10, 0x3, 0x0, 0xa, 0x8000000000000000}; +#define HostServiceConfigCheck_value 0x3ec +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostAssemblyLoaded = {0x3ed, 0x0, 0x13, 0x4, 0x0, 0x6, 0x1000000000000000}; +#define HostAssemblyLoaded_value 0x3ed +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HostCanceled = {0x3ee, 0x0, 0x13, 0x4, 0x0, 0x6, 0x1000000000000000}; +#define HostCanceled_value 0x3ee +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestReceived = {0xbb8, 0x0, 0x13, 0x5, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestReceived_value 0xbb8 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndResponseSent = {0xbb9, 0x0, 0x13, 0x5, 0x6, 0x7, 0x1000000000000000}; +#define FrontEndResponseSent_value 0xbb9 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendRequestSent = {0xbba, 0x0, 0x13, 0x5, 0x9, 0x7, 0x1000000000000000}; +#define BackendRequestSent_value 0xbba +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendResponseReceived = {0xbbb, 0x0, 0x13, 0x5, 0xf0, 0x7, 0x1000000000000000}; +#define BackendResponseReceived_value 0xbbb +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendRequestSentFailed = {0xbbc, 0x0, 0x13, 0x3, 0x9, 0x7, 0x1000000000000000}; +#define BackendRequestSentFailed_value 0xbbc +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendResponseReceivedFailed = {0xbbd, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define BackendResponseReceivedFailed_value 0xbbd +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndResponseSentFailed = {0xbbe, 0x0, 0x13, 0x3, 0x9, 0x7, 0x1000000000000000}; +#define FrontEndResponseSentFailed_value 0xbbe +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestRejectedClientIdNotMatch = {0xbbf, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestRejectedClientIdNotMatch_value 0xbbf +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestRejectedClientIdInvalid = {0xbc0, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestRejectedClientIdInvalid_value 0xbc0 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestRejectedClientStateInvalid = {0xbc1, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestRejectedClientStateInvalid_value 0xbc1 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendResponseReceivedRetryOperationError = {0xbc2, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define BackendResponseReceivedRetryOperationError_value 0xbc2 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendResponseReceivedRetryLimitExceed = {0xbc3, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define BackendResponseReceivedRetryLimitExceed_value 0xbc3 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendRequestPutBack = {0xbc4, 0x0, 0x13, 0x5, 0x9, 0x7, 0x1000000000000000}; +#define BackendRequestPutBack_value 0xbc4 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendGeneratedFaultReply = {0xbc5, 0x0, 0x13, 0x5, 0xf0, 0x7, 0x1000000000000000}; +#define BackendGeneratedFaultReply_value 0xbc5 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestRejectedAuthenticationError = {0xbc6, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestRejectedAuthenticationError_value 0xbc6 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FrontEndRequestRejectedGeneralError = {0xbc7, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define FrontEndRequestRejectedGeneralError_value 0xbc7 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendHandleResponseFailed = {0xbc8, 0x0, 0x13, 0x2, 0xf0, 0x7, 0x1000000000000000}; +#define BackendHandleResponseFailed_value 0xbc8 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendHandleEndpointNotFoundExceptionFailed = {0xbc9, 0x0, 0x13, 0x2, 0xf0, 0x7, 0x1000000000000000}; +#define BackendHandleEndpointNotFoundExceptionFailed_value 0xbc9 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendHandleExceptionFailed = {0xbca, 0x0, 0x13, 0x2, 0xf0, 0x7, 0x1000000000000000}; +#define BackendHandleExceptionFailed_value 0xbca +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendEndpointNotFoundExceptionOccured = {0xbcb, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define BackendEndpointNotFoundExceptionOccured_value 0xbcb +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendDispatcherClosed = {0xbcc, 0x0, 0x13, 0x3, 0x9, 0x7, 0x1000000000000000}; +#define BackendDispatcherClosed_value 0xbcc +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BackendResponseReceivedSessionFault = {0xbcd, 0x0, 0x13, 0x3, 0xf0, 0x7, 0x1000000000000000}; +#define BackendResponseReceivedSessionFault_value 0xbcd +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionCreating = {0xfa0, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionCreating_value 0xfa0 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionCreated = {0xfa1, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionCreated_value 0xfa1 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FailedToCreateSession = {0xfa2, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define FailedToCreateSession_value 0xfa2 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionFinished = {0xfa3, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionFinished_value 0xfa3 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionFinishedBecauseOfJobCanceled = {0xfa4, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionFinishedBecauseOfJobCanceled_value 0xfa4 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionFinishedBecauseOfTimeout = {0xfa5, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionFinishedBecauseOfTimeout_value 0xfa5 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionSuspended = {0xfa6, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionSuspended_value 0xfa6 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionSuspendedBecauseOfJobCanceled = {0xfa7, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionSuspendedBecauseOfJobCanceled_value 0xfa7 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionSuspendedBecauseOfTimeout = {0xfa8, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionSuspendedBecauseOfTimeout_value 0xfa8 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionRaisedUp = {0xfa9, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionRaisedUp_value 0xfa9 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SessionRaisedUpFailover = {0xfaa, 0x0, 0x13, 0x4, 0x0, 0x2, 0x1000000000000000}; +#define SessionRaisedUpFailover_value 0xfaa +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BrokerWorkerUnexpectedlyExit = {0x1388, 0x0, 0x11, 0x2, 0x0, 0x8, 0x4000000000000000}; +#define BrokerWorkerUnexpectedlyExit_value 0x1388 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BrokerWorkerMessage = {0x1389, 0x0, 0x11, 0x4, 0x0, 0x8, 0x4000000000000000}; +#define BrokerWorkerMessage_value 0x1389 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BrokerWorkerProcessReady = {0x138a, 0x0, 0x11, 0x4, 0x0, 0x8, 0x4000000000000000}; +#define BrokerWorkerProcessReady_value 0x138a +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BrokerWorkerProcessExited = {0x138b, 0x0, 0x11, 0x4, 0x0, 0x8, 0x4000000000000000}; +#define BrokerWorkerProcessExited_value 0x138b +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR BrokerWorkerProcessFailedToInitialize = {0x138c, 0x0, 0x11, 0x3, 0x0, 0x8, 0x4000000000000000}; +#define BrokerWorkerProcessFailedToInitialize_value 0x138c +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR UserTraceVerbose = {0x2328, 0x0, 0x13, 0x5, 0x0, 0x9, 0x1000000000000001}; +#define UserTraceVerbose_value 0x2328 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR UserTraceInfo = {0x2329, 0x0, 0x13, 0x4, 0x0, 0x9, 0x1000000000000001}; +#define UserTraceInfo_value 0x2329 +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR UserTraceWarning = {0x232a, 0x0, 0x13, 0x3, 0x0, 0x9, 0x1000000000000001}; +#define UserTraceWarning_value 0x232a +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR UserTraceError = {0x232b, 0x0, 0x13, 0x2, 0x0, 0x9, 0x1000000000000001}; +#define UserTraceError_value 0x232b +EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR UserTraceCritial = {0x232c, 0x0, 0x10, 0x1, 0x0, 0x9, 0x8000000000000001}; +#define UserTraceCritial_value 0x232c +//+ +// Provider Microsoft-HPC-SOADiag Event Count 11 +//+ +EXTERN_C __declspec(selectany) const GUID SOADiagTrace = {0xf120775c, 0xdb24, 0x4504, {0xb1, 0xc8, 0x7f, 0x12, 0x0d, 0x80, 0x08, 0xa0}}; + +// +// Channel +// +#define SOADiagTrace_CHANNEL_AdminChannel 0x10 +#define HPC_CHANNEL_Runtime_OP 0x11 +#define DebugChannel 0x12 + +// +// Tasks +// +#define DebugTrace 0x1 +#define EventLifecycle 0x2 +#define Throttling 0x3 +#define DiagMonLifecycle 0x4 +// +// Keyword +// +#define TextTracing 0x1 + +#define StopThrottle_value 0x7d1 +#define MSG_TextTracing 0x10000001L +#define MSG_StringMessage 0xB000000AL +#define MSG_HostRequestReceived 0xB00003E8L +#define MSG_HostResponseSent 0xB00003E9L +#define MSG_HostStart 0xB00003EAL +#define MSG_HostServiceConfigCheck 0xB00003ECL +#define MSG_HostAssemblyLoaded 0xB00003EDL +#define MSG_HostCanceled 0xB00003EEL +#define MSG_FrontEndRequestReceived 0xB0000BB8L +#define MSG_FrontEndResponseSent 0xB0000BB9L +#define MSG_BackendRequestSent 0xB0000BBAL +#define MSG_BackendResponseReceived 0xB0000BBBL +#define MSG_BackendRequestSentFailed 0xB0000BBCL +#define MSG_BackendResponseReceivedFailed 0xB0000BBDL +#define MSG_FrontEndResponseSentFailed 0xB0000BBEL +#define MSG_FrontEndRequestRejectedClientIdNotMatch 0xB0000BBFL +#define MSG_FrontEndRequestRejectedClientIdInvalid 0xB0000BC0L +#define MSG_FrontEndRequestRejectedClientStateInvalid 0xB0000BC1L +#define MSG_BackendResponseReceivedRetryOperationError 0xB0000BC2L +#define MSG_BackendResponseReceivedRetryLimitExceed 0xB0000BC3L +#define MSG_BackendRequestPutBack 0xB0000BC4L +#define MSG_BackendGeneratedFaultReply 0xB0000BC5L +#define MSG_FrontEndRequestRejectedAuthenticationError 0xB0000BC6L +#define MSG_FrontEndRequestRejectedGeneralError 0xB0000BC7L +#define MSG_BackendHandleResponseFailed 0xB0000BC8L +#define MSG_BackendHandleEndpointNotFoundExceptionFailed 0xB0000BC9L +#define MSG_BackendHandleExceptionFailed 0xB0000BCAL +#define MSG_BackendEndpointNotFoundExceptionOccured 0xB0000BCBL +#define MSG_BackendDispatcherClosed 0xB0000BCCL +#define MSG_BackendResponseReceivedSessionFault 0xB0000BCDL +#define MSG_SessionCreating 0xB0000FA0L +#define MSG_SessionCreated 0xB0000FA1L +#define MSG_FailedToCreateSession 0xB0000FA2L +#define MSG_SessionFinished 0xB0000FA3L +#define MSG_SessionFinishedBecauseOfJobCanceled 0xB0000FA4L +#define MSG_SessionTimeoutToFinished 0xB0000FA5L +#define MSG_SessionSuspended 0xB0000FA6L +#define MSG_SessionSuspendedBecauseOfJobCanceled 0xB0000FA7L +#define MSG_SessionTimeoutToSuspended 0xB0000FA8L +#define MSG_SessionRaisedUp 0xB0000FA9L +#define MSG_SessionRaisedUpFailover 0xB0000FAAL +#define MSG_BrokerWorkerUnexpectedlyExitString 0xB0001388L +#define MSG_BrokerWorkerMessageString 0xB0001389L +#define MSG_BrokerWorkerProcessCreated 0xB000138AL +#define MSG_BrokerWorkerProcessExited 0xB000138BL +#define MSG_BrokerWorkerProcessFailedToInitialize 0xB000138CL +#define MSG_UserTraceMessage 0xB0002328L +#define MSG_PureString 0xB000271EL +#define MSG_EventReceived 0xB10003E8L +#define MSG_EventBuffered 0xB10003E9L +#define MSG_BufferWritten 0xB10003EAL +#define MSG_BufferDiscarded 0xB10003EBL +#define MSG_StartThrottle 0xB10007D0L +#define MSG_StopThrottle 0xB10007D1L diff --git a/src/tracehelper/RuntimeEvents.man b/src/tracehelper/RuntimeEvents.man new file mode 100644 index 0000000..9384402 Binary files /dev/null and b/src/tracehelper/RuntimeEvents.man differ diff --git a/src/tracehelper/TraceHelper.suo b/src/tracehelper/TraceHelper.suo new file mode 100644 index 0000000..299e735 Binary files /dev/null and b/src/tracehelper/TraceHelper.suo differ diff --git a/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.cpp b/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.cpp new file mode 100644 index 0000000..2df0809 --- /dev/null +++ b/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.cpp @@ -0,0 +1,31 @@ +#include "com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.h" +#include "eventwriter.h" + +JNIEXPORT jint JNICALL Java_com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent_CWriteUserEvent + (JNIEnv *env, jclass clazz, jint tracelevel, jint sessionid, jstring messageid, jstring dispatchid, jstring msg) +{ + LPCWSTR messageidstr; + LPCWSTR dispatchidstr; + LPCWSTR messagestr; + + //get string + messageidstr = (LPCWSTR)(env)->GetStringChars(messageid, 0); + dispatchidstr = (LPCWSTR)(env)->GetStringChars(dispatchid, 0); + messagestr = (LPCWSTR)(env)->GetStringChars(msg, 0); + + //get guid + GUID messageguid; + GUID dispatchguid; + UuidFromString((RPC_WSTR)messageidstr,&messageguid); + UuidFromString((RPC_WSTR)dispatchidstr,&dispatchguid); + + //write event + int status = WriteEvent(tracelevel,sessionid,messageguid,dispatchguid,messagestr); + + //clean + (env)->ReleaseStringChars(messageid, (const jchar*)messageidstr); + (env)->ReleaseStringChars(dispatchid, (const jchar*)dispatchidstr); + (env)->ReleaseStringChars(msg, (const jchar*)messagestr); + + return status; +} diff --git a/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.h b/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.h new file mode 100644 index 0000000..19f102d --- /dev/null +++ b/src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent */ +#pragma comment(lib, "rpcrt4.lib") +#ifndef _Included_com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent +#define _Included_com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent + * Method: CWriteUserEvent + * Signature: (IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent_CWriteUserEvent + (JNIEnv *, jclass, jint, jint, jstring, jstring, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/tracehelper/eventwriter.cpp b/src/tracehelper/eventwriter.cpp new file mode 100644 index 0000000..7847f1a --- /dev/null +++ b/src/tracehelper/eventwriter.cpp @@ -0,0 +1,74 @@ +#include "eventwriter.h" + +int WriteEvent(int tracelevel, int sessionid, GUID messageid, GUID dispatchid, LPCWSTR msg) +{ + // status is used for the value which win32 API return for status + int status = ERROR_SUCCESS; + + // EventRegister(): registration handle + REGHANDLE registrationhandle = NULL; + + //register + //the first param is the GUID of the provider generated by the .MAN file in RuntimeEvent.h + status = EventRegister( + &RuntimeTrace, + NULL, + NULL, + ®istrationhandle + ); + + if (status != ERROR_SUCCESS) + return ERROR_REGISTRATIONFAILED; + + //EventWrite(): event data descriptor + EVENT_DATA_DESCRIPTOR data_descriptor[DATA_DESCRIPTOR_SIZE]; + + //fill data into the event data descriptor + int i = 0; + EventDataDescCreate(&data_descriptor[i++],&sessionid,sizeof(int)); + EventDataDescCreate(&data_descriptor[i++],&messageid,sizeof(GUID)); + EventDataDescCreate(&data_descriptor[i++],&dispatchid,sizeof(GUID)); + EventDataDescCreate(&data_descriptor[i++],msg,(ULONG)(wcslen(msg)+1)*sizeof(WCHAR)); + + //choose the trace level + const EVENT_DESCRIPTOR *event_descriptor; + + switch (tracelevel) + { + case LEVEL_VERBOSE: + event_descriptor = &UserTraceVerbose; + break; + case LEVEL_INFO: + event_descriptor = &UserTraceInfo; + break; + case LEVEL_WARNING: + event_descriptor = &UserTraceWarning; + break; + case LEVEL_ERROR: + event_descriptor = &UserTraceError; + break; + case LEVEL_CRITICAL: + event_descriptor = &UserTraceCritial; + break; + default: + return EVENTWRITER_ERRORINFO_WRONGLEVLE; + break; + } + + //write event + status = EventWrite( + registrationhandle, + event_descriptor, + (ULONG)DATA_DESCRIPTOR_SIZE, + &data_descriptor[0] + ); + + if (status != ERROR_SUCCESS) + status = ERROR_WRITEEVENTFAILED; + + //whether it succeeded, we have to unregister the provider + EventUnregister(registrationhandle); + + //return the status returned by the EventWrite() for checking whether it succeeded + return status; +} diff --git a/src/tracehelper/eventwriter.h b/src/tracehelper/eventwriter.h new file mode 100644 index 0000000..38ac80d --- /dev/null +++ b/src/tracehelper/eventwriter.h @@ -0,0 +1,35 @@ +#ifndef EVENTWRITER +#define EVENTWRITER + +#include +#include +#include "RuntimeEvents.h" + +#define DATA_DESCRIPTOR_SIZE 4 + +#ifndef TRACELEVEL +#define TRACELEVEL + +#define LEVEL_CRITICAL 5 +#define LEVEL_ERROR 4 +#define LEVEL_WARNING 3 +#define LEVEL_INFO 2 +#define LEVEL_VERBOSE 1 + +#endif + +#ifndef EVENTWRITER_ERRORINFO +#define EVENTWRITER_ERRORINFO + +#define EVENTWRITER_ERRORINFO_WRONGLEVLE -2147220001 +#define EVENTWRITER_ERRORINFO_WRONGMESSAGEGUID -2147220003 +#define EVENTWRITER_ERRORINFO_WRONGDISPATCHGUID -2147220004 + +#define ERROR_REGISTRATIONFAILED -2147220006 +#define ERROR_WRITEEVENTFAILED -2147220007 + +#endif + +int WriteEvent(int tracelevel, int sessionid, GUID messageid, GUID dispatchid, LPCWSTR msg); + +#endif \ No newline at end of file diff --git a/src/tracehelper/tracehelper.vcxproj b/src/tracehelper/tracehelper.vcxproj new file mode 100644 index 0000000..33e1ddb --- /dev/null +++ b/src/tracehelper/tracehelper.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + $(VCTargetsPath11) + + + {A7A352C8-0B25-46A2-BB3A-736C03471DAB} + Win32Proj + tracehelper + + + + DynamicLibrary + true + v100 + Unicode + + + DynamicLibrary + true + v100 + Unicode + + + DynamicLibrary + false + v100 + true + Unicode + + + DynamicLibrary + false + v100 + true + Unicode + + + + + + + + + + + + + + + + + + + true + C:\Program Files\Java\jdk1.6.0_23\include\win32;C:\Program Files\Java\jdk1.6.0_23\include;$(IncludePath) + C:\Program Files\Java\jdk1.6.0_23\lib;$(LibraryPath) + + + true + C:\Program Files\Java\jdk1.6.0_23\include\win32;C:\Program Files\Java\jdk1.6.0_23\include;$(IncludePath) + C:\Program Files\Java\jdk1.6.0_23\lib;$(LibraryPath) + + + false + C:\Program Files\Java\jdk1.6.0_23\include\win32;C:\Program Files\Java\jdk1.6.0_23\include;$(IncludePath) + C:\Program Files\Java\jdk1.6.0_23\lib;$(LibraryPath) + + + false + C:\Program Files\Java\jdk1.6.0_23\include\win32;C:\Program Files\Java\jdk1.6.0_23\include;$(IncludePath) + C:\Program Files\Java\jdk1.6.0_23\lib;$(LibraryPath) + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TRACEHELPER_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TRACEHELPER_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TRACEHELPER_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TRACEHELPER_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + Designer + + + + + + + + + + diff --git a/test/README b/test/README new file mode 100644 index 0000000..f21a741 --- /dev/null +++ b/test/README @@ -0,0 +1,84 @@ +Introduction +============ +This readme.txt shows the steps to run HPC Java Session API test cases + + +Prerequisites +============ +1) JDK 1.6.0_23 +2) CXF 2.4.0 +3) JUNIT 4.8.1 + + +On Windows Server 2008 R2: +============ + +1. Download and compile the HPC Java Session API source code + +a) Download HPC Java Session API source code to %basedir%\src + +b) Build the HPC Java Session API source code by %basedir%\src\makejar.cmd, remember to set the correct environments for %JAVA_HOME% and %CXF_HOME% before running the script. If build succeeds, there will be Microsoft-HpcSession-3.0.jar and Microsoft-HpcServiceHost-3.0.jar generated. + +c) Copy the Microsoft-HpcService-3.0.jar and Microsoft-HpcServiceHost-3.0.jar to %CCP_HOME%\bin on all cluster nodes + +2. Download and compile the HPC Java Session API test service and test cases + +a) Download HPC Java Session API test service and test cases to %basedir%\test + +b) Copy the Microsoft-HpcSession-3.0.jar to %basedir%\test + +c) Build the test service code by %basedir%\test\TestService\makejar.cmd. Modify the script for the correct %CXF_HOME% and %JAVA_HOME%. When succeeded, the JavaTestService.jar would be generated. + +d) Deploy the test service JavaTestService.jar and service configuation file JavaTestService.config to the HPC cluster by copying JavaTestService.jar and *.wsdl and *.xsd under %basedir%\test\TestService to C:\JavaTestService\ on all cluster nodes and copy JavaTestService.config to \\[HeadNode]\HpcServiceRegistration + +e) Build the test service client code by %basedir%\test\TestServiceClient\makejar.cmd. Modify the script for the correct %CXF_HOME% and %JAVA_HOME%. When succeeded, the JavaTestServiceClient.jar would be generated. + +f) Copy JavaTestServiceClient.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to %basedir%\test\TestCase\ and run buildtests.cmd there to build the test cases. Please check the %JAVA_HOME% and %CXF_HOME% before running the script. + + +3. Run the HPC Java Session API test cases + +a) Modify the %basedir%\test\TestCase\TestData.xml with the correct headnode name, username and password, and copy it to the %basedir%\test\TestCase\bin folder + +b) Under %basedir%\test\TestCase\ run the runtests_BVT.cmd to launch the BVT test + +c) To run the full pass, under %basedir%\SOAtest\test run runtests_Full.cmd + + +On RHEL5.5: +============ + +1. Download and compile the HPC Java Session API source code + +a) Download HPC Java Session API source code to $basedir/src + +b) Build the HPC Java Session API source code by $basedir/src/makejar.sh, remember to export CXF_HOME and make sure $JAVA_HOME and $JAVA_BIN are set before run the script. If build succeeds, there will be Microsoft-HpcSession-3.0.jar and Microsoft-HpcServiceHost-3.0.jar generated. + + +2. Download and compile the HPC Java Session API test cases + +a) Download HPC Java Session API test service and test cases to $basedir/test + +b) Copy the Microsoft-HpcSession-3.0.jar to $basedir/test + +c) Build the test service code by $basedir/SOAtest/testservice/makejar.sh. Modify the script for the correct CXF_HOME and Java paths. When succeeded, the JavaTestService.jar would be generated. + +d) Deploy the test service JavaTestService.jar and service configuation file JavaTestService.config to the HPC cluster by copying JavaTestService.jar and *.wsdl and *.xsd under $basedir/test/TestService to C:\JavaTestService\ on all cluster nodes and copy JavaTestService.config to \\[HeadNode]\HpcServiceRegistration + +e) Build the test service client code by $basedir/test/TestServiceClient/makejar.sh. Modify the script for the correct $CXF_HOME and $JAVA_HOME. When succeeded, the JavaTestServiceClient.jar would be generated. + +f) Copy JavaTestServiceClient.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to $basedir/test/TestCase and run buildtests.sh to build the HPC Java Session API test cases. Remember to export $JAVA_HOME and $CXF_HOME before running the script. + +3. Run the HPC Java Session API test cases + +a) Modify the TestData.xml with the correct headnode name, username and password + +b) For CommonData test cases, the command data share folder should be mounted by + mount -t cifs -o username=[domain]/\[username],password='[password]' //[headnode]/runtime$ /mnt/winshare/ + +c) Under $basedir/test/TestCase run runtests_BVT.sh to launch the BVT test + +d) To run the full pass, under $basedir/test/TestCase run runtests_Full.sh. + + + diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestData.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestData.java new file mode 100644 index 0000000..5480b93 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestData.java @@ -0,0 +1,69 @@ + +package com.microsoft.hpc; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfRequestData complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfRequestData">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="RequestData" type="{http://hpc.microsoft.com}RequestData" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfRequestData", propOrder = { + "requestData" +}) +public class ArrayOfRequestData { + + @XmlElement(name = "RequestData", nillable = true) + protected List requestData; + + /** + * Gets the value of the requestData property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the requestData property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getRequestData().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link RequestData } + * + * + */ + public List getRequestData() { + if (requestData == null) { + requestData = new ArrayList(); + } + return this.requestData; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java new file mode 100644 index 0000000..b9b6f0c --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java @@ -0,0 +1,69 @@ + +package com.microsoft.hpc; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfRequestFootprint complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfRequestFootprint">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="RequestFootprint" type="{http://hpc.microsoft.com}RequestFootprint" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfRequestFootprint", propOrder = { + "requestFootprint" +}) +public class ArrayOfRequestFootprint { + + @XmlElement(name = "RequestFootprint", nillable = true) + protected List requestFootprint; + + /** + * Gets the value of the requestFootprint property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the requestFootprint property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getRequestFootprint().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link RequestFootprint } + * + * + */ + public List getRequestFootprint() { + if (requestFootprint == null) { + requestFootprint = new ArrayList(); + } + return this.requestFootprint; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java new file mode 100644 index 0000000..265c5d1 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java @@ -0,0 +1,69 @@ + +package com.microsoft.hpc; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfTraceEventItem complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfTraceEventItem">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="TraceEventItem" type="{http://hpc.microsoft.com}TraceEventItem" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfTraceEventItem", propOrder = { + "traceEventItem" +}) +public class ArrayOfTraceEventItem { + + @XmlElement(name = "TraceEventItem", nillable = true) + protected List traceEventItem; + + /** + * Gets the value of the traceEventItem property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the traceEventItem property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getTraceEventItem().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TraceEventItem } + * + * + */ + public List getTraceEventItem() { + if (traceEventItem == null) { + traceEventItem = new ArrayList(); + } + return this.traceEventItem; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java new file mode 100644 index 0000000..9a5e481 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java @@ -0,0 +1,64 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId" +}) +@XmlRootElement(name = "CleanupTrace", namespace = "http://hpc.microsoft.com/") +public class CleanupTrace { + + @XmlElement(namespace = "http://hpc.microsoft.com/") + protected Integer sessionId; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTraceResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTraceResponse.java new file mode 100644 index 0000000..3d13fc8 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTraceResponse.java @@ -0,0 +1,34 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "CleanupTraceResponse", namespace = "http://hpc.microsoft.com/") +public class CleanupTraceResponse { + + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ObjectFactory.java new file mode 100644 index 0000000..cb59430 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ObjectFactory.java @@ -0,0 +1,258 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.hpc package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _TraceEventItem_QNAME = new QName("http://hpc.microsoft.com", "TraceEventItem"); + private final static QName _ArrayOfRequestFootprint_QNAME = new QName("http://hpc.microsoft.com", "ArrayOfRequestFootprint"); + private final static QName _ArrayOfTraceEventItem_QNAME = new QName("http://hpc.microsoft.com", "ArrayOfTraceEventItem"); + private final static QName _RequestFootprint_QNAME = new QName("http://hpc.microsoft.com", "RequestFootprint"); + private final static QName _ResponseType_QNAME = new QName("http://hpc.microsoft.com", "ResponseType"); + private final static QName _ArrayOfRequestData_QNAME = new QName("http://hpc.microsoft.com", "ArrayOfRequestData"); + private final static QName _RequestData_QNAME = new QName("http://hpc.microsoft.com", "RequestData"); + private final static QName _RequestContinuationToken_QNAME = new QName("http://hpc.microsoft.com", "RequestContinuationToken"); + private final static QName _RequestState_QNAME = new QName("http://hpc.microsoft.com", "RequestState"); + private final static QName _TraceEventItemData_QNAME = new QName("http://hpc.microsoft.com", "Data"); + private final static QName _RequestFootprintUserTraces_QNAME = new QName("http://hpc.microsoft.com", "UserTraces"); + private final static QName _RequestFootprintTargetMachine_QNAME = new QName("http://hpc.microsoft.com", "TargetMachine"); + private final static QName _RequestFootprintExceptionDetail_QNAME = new QName("http://hpc.microsoft.com", "ExceptionDetail"); + private final static QName _RequestDataDispatchHistory_QNAME = new QName("http://hpc.microsoft.com", "DispatchHistory"); + private final static QName _RequestDataContext_QNAME = new QName("http://hpc.microsoft.com", "Context"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ArrayOfTraceEventItem } + * + */ + public ArrayOfTraceEventItem createArrayOfTraceEventItem() { + return new ArrayOfTraceEventItem(); + } + + /** + * Create an instance of {@link RequestData } + * + */ + public RequestData createRequestData() { + return new RequestData(); + } + + /** + * Create an instance of {@link ArrayOfRequestData } + * + */ + public ArrayOfRequestData createArrayOfRequestData() { + return new ArrayOfRequestData(); + } + + /** + * Create an instance of {@link RequestFootprint } + * + */ + public RequestFootprint createRequestFootprint() { + return new RequestFootprint(); + } + + /** + * Create an instance of {@link RequestContinuationToken } + * + */ + public RequestContinuationToken createRequestContinuationToken() { + return new RequestContinuationToken(); + } + + /** + * Create an instance of {@link TraceEventItem } + * + */ + public TraceEventItem createTraceEventItem() { + return new TraceEventItem(); + } + + /** + * Create an instance of {@link ArrayOfRequestFootprint } + * + */ + public ArrayOfRequestFootprint createArrayOfRequestFootprint() { + return new ArrayOfRequestFootprint(); + } + + /** + * Create an instance of {@link CleanupTrace } + * + */ + public CleanupTrace createCleanupTrace() { + return new CleanupTrace(); + } + + /** + * Create an instance of {@link CleanupTraceResponse } + * + */ + public CleanupTraceResponse createCleanupTraceResponse() { + return new CleanupTraceResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TraceEventItem }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "TraceEventItem") + public JAXBElement createTraceEventItem(TraceEventItem value) { + return new JAXBElement(_TraceEventItem_QNAME, TraceEventItem.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfRequestFootprint }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "ArrayOfRequestFootprint") + public JAXBElement createArrayOfRequestFootprint(ArrayOfRequestFootprint value) { + return new JAXBElement(_ArrayOfRequestFootprint_QNAME, ArrayOfRequestFootprint.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "ArrayOfTraceEventItem") + public JAXBElement createArrayOfTraceEventItem(ArrayOfTraceEventItem value) { + return new JAXBElement(_ArrayOfTraceEventItem_QNAME, ArrayOfTraceEventItem.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestFootprint }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "RequestFootprint") + public JAXBElement createRequestFootprint(RequestFootprint value) { + return new JAXBElement(_RequestFootprint_QNAME, RequestFootprint.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "ResponseType") + public JAXBElement createResponseType(ResponseType value) { + return new JAXBElement(_ResponseType_QNAME, ResponseType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfRequestData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "ArrayOfRequestData") + public JAXBElement createArrayOfRequestData(ArrayOfRequestData value) { + return new JAXBElement(_ArrayOfRequestData_QNAME, ArrayOfRequestData.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "RequestData") + public JAXBElement createRequestData(RequestData value) { + return new JAXBElement(_RequestData_QNAME, RequestData.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestContinuationToken }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "RequestContinuationToken") + public JAXBElement createRequestContinuationToken(RequestContinuationToken value) { + return new JAXBElement(_RequestContinuationToken_QNAME, RequestContinuationToken.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestState }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "RequestState") + public JAXBElement createRequestState(RequestState value) { + return new JAXBElement(_RequestState_QNAME, RequestState.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "Data", scope = TraceEventItem.class) + public JAXBElement createTraceEventItemData(byte[] value) { + return new JAXBElement(_TraceEventItemData_QNAME, byte[].class, TraceEventItem.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "UserTraces", scope = RequestFootprint.class) + public JAXBElement createRequestFootprintUserTraces(ArrayOfTraceEventItem value) { + return new JAXBElement(_RequestFootprintUserTraces_QNAME, ArrayOfTraceEventItem.class, RequestFootprint.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "TargetMachine", scope = RequestFootprint.class) + public JAXBElement createRequestFootprintTargetMachine(String value) { + return new JAXBElement(_RequestFootprintTargetMachine_QNAME, String.class, RequestFootprint.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "ExceptionDetail", scope = RequestFootprint.class) + public JAXBElement createRequestFootprintExceptionDetail(String value) { + return new JAXBElement(_RequestFootprintExceptionDetail_QNAME, String.class, RequestFootprint.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfRequestFootprint }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "DispatchHistory", scope = RequestData.class) + public JAXBElement createRequestDataDispatchHistory(ArrayOfRequestFootprint value) { + return new JAXBElement(_RequestDataDispatchHistory_QNAME, ArrayOfRequestFootprint.class, RequestData.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com", name = "Context", scope = RequestData.class) + public JAXBElement createRequestDataContext(ArrayOfstring value) { + return new JAXBElement(_RequestDataContext_QNAME, ArrayOfstring.class, RequestData.class, value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/RequestContinuationToken.java b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestContinuationToken.java new file mode 100644 index 0000000..88821a4 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestContinuationToken.java @@ -0,0 +1,90 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RequestContinuationToken complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RequestContinuationToken">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Position" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="Timestamp" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestContinuationToken", propOrder = { + "position", + "timestamp" +}) +public class RequestContinuationToken { + + @XmlElement(name = "Position") + protected Long position; + @XmlElement(name = "Timestamp") + protected Long timestamp; + + /** + * Gets the value of the position property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getPosition() { + return position; + } + + /** + * Sets the value of the position property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setPosition(Long value) { + this.position = value; + } + + /** + * Gets the value of the timestamp property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getTimestamp() { + return timestamp; + } + + /** + * Sets the value of the timestamp property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setTimestamp(Long value) { + this.timestamp = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/RequestData.java b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestData.java new file mode 100644 index 0000000..4ba6479 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestData.java @@ -0,0 +1,205 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; + + +/** + *

Java class for RequestData complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RequestData">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Context" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
+ *         <element name="DispatchHistory" type="{http://hpc.microsoft.com}ArrayOfRequestFootprint" minOccurs="0"/>
+ *         <element name="RequestId" type="{http://schemas.microsoft.com/2003/10/Serialization/}guid" minOccurs="0"/>
+ *         <element name="RequestReceivedTime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="ResponseSentTime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="State" type="{http://hpc.microsoft.com}RequestState" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestData", propOrder = { + "context", + "dispatchHistory", + "requestId", + "requestReceivedTime", + "responseSentTime", + "state" +}) +public class RequestData { + + @XmlElementRef(name = "Context", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement context; + @XmlElementRef(name = "DispatchHistory", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement dispatchHistory; + @XmlElement(name = "RequestId") + protected String requestId; + @XmlElement(name = "RequestReceivedTime") + protected Long requestReceivedTime; + @XmlElement(name = "ResponseSentTime") + protected Long responseSentTime; + @XmlElement(name = "State") + protected RequestState state; + + /** + * Gets the value of the context property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getContext() { + return context; + } + + /** + * Sets the value of the context property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setContext(JAXBElement value) { + this.context = ((JAXBElement ) value); + } + + /** + * Gets the value of the dispatchHistory property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfRequestFootprint }{@code >} + * + */ + public JAXBElement getDispatchHistory() { + return dispatchHistory; + } + + /** + * Sets the value of the dispatchHistory property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfRequestFootprint }{@code >} + * + */ + public void setDispatchHistory(JAXBElement value) { + this.dispatchHistory = ((JAXBElement ) value); + } + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + /** + * Gets the value of the requestReceivedTime property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getRequestReceivedTime() { + return requestReceivedTime; + } + + /** + * Sets the value of the requestReceivedTime property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setRequestReceivedTime(Long value) { + this.requestReceivedTime = value; + } + + /** + * Gets the value of the responseSentTime property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getResponseSentTime() { + return responseSentTime; + } + + /** + * Sets the value of the responseSentTime property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setResponseSentTime(Long value) { + this.responseSentTime = value; + } + + /** + * Gets the value of the state property. + * + * @return + * possible object is + * {@link RequestState } + * + */ + public RequestState getState() { + return state; + } + + /** + * Sets the value of the state property. + * + * @param value + * allowed object is + * {@link RequestState } + * + */ + public void setState(RequestState value) { + this.state = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/RequestFootprint.java b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestFootprint.java new file mode 100644 index 0000000..85ec47d --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestFootprint.java @@ -0,0 +1,288 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RequestFootprint complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RequestFootprint">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="DispatchId" type="{http://schemas.microsoft.com/2003/10/Serialization/}guid" minOccurs="0"/>
+ *         <element name="DispatchTime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="ExceptionDetail" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="GeneratedFaultReply" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="ResponseTime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="ResponseType" type="{http://hpc.microsoft.com}ResponseType" minOccurs="0"/>
+ *         <element name="TargetMachine" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="TaskId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="UserTraces" type="{http://hpc.microsoft.com}ArrayOfTraceEventItem" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestFootprint", propOrder = { + "dispatchId", + "dispatchTime", + "exceptionDetail", + "generatedFaultReply", + "responseTime", + "responseType", + "targetMachine", + "taskId", + "userTraces" +}) +public class RequestFootprint { + + @XmlElement(name = "DispatchId") + protected String dispatchId; + @XmlElement(name = "DispatchTime") + protected Long dispatchTime; + @XmlElementRef(name = "ExceptionDetail", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement exceptionDetail; + @XmlElement(name = "GeneratedFaultReply") + protected Boolean generatedFaultReply; + @XmlElement(name = "ResponseTime") + protected Long responseTime; + @XmlElement(name = "ResponseType") + protected ResponseType responseType; + @XmlElementRef(name = "TargetMachine", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement targetMachine; + @XmlElement(name = "TaskId") + protected Integer taskId; + @XmlElementRef(name = "UserTraces", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement userTraces; + + /** + * Gets the value of the dispatchId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDispatchId() { + return dispatchId; + } + + /** + * Sets the value of the dispatchId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDispatchId(String value) { + this.dispatchId = value; + } + + /** + * Gets the value of the dispatchTime property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getDispatchTime() { + return dispatchTime; + } + + /** + * Sets the value of the dispatchTime property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setDispatchTime(Long value) { + this.dispatchTime = value; + } + + /** + * Gets the value of the exceptionDetail property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getExceptionDetail() { + return exceptionDetail; + } + + /** + * Sets the value of the exceptionDetail property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setExceptionDetail(JAXBElement value) { + this.exceptionDetail = ((JAXBElement ) value); + } + + /** + * Gets the value of the generatedFaultReply property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isGeneratedFaultReply() { + return generatedFaultReply; + } + + /** + * Sets the value of the generatedFaultReply property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setGeneratedFaultReply(Boolean value) { + this.generatedFaultReply = value; + } + + /** + * Gets the value of the responseTime property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getResponseTime() { + return responseTime; + } + + /** + * Sets the value of the responseTime property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setResponseTime(Long value) { + this.responseTime = value; + } + + /** + * Gets the value of the responseType property. + * + * @return + * possible object is + * {@link ResponseType } + * + */ + public ResponseType getResponseType() { + return responseType; + } + + /** + * Sets the value of the responseType property. + * + * @param value + * allowed object is + * {@link ResponseType } + * + */ + public void setResponseType(ResponseType value) { + this.responseType = value; + } + + /** + * Gets the value of the targetMachine property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getTargetMachine() { + return targetMachine; + } + + /** + * Sets the value of the targetMachine property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setTargetMachine(JAXBElement value) { + this.targetMachine = ((JAXBElement ) value); + } + + /** + * Gets the value of the taskId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getTaskId() { + return taskId; + } + + /** + * Sets the value of the taskId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setTaskId(Integer value) { + this.taskId = value; + } + + /** + * Gets the value of the userTraces property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >} + * + */ + public JAXBElement getUserTraces() { + return userTraces; + } + + /** + * Sets the value of the userTraces property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >} + * + */ + public void setUserTraces(JAXBElement value) { + this.userTraces = ((JAXBElement ) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/RequestState.java b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestState.java new file mode 100644 index 0000000..2ca2cbb --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/RequestState.java @@ -0,0 +1,78 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RequestState. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="RequestState">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="Null"/>
+ *     <enumeration value="Incoming"/>
+ *     <enumeration value="Calculating"/>
+ *     <enumeration value="Succeeded"/>
+ *     <enumeration value="Failed"/>
+ *     <enumeration value="FailedToAuthenticateRequest"/>
+ *     <enumeration value="FailedToSendResponse"/>
+ *     <enumeration value="ClientIdInvalid"/>
+ *     <enumeration value="ClientIdMismatch"/>
+ *     <enumeration value="ClientStateInvalid"/>
+ *     <enumeration value="FrontendGeneralError"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "RequestState") +@XmlEnum +public enum RequestState { + + @XmlEnumValue("Null") + NULL("Null"), + @XmlEnumValue("Incoming") + INCOMING("Incoming"), + @XmlEnumValue("Calculating") + CALCULATING("Calculating"), + @XmlEnumValue("Succeeded") + SUCCEEDED("Succeeded"), + @XmlEnumValue("Failed") + FAILED("Failed"), + @XmlEnumValue("FailedToAuthenticateRequest") + FAILED_TO_AUTHENTICATE_REQUEST("FailedToAuthenticateRequest"), + @XmlEnumValue("FailedToSendResponse") + FAILED_TO_SEND_RESPONSE("FailedToSendResponse"), + @XmlEnumValue("ClientIdInvalid") + CLIENT_ID_INVALID("ClientIdInvalid"), + @XmlEnumValue("ClientIdMismatch") + CLIENT_ID_MISMATCH("ClientIdMismatch"), + @XmlEnumValue("ClientStateInvalid") + CLIENT_STATE_INVALID("ClientStateInvalid"), + @XmlEnumValue("FrontendGeneralError") + FRONTEND_GENERAL_ERROR("FrontendGeneralError"); + private final String value; + + RequestState(String v) { + value = v; + } + + public String value() { + return value; + } + + public static RequestState fromValue(String v) { + for (RequestState c: RequestState.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ResponseType.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ResponseType.java new file mode 100644 index 0000000..b0f83c9 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ResponseType.java @@ -0,0 +1,75 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ResponseType. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="ResponseType">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="Null"/>
+ *     <enumeration value="CommunicationError"/>
+ *     <enumeration value="EndpointNotFound"/>
+ *     <enumeration value="Faulted"/>
+ *     <enumeration value="Succeeded"/>
+ *     <enumeration value="Incomplete"/>
+ *     <enumeration value="DispatcherClosed"/>
+ *     <enumeration value="FailedToSendRequest"/>
+ *     <enumeration value="RetryOperationError"/>
+ *     <enumeration value="SessionFault"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "ResponseType") +@XmlEnum +public enum ResponseType { + + @XmlEnumValue("Null") + NULL("Null"), + @XmlEnumValue("CommunicationError") + COMMUNICATION_ERROR("CommunicationError"), + @XmlEnumValue("EndpointNotFound") + ENDPOINT_NOT_FOUND("EndpointNotFound"), + @XmlEnumValue("Faulted") + FAULTED("Faulted"), + @XmlEnumValue("Succeeded") + SUCCEEDED("Succeeded"), + @XmlEnumValue("Incomplete") + INCOMPLETE("Incomplete"), + @XmlEnumValue("DispatcherClosed") + DISPATCHER_CLOSED("DispatcherClosed"), + @XmlEnumValue("FailedToSendRequest") + FAILED_TO_SEND_REQUEST("FailedToSendRequest"), + @XmlEnumValue("RetryOperationError") + RETRY_OPERATION_ERROR("RetryOperationError"), + @XmlEnumValue("SessionFault") + SESSION_FAULT("SessionFault"); + private final String value; + + ResponseType(String v) { + value = v; + } + + public String value() { + return value; + } + + public static ResponseType fromValue(String v) { + for (ResponseType c: ResponseType.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/TraceEventItem.java b/test/SoaDiagServiceClient/com/microsoft/hpc/TraceEventItem.java new file mode 100644 index 0000000..2ed1088 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/TraceEventItem.java @@ -0,0 +1,206 @@ + +package com.microsoft.hpc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for TraceEventItem complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="TraceEventItem">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Data" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *         <element name="EventId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="Level" type="{http://www.w3.org/2001/XMLSchema}unsignedByte" minOccurs="0"/>
+ *         <element name="ProcessId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ThreadId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="Timestamp" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TraceEventItem", propOrder = { + "data", + "eventId", + "level", + "processId", + "threadId", + "timestamp" +}) +public class TraceEventItem { + + @XmlElementRef(name = "Data", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false) + protected JAXBElement data; + @XmlElement(name = "EventId") + protected Integer eventId; + @XmlElement(name = "Level") + @XmlSchemaType(name = "unsignedByte") + protected Short level; + @XmlElement(name = "ProcessId") + protected Integer processId; + @XmlElement(name = "ThreadId") + protected Integer threadId; + @XmlElement(name = "Timestamp") + protected Long timestamp; + + /** + * Gets the value of the data property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getData() { + return data; + } + + /** + * Sets the value of the data property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setData(JAXBElement value) { + this.data = ((JAXBElement ) value); + } + + /** + * Gets the value of the eventId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getEventId() { + return eventId; + } + + /** + * Sets the value of the eventId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setEventId(Integer value) { + this.eventId = value; + } + + /** + * Gets the value of the level property. + * + * @return + * possible object is + * {@link Short } + * + */ + public Short getLevel() { + return level; + } + + /** + * Sets the value of the level property. + * + * @param value + * allowed object is + * {@link Short } + * + */ + public void setLevel(Short value) { + this.level = value; + } + + /** + * Gets the value of the processId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getProcessId() { + return processId; + } + + /** + * Sets the value of the processId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setProcessId(Integer value) { + this.processId = value; + } + + /** + * Gets the value of the threadId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getThreadId() { + return threadId; + } + + /** + * Sets the value of the threadId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setThreadId(Integer value) { + this.threadId = value; + } + + /** + * Gets the value of the timestamp property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getTimestamp() { + return timestamp; + } + + /** + * Sets the value of the timestamp property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setTimestamp(Long value) { + this.timestamp = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java b/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java new file mode 100644 index 0000000..0b8d28c --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.hpc; diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java b/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java new file mode 100644 index 0000000..64dea6f --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// CxfBrokerControllerClient class +// +//------------------------------------------------------------------------------ +/* + JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + + Copyright (c) Microsoft Corporation. All rights reserved. + + This license governs use of the accompanying software. If you use the + software, you accept this license. If you do not accept the license, do not + use the software. + + 1. Definitions + The terms "reproduce," "reproduction," "derivative works," and "distribution" + have the same meaning here as under U.S. copyright law. + A "contribution. is the original software, or any additions or changes to + the software. + A "contributor. is any person that distributes its contribution under this + license. + "Licensed patents. are a contributor.s patent claims that read directly on + its contribution. + + 2. Grant of Rights + (A) Copyright Grant- Subject to the terms of this license, including the + license conditions and limitations in section 3, each contributor grants you + a non-exclusive, worldwide, royalty-free copyright license to reproduce its + contribution, prepare derivative works of its contribution, and distribute + its contribution or any derivative works that you create. + (B) Patent Grant- Subject to the terms of this license, including the license + conditions and limitations in section 3, each contributor grants you a + non-exclusive, worldwide, royalty-free license under its licensed patents to + make, have made, use, sell, offer for sale, import, and/or otherwise dispose + of its contribution in the software or derivative works of the contribution + in the software. + + 3. Conditions and Limitations + (A) No Trademark License- This license does not grant you rights to use any + contributors' name, logo, or trademarks. + (B) If you bring a patent claim against any contributor over patents that + you claim are infringed by the software, your patent license from such + contributor to the software ends automatically. + (C) If you distribute any portion of the software, you must retain all + copyright, patent, trademark, and attribution notices that are present in + the software. + (D) If you distribute any portion of the software in source code form, + you may do so only under this license by including a complete copy of this + license with your distribution. If you distribute any portion of the software + in compiled or object code form, you may only do so under a license that + complies with this license. + (E) The software is licensed "as-is." You bear the risk of using it. The + contributors give no express warranties, guarantees or conditions. You may + have additional consumer rights under your local laws which this license + cannot change. To the extent permitted under your local laws, the contributors + exclude the implied warranties of merchantability, fitness for a particular + purpose and non-infringement. + (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend + only to the software or derivative works that you create that operate with + Windows HPC Server. + */ + +package com.microsoft.hpc.scheduler.session; + +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.ws.Holder; +import javax.xml.ws.soap.AddressingFeature; +import javax.xml.ws.soap.SOAPBinding; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.frontend.ClientProxy; +import org.apache.cxf.interceptor.LoggingInInterceptor; +import org.apache.cxf.interceptor.LoggingOutInterceptor; + +import com.microsoft.hpc.ArrayOfRequestData; +import com.microsoft.hpc.ArrayOfTraceEventItem; +import com.microsoft.hpc.RequestContinuationToken; +import com.microsoft.hpc.RequestData; +import com.microsoft.hpc.RequestState; +import com.microsoft.hpc.soadiagservice.ISoaDiagService; +import com.microsoft.hpc.soadiagservice.ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage; +import com.microsoft.hpc.soadiagservice.ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage; +import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage; +import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage; +import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage; + +public class CxfSoaDiagClient { + ISoaDiagService soadiagservice; + String epr; + + public CxfSoaDiagClient(String hostname) { + this.epr = String.format("http://%s/SoaDiagService", hostname); + + QName portName = new QName("http://hpc.microsoft.com", + "HpcSoaDiagServiceHttpPort"); + + javax.xml.ws.Service soaService = javax.xml.ws.Service + .create(new QName("http://hpc.microsoft.com/SoaDiagService/", + "SoaDiagService")); + soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, this.epr); + + soadiagservice = soaService.getPort(portName, ISoaDiagService.class); + + // Enable logging + Client client = ClientProxy.getClient(soadiagservice); + org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint(); + cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor()); + cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor()); + + } + + public void cleanupTrace(int sessionId) throws SessionException { + try { + soadiagservice.cleanupTrace(sessionId); + } catch (ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public void queryUserTraceByRequest(int sessionId, RequestData requestData) throws SessionException { + Holder request = new Holder(); + request.value = requestData; + try { + soadiagservice.queryUserTraceByRequest(sessionId, request); + requestData.setDispatchHistory(request.value.getDispatchHistory()); + requestData.setContext(request.value.getContext()); + } catch (ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + } + + public List queryForRequest(int sessionId, RequestState state) throws SessionException { + List requests = null; + Holder token = new Holder(); + Holder queryForRequestResult = new Holder(); + try { + soadiagservice.queryForRequest(sessionId, state, token, queryForRequestResult); + requests = queryForRequestResult.value.getRequestData(); + } catch (ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + return requests; + } + + public ArrayOfTraceEventItem querySessionTrace(int sessionId) + throws SessionException { + ArrayOfTraceEventItem items = null; + try { + items = soadiagservice.querySessionTrace(sessionId); + } catch (ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + return items; + } + + public byte[] dumpTrace(int sessionId) throws SessionException { + byte[] data = null; + try { + data = soadiagservice.dumpTrace(sessionId); + } catch (ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage e) { + throw Utility.translateFaultException(e.getFaultInfo()); + } + return data; + } +} \ No newline at end of file diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java new file mode 100644 index 0000000..d7a5cf4 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java @@ -0,0 +1,74 @@ + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfanyType; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.hpc.session package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _SessionFault_QNAME = new QName("http://hpc.microsoft.com/session/", "SessionFault"); + private final static QName _SessionFaultReason_QNAME = new QName("http://hpc.microsoft.com/session/", "Reason"); + private final static QName _SessionFaultContext_QNAME = new QName("http://hpc.microsoft.com/session/", "Context"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc.session + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link SessionFault } + * + */ + public SessionFault createSessionFault() { + return new SessionFault(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SessionFault }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "SessionFault") + public JAXBElement createSessionFault(SessionFault value) { + return new JAXBElement(_SessionFault_QNAME, SessionFault.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "Reason", scope = SessionFault.class) + public JAXBElement createSessionFaultReason(String value) { + return new JAXBElement(_SessionFaultReason_QNAME, String.class, SessionFault.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "Context", scope = SessionFault.class) + public JAXBElement createSessionFaultContext(ArrayOfanyType value) { + return new JAXBElement(_SessionFaultContext_QNAME, ArrayOfanyType.class, SessionFault.class, value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java new file mode 100644 index 0000000..a276e61 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java @@ -0,0 +1,121 @@ + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfanyType; + + +/** + *

Java class for SessionFault complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SessionFault">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Code" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="Context" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfanyType" minOccurs="0"/>
+ *         <element name="Reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SessionFault", propOrder = { + "code", + "context", + "reason" +}) +public class SessionFault { + + @XmlElement(name = "Code") + protected Integer code; + @XmlElementRef(name = "Context", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement context; + @XmlElementRef(name = "Reason", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement reason; + + /** + * Gets the value of the code property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCode() { + return code; + } + + /** + * Sets the value of the code property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCode(Integer value) { + this.code = value; + } + + /** + * Gets the value of the context property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >} + * + */ + public JAXBElement getContext() { + return context; + } + + /** + * Sets the value of the context property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >} + * + */ + public void setContext(JAXBElement value) { + this.context = ((JAXBElement ) value); + } + + /** + * Gets the value of the reason property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReason() { + return reason; + } + + /** + * Sets the value of the reason property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReason(JAXBElement value) { + this.reason = ((JAXBElement ) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/SoaDiagClient.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SoaDiagClient.java new file mode 100644 index 0000000..99a8091 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SoaDiagClient.java @@ -0,0 +1,2 @@ + + diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/package-info.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/package-info.java new file mode 100644 index 0000000..e6ba294 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com/session/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.hpc.session; diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTrace.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTrace.java new file mode 100644 index 0000000..8539cf1 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTrace.java @@ -0,0 +1,62 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId" +}) +@XmlRootElement(name = "CleanupTrace") +public class CleanupTrace { + + protected Integer sessionId; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTraceResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTraceResponse.java new file mode 100644 index 0000000..4859db3 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTraceResponse.java @@ -0,0 +1,34 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "CleanupTraceResponse") +public class CleanupTraceResponse { + + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTrace.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTrace.java new file mode 100644 index 0000000..23ea66b --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTrace.java @@ -0,0 +1,62 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId" +}) +@XmlRootElement(name = "DumpTrace") +public class DumpTrace { + + protected Integer sessionId; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTraceResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTraceResponse.java new file mode 100644 index 0000000..99ff7cb --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTraceResponse.java @@ -0,0 +1,62 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="DumpTraceResult" type="{http://schemas.microsoft.com/Message}StreamBody"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "dumpTraceResult" +}) +@XmlRootElement(name = "DumpTraceResponse") +public class DumpTraceResponse { + + @XmlElement(name = "DumpTraceResult", required = true) + protected byte[] dumpTraceResult; + + /** + * Gets the value of the dumpTraceResult property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getDumpTraceResult() { + return dumpTraceResult; + } + + /** + * Sets the value of the dumpTraceResult property. + * + * @param value + * allowed object is + * byte[] + */ + public void setDumpTraceResult(byte[] value) { + this.dumpTraceResult = ((byte[]) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagService.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagService.java new file mode 100644 index 0000000..d2b65dd --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagService.java @@ -0,0 +1,78 @@ +package com.microsoft.hpc.soadiagservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.FaultAction; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.734+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebService(targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", name = "ISoaDiagService") +@XmlSeeAlso({com.microsoft.schemas._2003._10.serialization.ObjectFactory.class, com.microsoft.hpc.ObjectFactory.class, ObjectFactory.class, com.microsoft.hpc.session.ObjectFactory.class, com.microsoft.schemas._2003._10.serialization.arrays.ObjectFactory.class}) +public interface ISoaDiagService { + + @Action(input = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/CleanupTrace", output = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/CleanupTraceResponse", fault = {@FaultAction(className = ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/SessionFault")}) + @RequestWrapper(localName = "CleanupTrace", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.CleanupTrace") + @WebMethod(operationName = "CleanupTrace", action = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/CleanupTrace") + @ResponseWrapper(localName = "CleanupTraceResponse", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.CleanupTraceResponse") + public void cleanupTrace( + @WebParam(name = "sessionId", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + java.lang.Integer sessionId + ) throws ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage; + + @Action(input = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryUserTraceByRequest", output = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryUserTraceByRequestResponse", fault = {@FaultAction(className = ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/SessionFault")}) + @RequestWrapper(localName = "QueryUserTraceByRequest", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QueryUserTraceByRequest") + @WebMethod(operationName = "QueryUserTraceByRequest", action = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryUserTraceByRequest") + @ResponseWrapper(localName = "QueryUserTraceByRequestResponse", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QueryUserTraceByRequestResponse") + public void queryUserTraceByRequest( + @WebParam(name = "sessionId", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + java.lang.Integer sessionId, + @WebParam(mode = WebParam.Mode.INOUT, name = "request", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + javax.xml.ws.Holder request + ) throws ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage; + + @Action(input = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryForRequest", output = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryForRequestResponse", fault = {@FaultAction(className = ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/SessionFault")}) + @RequestWrapper(localName = "QueryForRequest", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QueryForRequest") + @WebMethod(operationName = "QueryForRequest", action = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QueryForRequest") + @ResponseWrapper(localName = "QueryForRequestResponse", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QueryForRequestResponse") + public void queryForRequest( + @WebParam(name = "sessionId", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + java.lang.Integer sessionId, + @WebParam(name = "state", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + com.microsoft.hpc.RequestState state, + @WebParam(mode = WebParam.Mode.INOUT, name = "token", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + javax.xml.ws.Holder token, + @WebParam(mode = WebParam.Mode.OUT, name = "QueryForRequestResult", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + javax.xml.ws.Holder queryForRequestResult + ) throws ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage; + + @WebResult(name = "QuerySessionTraceResult", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + @Action(input = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QuerySessionTrace", output = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QuerySessionTraceResponse", fault = {@FaultAction(className = ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/SessionFault")}) + @RequestWrapper(localName = "QuerySessionTrace", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QuerySessionTrace") + @WebMethod(operationName = "QuerySessionTrace", action = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/QuerySessionTrace") + @ResponseWrapper(localName = "QuerySessionTraceResponse", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.QuerySessionTraceResponse") + public com.microsoft.hpc.ArrayOfTraceEventItem querySessionTrace( + @WebParam(name = "sessionId", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + java.lang.Integer sessionId + ) throws ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage; + + @WebResult(name = "DumpTraceResult", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + @Action(input = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/DumpTrace", output = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/DumpTraceResponse", fault = {@FaultAction(className = ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/SessionFault")}) + @RequestWrapper(localName = "DumpTrace", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.DumpTrace") + @WebMethod(operationName = "DumpTrace", action = "http://hpc.microsoft.com/SoaDiagService/ISoaDiagService/DumpTrace") + @ResponseWrapper(localName = "DumpTraceResponse", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/", className = "com.microsoft.hpc.soadiagservice.DumpTraceResponse") + public byte[] dumpTrace( + @WebParam(name = "sessionId", targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") + java.lang.Integer sessionId + ) throws ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage; +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage.java new file mode 100644 index 0000000..14cacb9 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.638+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "SessionFault", targetNamespace = "http://hpc.microsoft.com/session/") +public class ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120801143907L; + + private com.microsoft.hpc.session.SessionFault sessionFault; + + public ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage() { + super(); + } + + public ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage(String message) { + super(message); + } + + public ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault) { + super(message); + this.sessionFault = sessionFault; + } + + public ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault, Throwable cause) { + super(message, cause); + this.sessionFault = sessionFault; + } + + public com.microsoft.hpc.session.SessionFault getFaultInfo() { + return this.sessionFault; + } +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage.java new file mode 100644 index 0000000..1761aa4 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.727+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "SessionFault", targetNamespace = "http://hpc.microsoft.com/session/") +public class ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120801143907L; + + private com.microsoft.hpc.session.SessionFault sessionFault; + + public ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage() { + super(); + } + + public ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage(String message) { + super(message); + } + + public ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault) { + super(message); + this.sessionFault = sessionFault; + } + + public ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault, Throwable cause) { + super(message, cause); + this.sessionFault = sessionFault; + } + + public com.microsoft.hpc.session.SessionFault getFaultInfo() { + return this.sessionFault; + } +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage.java new file mode 100644 index 0000000..6dbcbd8 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.709+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "SessionFault", targetNamespace = "http://hpc.microsoft.com/session/") +public class ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120801143907L; + + private com.microsoft.hpc.session.SessionFault sessionFault; + + public ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage() { + super(); + } + + public ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage(String message) { + super(message); + } + + public ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault) { + super(message); + this.sessionFault = sessionFault; + } + + public ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault, Throwable cause) { + super(message, cause); + this.sessionFault = sessionFault; + } + + public com.microsoft.hpc.session.SessionFault getFaultInfo() { + return this.sessionFault; + } +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage.java new file mode 100644 index 0000000..2aac51c --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.718+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "SessionFault", targetNamespace = "http://hpc.microsoft.com/session/") +public class ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120801143907L; + + private com.microsoft.hpc.session.SessionFault sessionFault; + + public ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage() { + super(); + } + + public ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage(String message) { + super(message); + } + + public ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault) { + super(message); + this.sessionFault = sessionFault; + } + + public ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault, Throwable cause) { + super(message, cause); + this.sessionFault = sessionFault; + } + + public com.microsoft.hpc.session.SessionFault getFaultInfo() { + return this.sessionFault; + } +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage.java new file mode 100644 index 0000000..2e1d058 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.701+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "SessionFault", targetNamespace = "http://hpc.microsoft.com/session/") +public class ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120801143907L; + + private com.microsoft.hpc.session.SessionFault sessionFault; + + public ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage() { + super(); + } + + public ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage(String message) { + super(message); + } + + public ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault) { + super(message); + this.sessionFault = sessionFault; + } + + public ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage(String message, com.microsoft.hpc.session.SessionFault sessionFault, Throwable cause) { + super(message, cause); + this.sessionFault = sessionFault; + } + + public com.microsoft.hpc.session.SessionFault getFaultInfo() { + return this.sessionFault; + } +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ObjectFactory.java new file mode 100644 index 0000000..62e6c42 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ObjectFactory.java @@ -0,0 +1,157 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; +import com.microsoft.hpc.ArrayOfRequestData; +import com.microsoft.hpc.ArrayOfTraceEventItem; +import com.microsoft.hpc.RequestData; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.hpc.soadiagservice package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _QueryUserTraceByRequestResponseRequest_QNAME = new QName("http://hpc.microsoft.com/SoaDiagService/", "request"); + private final static QName _QuerySessionTraceResponseQuerySessionTraceResult_QNAME = new QName("http://hpc.microsoft.com/SoaDiagService/", "QuerySessionTraceResult"); + private final static QName _QueryForRequestResponseQueryForRequestResult_QNAME = new QName("http://hpc.microsoft.com/SoaDiagService/", "QueryForRequestResult"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc.soadiagservice + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link CleanupTrace } + * + */ + public CleanupTrace createCleanupTrace() { + return new CleanupTrace(); + } + + /** + * Create an instance of {@link CleanupTraceResponse } + * + */ + public CleanupTraceResponse createCleanupTraceResponse() { + return new CleanupTraceResponse(); + } + + /** + * Create an instance of {@link QueryUserTraceByRequest } + * + */ + public QueryUserTraceByRequest createQueryUserTraceByRequest() { + return new QueryUserTraceByRequest(); + } + + /** + * Create an instance of {@link QueryForRequest } + * + */ + public QueryForRequest createQueryForRequest() { + return new QueryForRequest(); + } + + /** + * Create an instance of {@link QuerySessionTrace } + * + */ + public QuerySessionTrace createQuerySessionTrace() { + return new QuerySessionTrace(); + } + + /** + * Create an instance of {@link DumpTrace } + * + */ + public DumpTrace createDumpTrace() { + return new DumpTrace(); + } + + /** + * Create an instance of {@link DumpTraceResponse } + * + */ + public DumpTraceResponse createDumpTraceResponse() { + return new DumpTraceResponse(); + } + + /** + * Create an instance of {@link QueryUserTraceByRequestResponse } + * + */ + public QueryUserTraceByRequestResponse createQueryUserTraceByRequestResponse() { + return new QueryUserTraceByRequestResponse(); + } + + /** + * Create an instance of {@link QueryForRequestResponse } + * + */ + public QueryForRequestResponse createQueryForRequestResponse() { + return new QueryForRequestResponse(); + } + + /** + * Create an instance of {@link QuerySessionTraceResponse } + * + */ + public QuerySessionTraceResponse createQuerySessionTraceResponse() { + return new QuerySessionTraceResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SoaDiagService/", name = "request", scope = QueryUserTraceByRequestResponse.class) + public JAXBElement createQueryUserTraceByRequestResponseRequest(RequestData value) { + return new JAXBElement(_QueryUserTraceByRequestResponseRequest_QNAME, RequestData.class, QueryUserTraceByRequestResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SoaDiagService/", name = "QuerySessionTraceResult", scope = QuerySessionTraceResponse.class) + public JAXBElement createQuerySessionTraceResponseQuerySessionTraceResult(ArrayOfTraceEventItem value) { + return new JAXBElement(_QuerySessionTraceResponseQuerySessionTraceResult_QNAME, ArrayOfTraceEventItem.class, QuerySessionTraceResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RequestData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SoaDiagService/", name = "request", scope = QueryUserTraceByRequest.class) + public JAXBElement createQueryUserTraceByRequestRequest(RequestData value) { + return new JAXBElement(_QueryUserTraceByRequestResponseRequest_QNAME, RequestData.class, QueryUserTraceByRequest.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfRequestData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/SoaDiagService/", name = "QueryForRequestResult", scope = QueryForRequestResponse.class) + public JAXBElement createQueryForRequestResponseQueryForRequestResult(ArrayOfRequestData value) { + return new JAXBElement(_QueryForRequestResponseQueryForRequestResult_QNAME, ArrayOfRequestData.class, QueryForRequestResponse.class, value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequest.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequest.java new file mode 100644 index 0000000..9114ed5 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequest.java @@ -0,0 +1,118 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.hpc.RequestContinuationToken; +import com.microsoft.hpc.RequestState; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="state" type="{http://hpc.microsoft.com}RequestState" minOccurs="0"/>
+ *         <element name="token" type="{http://hpc.microsoft.com}RequestContinuationToken" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId", + "state", + "token" +}) +@XmlRootElement(name = "QueryForRequest") +public class QueryForRequest { + + protected Integer sessionId; + protected RequestState state; + protected RequestContinuationToken token; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + + /** + * Gets the value of the state property. + * + * @return + * possible object is + * {@link RequestState } + * + */ + public RequestState getState() { + return state; + } + + /** + * Sets the value of the state property. + * + * @param value + * allowed object is + * {@link RequestState } + * + */ + public void setState(RequestState value) { + this.state = value; + } + + /** + * Gets the value of the token property. + * + * @return + * possible object is + * {@link RequestContinuationToken } + * + */ + public RequestContinuationToken getToken() { + return token; + } + + /** + * Sets the value of the token property. + * + * @param value + * allowed object is + * {@link RequestContinuationToken } + * + */ + public void setToken(RequestContinuationToken value) { + this.token = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequestResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequestResponse.java new file mode 100644 index 0000000..cd70093 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequestResponse.java @@ -0,0 +1,94 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.hpc.ArrayOfRequestData; +import com.microsoft.hpc.RequestContinuationToken; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="QueryForRequestResult" type="{http://hpc.microsoft.com}ArrayOfRequestData" minOccurs="0"/>
+ *         <element name="token" type="{http://hpc.microsoft.com}RequestContinuationToken" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "queryForRequestResult", + "token" +}) +@XmlRootElement(name = "QueryForRequestResponse") +public class QueryForRequestResponse { + + @XmlElementRef(name = "QueryForRequestResult", namespace = "http://hpc.microsoft.com/SoaDiagService/", type = JAXBElement.class, required = false) + protected JAXBElement queryForRequestResult; + protected RequestContinuationToken token; + + /** + * Gets the value of the queryForRequestResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfRequestData }{@code >} + * + */ + public JAXBElement getQueryForRequestResult() { + return queryForRequestResult; + } + + /** + * Sets the value of the queryForRequestResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfRequestData }{@code >} + * + */ + public void setQueryForRequestResult(JAXBElement value) { + this.queryForRequestResult = ((JAXBElement ) value); + } + + /** + * Gets the value of the token property. + * + * @return + * possible object is + * {@link RequestContinuationToken } + * + */ + public RequestContinuationToken getToken() { + return token; + } + + /** + * Sets the value of the token property. + * + * @param value + * allowed object is + * {@link RequestContinuationToken } + * + */ + public void setToken(RequestContinuationToken value) { + this.token = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTrace.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTrace.java new file mode 100644 index 0000000..50405f8 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTrace.java @@ -0,0 +1,62 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId" +}) +@XmlRootElement(name = "QuerySessionTrace") +public class QuerySessionTrace { + + protected Integer sessionId; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTraceResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTraceResponse.java new file mode 100644 index 0000000..fbce8a7 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTraceResponse.java @@ -0,0 +1,66 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.hpc.ArrayOfTraceEventItem; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="QuerySessionTraceResult" type="{http://hpc.microsoft.com}ArrayOfTraceEventItem" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "querySessionTraceResult" +}) +@XmlRootElement(name = "QuerySessionTraceResponse") +public class QuerySessionTraceResponse { + + @XmlElementRef(name = "QuerySessionTraceResult", namespace = "http://hpc.microsoft.com/SoaDiagService/", type = JAXBElement.class, required = false) + protected JAXBElement querySessionTraceResult; + + /** + * Gets the value of the querySessionTraceResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >} + * + */ + public JAXBElement getQuerySessionTraceResult() { + return querySessionTraceResult; + } + + /** + * Sets the value of the querySessionTraceResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfTraceEventItem }{@code >} + * + */ + public void setQuerySessionTraceResult(JAXBElement value) { + this.querySessionTraceResult = ((JAXBElement ) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequest.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequest.java new file mode 100644 index 0000000..769fb63 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequest.java @@ -0,0 +1,93 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.hpc.RequestData; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="request" type="{http://hpc.microsoft.com}RequestData" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionId", + "request" +}) +@XmlRootElement(name = "QueryUserTraceByRequest") +public class QueryUserTraceByRequest { + + protected Integer sessionId; + @XmlElementRef(name = "request", namespace = "http://hpc.microsoft.com/SoaDiagService/", type = JAXBElement.class, required = false) + protected JAXBElement request; + + /** + * Gets the value of the sessionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSessionId() { + return sessionId; + } + + /** + * Sets the value of the sessionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSessionId(Integer value) { + this.sessionId = value; + } + + /** + * Gets the value of the request property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link RequestData }{@code >} + * + */ + public JAXBElement getRequest() { + return request; + } + + /** + * Sets the value of the request property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link RequestData }{@code >} + * + */ + public void setRequest(JAXBElement value) { + this.request = ((JAXBElement ) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequestResponse.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequestResponse.java new file mode 100644 index 0000000..0cbeec4 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequestResponse.java @@ -0,0 +1,66 @@ + +package com.microsoft.hpc.soadiagservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.hpc.RequestData; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="request" type="{http://hpc.microsoft.com}RequestData" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "request" +}) +@XmlRootElement(name = "QueryUserTraceByRequestResponse") +public class QueryUserTraceByRequestResponse { + + @XmlElementRef(name = "request", namespace = "http://hpc.microsoft.com/SoaDiagService/", type = JAXBElement.class, required = false) + protected JAXBElement request; + + /** + * Gets the value of the request property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link RequestData }{@code >} + * + */ + public JAXBElement getRequest() { + return request; + } + + /** + * Sets the value of the request property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link RequestData }{@code >} + * + */ + public void setRequest(JAXBElement value) { + this.request = ((JAXBElement ) value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/SoaDiagService.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/SoaDiagService.java new file mode 100644 index 0000000..c208046 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/SoaDiagService.java @@ -0,0 +1,100 @@ + +/* + * + */ + +package com.microsoft.hpc.soadiagservice; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.Service; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-08-01T14:39:07.761+08:00 + * Generated source version: 2.4.0 + * + */ + + +@WebServiceClient(name = "SoaDiagService", + wsdlLocation = "file:hpc.microsoft.com.SoaDiagService.wsdl", + targetNamespace = "http://hpc.microsoft.com/SoaDiagService/") +public class SoaDiagService extends Service { + + public final static URL WSDL_LOCATION; + + public final static QName SERVICE = new QName("http://hpc.microsoft.com/SoaDiagService/", "SoaDiagService"); + public final static QName DefaultBindingISoaDiagService = new QName("http://hpc.microsoft.com/SoaDiagService/", "DefaultBinding_ISoaDiagService"); + static { + URL url = null; + try { + url = new URL("file:hpc.microsoft.com.SoaDiagService.wsdl"); + } catch (MalformedURLException e) { + java.util.logging.Logger.getLogger(SoaDiagService.class.getName()) + .log(java.util.logging.Level.INFO, + "Can not initialize the default wsdl from {0}", "file:hpc.microsoft.com.SoaDiagService.wsdl"); + } + WSDL_LOCATION = url; + } + + public SoaDiagService(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public SoaDiagService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public SoaDiagService() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SoaDiagService(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SoaDiagService(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SoaDiagService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns ISoaDiagService + */ + @WebEndpoint(name = "DefaultBinding_ISoaDiagService") + public ISoaDiagService getDefaultBindingISoaDiagService() { + return super.getPort(DefaultBindingISoaDiagService, ISoaDiagService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns ISoaDiagService + */ + @WebEndpoint(name = "DefaultBinding_ISoaDiagService") + public ISoaDiagService getDefaultBindingISoaDiagService(WebServiceFeature... features) { + return super.getPort(DefaultBindingISoaDiagService, ISoaDiagService.class, features); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/package-info.java b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/package-info.java new file mode 100644 index 0000000..8119fb0 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com/SoaDiagService/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.hpc.soadiagservice; diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java new file mode 100644 index 0000000..93f1a84 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java @@ -0,0 +1,249 @@ + +package com.microsoft.schemas._2003._10.serialization; + +import java.math.BigDecimal; +import java.math.BigInteger; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.schemas._2003._10.serialization package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _AnyURI_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "anyURI"); + private final static QName _Char_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "char"); + private final static QName _DateTime_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "dateTime"); + private final static QName _QName_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "QName"); + private final static QName _UnsignedShort_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedShort"); + private final static QName _Float_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "float"); + private final static QName _Long_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "long"); + private final static QName _Short_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "short"); + private final static QName _Base64Binary_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "base64Binary"); + private final static QName _Byte_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "byte"); + private final static QName _Boolean_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "boolean"); + private final static QName _UnsignedByte_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedByte"); + private final static QName _AnyType_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "anyType"); + private final static QName _UnsignedInt_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedInt"); + private final static QName _Int_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "int"); + private final static QName _Decimal_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "decimal"); + private final static QName _Double_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "double"); + private final static QName _Guid_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "guid"); + private final static QName _Duration_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "duration"); + private final static QName _String_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "string"); + private final static QName _UnsignedLong_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedLong"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas._2003._10.serialization + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "anyURI") + public JAXBElement createAnyURI(String value) { + return new JAXBElement(_AnyURI_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "char") + public JAXBElement createChar(Integer value) { + return new JAXBElement(_Char_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "dateTime") + public JAXBElement createDateTime(XMLGregorianCalendar value) { + return new JAXBElement(_DateTime_QNAME, XMLGregorianCalendar.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link QName }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "QName") + public JAXBElement createQName(QName value) { + return new JAXBElement(_QName_QNAME, QName.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedShort") + public JAXBElement createUnsignedShort(Integer value) { + return new JAXBElement(_UnsignedShort_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "float") + public JAXBElement createFloat(Float value) { + return new JAXBElement(_Float_QNAME, Float.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "long") + public JAXBElement createLong(Long value) { + return new JAXBElement(_Long_QNAME, Long.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "short") + public JAXBElement createShort(Short value) { + return new JAXBElement(_Short_QNAME, Short.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "base64Binary") + public JAXBElement createBase64Binary(byte[] value) { + return new JAXBElement(_Base64Binary_QNAME, byte[].class, null, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Byte }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "byte") + public JAXBElement createByte(Byte value) { + return new JAXBElement(_Byte_QNAME, Byte.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Boolean }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "boolean") + public JAXBElement createBoolean(Boolean value) { + return new JAXBElement(_Boolean_QNAME, Boolean.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedByte") + public JAXBElement createUnsignedByte(Short value) { + return new JAXBElement(_UnsignedByte_QNAME, Short.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "anyType") + public JAXBElement createAnyType(Object value) { + return new JAXBElement(_AnyType_QNAME, Object.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedInt") + public JAXBElement createUnsignedInt(Long value) { + return new JAXBElement(_UnsignedInt_QNAME, Long.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "int") + public JAXBElement createInt(Integer value) { + return new JAXBElement(_Int_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BigDecimal }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "decimal") + public JAXBElement createDecimal(BigDecimal value) { + return new JAXBElement(_Decimal_QNAME, BigDecimal.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Double }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "double") + public JAXBElement createDouble(Double value) { + return new JAXBElement(_Double_QNAME, Double.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "guid") + public JAXBElement createGuid(String value) { + return new JAXBElement(_Guid_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Duration }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "duration") + public JAXBElement createDuration(Duration value) { + return new JAXBElement(_Duration_QNAME, Duration.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "string") + public JAXBElement createString(String value) { + return new JAXBElement(_String_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedLong") + public JAXBElement createUnsignedLong(BigInteger value) { + return new JAXBElement(_UnsignedLong_QNAME, BigInteger.class, null, value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfanyType.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfanyType.java new file mode 100644 index 0000000..9aef888 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfanyType.java @@ -0,0 +1,69 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfanyType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfanyType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="anyType" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfanyType", propOrder = { + "anyType" +}) +public class ArrayOfanyType { + + @XmlElement(nillable = true) + protected List anyType; + + /** + * Gets the value of the anyType property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the anyType property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAnyType().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * + * + */ + public List getAnyType() { + if (anyType == null) { + anyType = new ArrayList(); + } + return this.anyType; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java new file mode 100644 index 0000000..3356f02 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java @@ -0,0 +1,69 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfstring complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfstring">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="string" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfstring", propOrder = { + "string" +}) +public class ArrayOfstring { + + @XmlElement(nillable = true) + protected List string; + + /** + * Gets the value of the string property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the string property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getString().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getString() { + if (string == null) { + string = new ArrayList(); + } + return this.string; + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java new file mode 100644 index 0000000..d67c202 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.schemas._2003._10.serialization.arrays package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ArrayOfanyType_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfanyType"); + private final static QName _ArrayOfstring_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfstring"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas._2003._10.serialization.arrays + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ArrayOfstring } + * + */ + public ArrayOfstring createArrayOfstring() { + return new ArrayOfstring(); + } + + /** + * Create an instance of {@link ArrayOfanyType } + * + */ + public ArrayOfanyType createArrayOfanyType() { + return new ArrayOfanyType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfanyType") + public JAXBElement createArrayOfanyType(ArrayOfanyType value) { + return new JAXBElement(_ArrayOfanyType_QNAME, ArrayOfanyType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfstring") + public JAXBElement createArrayOfstring(ArrayOfstring value) { + return new JAXBElement(_ArrayOfstring_QNAME, ArrayOfstring.class, null, value); + } + +} diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java new file mode 100644 index 0000000..1e4e6d0 --- /dev/null +++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.schemas._2003._10.serialization.arrays; diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl new file mode 100644 index 0000000..a9d8424 --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.xsd b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.xsd new file mode 100644 index 0000000..95f3335 --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.xsd @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.session.xsd b/test/SoaDiagServiceClient/hpc.microsoft.com.session.xsd new file mode 100644 index 0000000..84272e1 --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com.session.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.wsdl b/test/SoaDiagServiceClient/hpc.microsoft.com.wsdl new file mode 100644 index 0000000..9db294b --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com.wsdl @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.xsd b/test/SoaDiagServiceClient/hpc.microsoft.com.xsd new file mode 100644 index 0000000..075ed0b --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com1.xsd b/test/SoaDiagServiceClient/hpc.microsoft.com1.xsd new file mode 100644 index 0000000..acebf1e --- /dev/null +++ b/test/SoaDiagServiceClient/hpc.microsoft.com1.xsd @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd b/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd new file mode 100644 index 0000000..80682aa --- /dev/null +++ b/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd b/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd new file mode 100644 index 0000000..62ff1db --- /dev/null +++ b/test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/schemas.microsoft.com.Message.xsd b/test/SoaDiagServiceClient/schemas.microsoft.com.Message.xsd new file mode 100644 index 0000000..03408dd --- /dev/null +++ b/test/SoaDiagServiceClient/schemas.microsoft.com.Message.xsd @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/SoaDiagServiceClient/temp_hpc.microsoft.com.SoaDiagService.wsdl b/test/SoaDiagServiceClient/temp_hpc.microsoft.com.SoaDiagService.wsdl new file mode 100644 index 0000000..a9d8424 --- /dev/null +++ b/test/SoaDiagServiceClient/temp_hpc.microsoft.com.SoaDiagService.wsdl @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestCase/TestData.xml b/test/TestCase/TestData.xml new file mode 100644 index 0000000..d604367 --- /dev/null +++ b/test/TestCase/TestData.xml @@ -0,0 +1,67 @@ + + + + +headnode +username +password +AITestServiceLib +10 +3 +2 + username2 + password2 + 2 + + +12 +BVTValue1 + + + + +SoaGenericTestService + + + + aitestservicelib + + aitestservicelib + + \\shpc-0042\runtime$ + 1024,32768,1048576,4194304,16777216,67108864,104857600 + \\Mingqing-box\TestConfig-1 + + + + \\shpc-0042\runtime$ + 1024,32768,1048576,4194304,16777216,67108864,104857600 + \\Mingqing-box\TestConfig-1 + + + + \\shpc-0042\runtime$ + 1024,32768,1048576,4194304,16777216,67108864,104857600 + \\Mingqing-box\TestConfig-1 + + + +Microsoft.Hpc.Excel.XllContainer64 + + + +10 +50 +2 +5 +2 +5 +5 +15 +5 +15 + + + + + diff --git a/test/TestCase/buildtests.cmd b/test/TestCase/buildtests.cmd new file mode 100644 index 0000000..5786d9b --- /dev/null +++ b/test/TestCase/buildtests.cmd @@ -0,0 +1,13 @@ + @echo off + set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 + set CXF_HOME=c:\java\apache-cxf-2.4.0 + set JAVAC="%JAVA_HOME%\bin\javac.exe" + set JAR="%JAVA_HOME%\bin\jar.exe" + set CLASSPATH=.;%CXF_HOME%\lib\cxf-manifest.jar;junit.jar;org.hamcrest.core_1.1.0.v20090501071000.jar;JavaTestServiceClient.jar;..\Microsoft-HpcSession-3.0.jar + + echo Compiling + %javac% -sourcepath functiontest\*.java + %javac% fullpass\Full.java + echo Done + + \ No newline at end of file diff --git a/test/TestCase/buildtests.sh b/test/TestCase/buildtests.sh new file mode 100644 index 0000000..ca9c41a --- /dev/null +++ b/test/TestCase/buildtests.sh @@ -0,0 +1,10 @@ +#!bin/sh +export CXF_HOME=/usr/java/apache-cxf-2.4.0 +export CLASSPATH=.:$CXF_HOME/lib/cxf-manifest.jar:./junit.jar:./org.hamcrest.core_1.1.0.v20090501071000.jar:./JavaTestServiceClient.jar:../Microsoft-HpcSession-3.0.jar + +echo Compiling +find ./functiontest -name *.java -print | xargs javac -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" + +find ./fullpass -name *.java -print | xargs javac -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" +echo Done + diff --git a/test/TestCase/fullpass/Full.java b/test/TestCase/fullpass/Full.java new file mode 100644 index 0000000..cff7d99 --- /dev/null +++ b/test/TestCase/fullpass/Full.java @@ -0,0 +1,35 @@ +/** + * + */ +package fullpass; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import functiontest.*; +/** + * @author yutongs + * this class is used to run full passes or specific passes in linux shell + */ + +@RunWith(Suite.class) +@Suite.SuiteClasses( + { + functiontest.BVT.class, + functiontest.BrokerClientTest.class, + functiontest.BrokerResponseTest.class, + functiontest.CommonDataTestDurable.class, + functiontest.CommonDataTestInteractive.class, + functiontest.DataClientTest.class, + functiontest.DurableSessionTest.class, + functiontest.GenericServiceTest.class, + functiontest.SessionAttachInfoTest.class, + functiontest.SessionStartInfoTest.class, + functiontest.SessionBaseTest.class, + functiontest.SessionTest.class, + functiontest.SessionPool.class + } + +) +public class Full { +} diff --git a/test/TestCase/functiontest/BVT.java b/test/TestCase/functiontest/BVT.java new file mode 100644 index 0000000..810e59a --- /dev/null +++ b/test/TestCase/functiontest/BVT.java @@ -0,0 +1,1452 @@ +/** + * + */ +package functiontest; + +import java.net.SocketTimeoutException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.xml.soap.SOAPException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.BrokerResponse; +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.ResponseListener; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionAttachInfo; +import com.microsoft.hpc.scheduler.session.SessionBase; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; + +/** + * @author yutongs + * + */ +public class BVT { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("BVT"); + logger = new Logger(true, true, "BVT"); + + HpcJava.setUsername(config.UserName); + HpcJava.setPassword(config.Password); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + // todo: check if the target cluster is in ready state + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + // todo: cleanup work for each case + } + + /** + * create a durable session, send requests and get responses + */ + + @Test + public void test_BVT_DurableEcho() { + + logger.Start("test_BVT_DurableEcho"); + config.getValue("NbOfCalls"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName); + info.setSecure(false); + logger.Info("Creating a %s durable session at %s.", config.ServiceName, + config.Scheduler); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + "clientid", session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + int refId = Util.generateRandomInteger(); + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info( + "\tReceived response for request %s: refId: %d", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e) { + logger.Error(e); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + } + + logger.End("test_BVT_DurableEcho"); + + } + + /** + * using secure + */ + @Test + public void test_BVT_DurableEcho_2() { + logger.Start("test_BVT_DurableEcho_2"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSecure(true); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + BrokerClient client = new BrokerClient( + "clientId0", session, AITestLibService.class); + Echo req = Util.generateEchoRequest(); + + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(req, i); + } + + client.endRequests(); + + Iterable> p = client + .getResponses(EchoResponse.class); + + for (BrokerResponse r : p) { + ComputerInfo value = r.getResult().getEchoResult().getValue(); + logger.assertTrue("check response", + value.getRefID().compareTo(req.getRefID()) == 0); + } + client.close(); + + } catch (Throwable e) { + logger.Error(e); + + + } + + try { + session.close(); + } catch (Exception e) { + logger.Error(e); + } + + logger.End("test_BVT_DurableEcho_2"); + } + + /** + * create a durable session, send requests, attach the session and then get + * responses + */ + + @Test + public void test_BVT_DurableEcho_Attach() { + + logger.Start("test_BVT_DurableEcho_Attach"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + int sessionId = 0; + int refId = Util.generateRandomInteger(); + + try { + session = DurableSession.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = DurableSession.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e1) { + logger.Error(e1); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error(e1); + + } + } + + logger.End("test_BVT_DurableEcho_Attach"); + + } + + /** + * create a interactive session, send requests and get responses + */ + + @Test + public void test_BVT_InteractiveEcho() { + + logger.Start("test_BVT_InteractiveEcho"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s interactive session.", config.ServiceName); + Session session = null; + int refId = Util.generateRandomInteger(); + try { + session = Session.createSession(info); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check responses", + reply.getRefID() == refId); + } catch (Exception ex) { + logger.Error(ex); + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e) { + logger.Error(e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + } + + logger.End("test_BVT_InteractiveEcho"); + + } + + /** + * using secure + */ + @Test + public void test_BVT_InteractiveEcho_2() { + logger.Start("test_BVT_InteractiveEcho_2"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSecure(true); + Session session = null; + int refId = Util.generateRandomInteger(); + try { + session = Session.createSession(info); + BrokerClient client = new BrokerClient( + "clientId0", session, AITestLibService.class); + Echo req = Util.generateEchoRequest(refId); + + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(req, i); + } + + client.endRequests(); + + Iterable> p = client + .getResponses(EchoResponse.class); + + for (BrokerResponse r : p) { + ComputerInfo value = r.getResult().getEchoResult().getValue(); + logger.assertTrue("check responses", value.getRefID() == refId); + + } + client.close(); + + } catch (Exception e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Exception e) { + logger.Error(e); + } + + logger.End("test_BVT_InteractiveEcho_2"); + + } + + /** + * create an interactive session, send requests, attach the session and then + * get responses + */ + + @Test + public void test_BVT_InteractiveEcho_Attach() { + + logger.Start("test_BVT_InteractiveEcho_Attach"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + int sessionId = 0; + int refId = Util.generateRandomInteger(); + try { + session = Session.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + } + // session dispose would call close(true) which would cause problem. BUG + if (session != null) { + try { + session.close(false); + } catch (Throwable e1) { + logger.Error(e1); + } + } + + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + Session session2 = null; + try { + session2 = Session.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + + BrokerClient client = new BrokerClient( + session2, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable e) { + logger.Error("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e1) { + logger.Error(e1); + } + + if (session2 != null) { + try { + session2.close(); + } catch (Throwable e1) { + logger.Error(e1); + } + } + + logger.End("test_BVT_InteractiveEcho_Attach"); + + } + + /** + * only create and then close a durable session + */ + + @Test + public void test_BVT_CreateDurableSession() { + logger.Start("test_BVT_CreateDurableSession"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase session = null; + try { + session = Util.CreateSession(info, true); + } catch (SocketTimeoutException e) { + logger.Error(e); + } catch (SessionException e) { + logger.Error(e); + } + + if (session != null) { + try { + session.close(); + } catch (SessionException e) { + logger.Error(e); + } catch (SocketTimeoutException e) { + logger.Error(e); + } + } + + logger.End("test_BVT_CreateDurableSession"); + } + + /** + * only create and then close an interactive session + */ + + @Test + public void test_BVT_CreateInteractiveSession() { + logger.Start("test_BVT_CreateInteractiveSession"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase session = null; + try { + session = Util.CreateSession(info, false); + } catch (SessionException e) { + logger.Error(e); + } catch (SocketTimeoutException e) { + logger.Error(e); + } + + if (session != null) { + try { + session.close(); + } catch (SessionException e) { + logger.Error(e); + } catch (SocketTimeoutException e) { + logger.Error(e); + } + } + + logger.End("test_BVT_CreateInteractiveSession"); + + } + + /** + * durable client purge + */ + @Test + public void test_BVT_DurableClientPurge() { + logger.Start("test_BVT_DurableClientPurge"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + Echo request = Util.generateEchoRequest(); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + client.close(false); + + logger.Info("Retrieving responses..."); + BrokerClient client2 = new BrokerClient( + session, AITestLibService.class); + + for (BrokerResponse response : client2 + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client2.close(true); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_DurableClientPurge"); + + } + + /** + * interactive client purge + */ + @Test + public void test_BVT_InteractiveClientPurge() { + + logger.Start("test_BVT_InteractiveClientPurge"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s interactive session.", config.ServiceName); + Session session = null; + + try { + session = Session.createSession(info); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + Echo request = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(false); + + logger.Info("Retrieving responses..."); + BrokerClient client2 = new BrokerClient( + session, AITestLibService.class); + + for (BrokerResponse response : client2 + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check responses", reply.getRefID() + .compareTo(request.getRefID()) == 0); + } catch (Exception ex) { + logger.Error(ex); + } + + } + + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client2.close(); + + } catch (Throwable e) { + logger.Error(e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + } + + logger.End("test_BVT_InteractiveClientPurge"); + + } + + /** + * durable client flush + */ + @Ignore + public void test_BVT_DurableClientFlush() { + logger.Start("test_BVT_DurableClientFlush"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + Echo request = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.flush(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_DurableClientFlush"); + + } + + /** + * durable multiple batches + */ + @Test + public void test_BVT_DurableMultipleBatches() { + logger.Start("test_BVT_DurableMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + Echo[] requests = new Echo[config.NbOfClients]; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + requests[k] = Util.generateEchoRequest(); + logger.Info("Client%d sending %d requests...", k, + config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(requests[k], i); + } + logger.Info("Client%d calling endRequests()...", k); + client.endRequests(); + } + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + logger.Info("Client%d retrieving responses...", k); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(requests[k].getRefID()) == 0); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + } + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_DurableMultipleBatches"); + } + + /** + * interactive multiple batches + */ + @Test + public void test_BVT_InteractiveMultipleBatches() { + logger.Start("test_BVT_InteractiveMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + Echo[] requests = new Echo[config.NbOfClients]; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + + logger.Info("Client%d sending %d requests...", k, + config.NbOfCalls); + requests[k] = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(requests[k], i); + } + logger.Info("Client%d calling endRequests()...", k); + client.endRequests(); + } + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + + logger.Info("Client%d retrieving responses...", k); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID() + .toString()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(requests[k].getRefID()) == 0); + + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + } + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_InteractiveMultipleBatches"); + } + + /** + * durable shared session + */ + @Test + public void test_BVT_DurableSharedSession() { + logger.Start("test_BVT_DurableSharedSession"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setShareSession(true); // BUG if set false, + // java.lang.ArrayIndexOutOfBoundsException: + // 50331651 + + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + int sessionId = 0; + + try { + session = DurableSession.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName2, config.Password2); + + try { + session = DurableSession.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + Echo request = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e1) { + logger.Error(e1); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error(e1); + + } + } + + logger.End("test_BVT_DurableSharedSession"); + + } + + /** + * interactive shared session + */ + @Ignore + public void test_BVT_InteractiveSharedSession() { + logger.Start("test_BVT_InteractiveSharedSession"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setShareSession(true); // BUG if set false, + // java.lang.ArrayIndexOutOfBoundsException: + // 50331651 + + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + int sessionId = 0; + + try { + session = Session.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName2, config.Password2); + + try { + session = Session.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + Echo request = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + + } catch (Throwable e1) { + logger.Error(e1); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error(e1); + + } + } + + logger.End("test_BVT_InteractiveSharedSession"); + + } + + /** + * durable concurrent multiple batches, n * m batches + */ + @Test + public void test_BVT_DurableConcurrentMultipleBatches() { + logger.Start("test_BVT_DurableConcurrentMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + CountDownLatch L = new CountDownLatch(config.NbOfBatches); + + Thread[] workers = new Thread[config.NbOfBatches]; + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L, session, 0)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L.await(10, TimeUnit.MINUTES); + + CountDownLatch L2 = new CountDownLatch(config.NbOfBatches); + + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L2, session, 1)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L2.await(10, TimeUnit.MINUTES); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_DurableConcurrentMultipleBatches"); + } + + class ConcurrentClient implements Runnable { + public ConcurrentClient(int m, CountDownLatch l, SessionBase session, + int sendget) { + this.m = m; + this.l = l; + this.session = session; + this.sendget = sendget; + + } + + @Override + public void run() { + if (sendget == 0) { + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + + logger.Info("Client %s sending %d requests...", + m + "_" + k, config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(m * k); + try { + client.sendRequest(request, i); + } catch (SessionException e) { + logger.Error(e); + + } catch (SocketTimeoutException e) { + logger.Error(e); + + } + } + logger.Info("Client %s calling endRequests()...", m + "_" + + k); + try { + client.endRequests(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + } + l.countDown(); + } else if (sendget == 1) { + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + logger.Info("Client%s retrieving responses...", m + "_" + k); + try { + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + logger.Info( + "\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == m * k); + + } catch (Throwable ex) { + logger.Error(ex); + + } + + } + } catch (SessionException e) { + logger.Error(e); + + } + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + try { + client.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + + } + l.countDown(); + } + + } + + private int m = 0; + private CountDownLatch l = null; + private SessionBase session = null; + private int sendget = 0; + + } + + /** + * interactive concurrent multiple batches, n * m batches + */ + @Test + public void test_BVT_InteractiveConcurrentMultipleBatches() { + logger.Start("test_BVT_InteractiveConcurrentMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + CountDownLatch L = new CountDownLatch(config.NbOfBatches); + + Thread[] workers = new Thread[config.NbOfBatches]; + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L, session, 0)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L.await(10, TimeUnit.MINUTES); + + CountDownLatch L2 = new CountDownLatch(config.NbOfBatches); + + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L2, session, 1)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L2.await(10, TimeUnit.MINUTES); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_InteractiveConcurrentMultipleBatches"); + } + + /** + * to get responses async for a durable session + */ + + @Test + public void test_BVT_DurableGetResponseAsync() { + + logger.Start("test_BVT_DurableGetResponseAsync"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + final int refId = Util.generateRandomInteger(); + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + + final CountDownLatch l = new CountDownLatch(1); + client.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + @Override + public void responseReturned( + BrokerResponse response) { + + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error(e); + + } catch (SOAPException e) { + logger.Error(e); + + } + logger.Info( + "\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error(e); + + } + }); + + l.await(10, TimeUnit.MINUTES); + client.close(); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_DurableGetResponseAsync"); + + } + + /** + * to get responses async for a durable session + */ + + @Test + public void test_BVT_InteractiveGetResponseAsync() { + + logger.Start("test_BVT_InteractiveGetResponseAsync"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + final int refId = Util.generateRandomInteger(); + try { + session = Session.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + + final CountDownLatch l = new CountDownLatch(1); + client.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + @Override + public void responseReturned( + BrokerResponse response) { + + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error(e); + + } catch (SOAPException e) { + logger.Error(e); + + } + logger.Info( + "\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error(e); + + } + }); + + l.await(10, TimeUnit.MINUTES); + client.close(); + + } catch (Throwable e) { + logger.Error(e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error(e); + + } + + logger.End("test_BVT_InteractiveGetResponseAsync"); + + } + + /** + * custom binding + */ + @Ignore + public void test_BVT_CustomBinding() { + + } + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/BrokerClientTest.java b/test/TestCase/functiontest/BrokerClientTest.java new file mode 100644 index 0000000..cd50fb9 --- /dev/null +++ b/test/TestCase/functiontest/BrokerClientTest.java @@ -0,0 +1,2601 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.UUID; +import java.util.concurrent.*; + +import javax.xml.soap.SOAPException; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import org.tempuri.GenerateLoad; +import org.tempuri.GenerateLoadResponse; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.datacontract.schemas._2004._07.services.StatisticInfo; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.microsoft.hpc.BrokerClientStatus; +import com.microsoft.hpc.scheduler.session.*; + +/** + * @author yutongs + * + */ +public class BrokerClientTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("BrokerClientTest"); + logger = new Logger(true, true, "BrokerClientTest"); + + //HpcJava.setUsername(config.UserName); + //HpcJava.setPassword(config.Password); + + // init sessions and clients + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSessionIdleTimeout(Integer.MAX_VALUE); + info.setClientIdleTimeout(Integer.MAX_VALUE); + + dSession = DurableSession.createSession(info); + iSession = Session.createSession(info); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + dSession.close(); + iSession.close(); + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + dClient = new BrokerClient(UUID.randomUUID() + .toString(), dSession, AITestLibService.class); + iClient = new BrokerClient(UUID.randomUUID() + .toString(), iSession, AITestLibService.class); + + + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + if (dClient != null) + dClient.close(true); + + if (iClient != null) + iClient.close(true); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#finalize()}. + */ + @Ignore + public final void testFinalize() { + // we do not test finalize()/ dispose() here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#BrokerClient(com.microsoft.hpc.scheduler.session.SessionBase, java.lang.Class)} + * . + */ + @Test + public final void testBrokerClientSessionBaseClassOfTContract() { + logger.Start(); + BrokerClient client = null; + // function + client = new BrokerClient(dSession, + AITestLibService.class); + logger.assertNotNull("dSession client", client); + client = null; + client = new BrokerClient(iSession, + AITestLibService.class); + logger.assertNotNull("dSession client", client); + client = null; + + // boundary + + try { + client = new BrokerClient(null, + AITestLibService.class); + logger.Error("Expected exception is not thrown."); + } catch (NullPointerException e) { + logger.Info("Expected NullPointerException ", e); + } catch (Throwable e) { + logger.Error("UE ", e); + } + + try { + client = new BrokerClient(dSession, null); + logger.Error("Expected exception is not thrown."); + } catch (Throwable e) { + logger.Info("Expected exception : %s", e.getMessage()); + } + + try { + client = new BrokerClient(null, null); + logger.Error("Expected exception is not thrown."); + } catch (NullPointerException e) { + logger.Info("Expected NullPointerException ", e); + } catch (Throwable e) { + logger.Error("UE", e); + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#BrokerClient(java.lang.String, com.microsoft.hpc.scheduler.session.SessionBase, java.lang.Class)} + * . + */ + @Test + public final void testBrokerClientStringSessionBaseClassOfTContract() { + logger.Start(); + BrokerClient client = null; + + ArrayList validStrings = new ArrayList(); + validStrings.add("1"); + validStrings.add("a"); + validStrings.add("a1"); + validStrings.add("abcxyz123"); + validStrings.add(" "); // a space is valid + validStrings.add("0aZAz"); + validStrings.add("{valid_string-id}"); + validStrings.add("abc xyz fine"); + + ArrayList invalidStrings = new ArrayList(); + invalidStrings.add(null); + invalidStrings.add(""); + invalidStrings.add("?&*^&%$#)_[]{}"); + invalidStrings.add("."); + invalidStrings.add("/\\"); + invalidStrings.add("abc+xyz"); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 129; i++) { + sb.append('a'); + } + invalidStrings.add(sb.toString()); + for (int i = 0; i < 1290; i++) { + sb.append('a'); + } + invalidStrings.add(sb.toString()); + Echo request = Util.generateEchoRequest(); + + // function + try { + for (String s : validStrings) { + client = new BrokerClient(s, dSession, + AITestLibService.class); + client.sendRequest(request); + client.close(true); + } + } catch (Throwable e) { + logger.Error("Exception", e); + + } + + // boundary + for (String s : invalidStrings) { + + try { + client = new BrokerClient(s, dSession, + AITestLibService.class); + client.sendRequest(request); + client.close(true); + logger.Error("String %s should be invalid", s); + + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + + } + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#BrokerClient(com.microsoft.hpc.scheduler.session.SessionBase, java.lang.String, java.lang.Class)} + * . + */ + @Ignore + public final void testBrokerClientSessionBaseStringClassOfTContract() { + fail("Not yet implemented"); // TODO + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#BrokerClient(java.lang.String, com.microsoft.hpc.scheduler.session.SessionBase, java.lang.String, java.lang.Class)} + * . + */ + @Ignore + public final void testBrokerClientStringSessionBaseStringClassOfTContract() { + fail("Not yet implemented"); // TODO + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object)} + * . + */ + @Test + public final void testSendRequestTMessage() { + logger.Start(); + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // boundary + + try { + iClient.sendRequest(null); + logger.Error("Excetion is expected. i null"); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + dClient.sendRequest(null); + logger.Error("Excetion is expected. d null"); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + iClient.sendRequest(new Object()); + logger.Error("Excetion is expected. i new"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(new Object()); + logger.Error("Excetion is expected. d new"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + iClient.sendRequest(1); + logger.Error("Excetion is expected. i int"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest("message string"); + logger.Error("Excetion is expected.d string"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + iClient.sendRequest(true); + logger.Error("Excetion is expected. i boolean "); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + iClient.sendRequest(request.getClass()); + logger.Error("Excetion is expected. i class"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object)} + * . + */ + @Test + public final void testSendRequestObjectObject() { + logger.Start(); + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // boundary + + try { + iClient.sendRequest(null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests ", + e); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests ", + e); + + } + + try { + dClient.sendRequest(null, "datat"); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests ", + e); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests ", + e); + + } + + try { + iClient.sendRequest(new Object(), 1); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests ", + e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(new Object(), "data"); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests ", + e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + iClient.sendRequest(request, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests ", + e); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests ", + e); + + } + + // following userdata objects are ok + /* + * try { dClient.sendRequest(request, new Object()); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + * + * try { iClient.sendRequest(request, request); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + * + * try { dClient.sendRequest(request, true); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + */ + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, java.lang.String)} + * . + */ + @Test + public final void testSendRequestObjectObjectString() { + + logger.Start(); + // functional + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // TODO + + // boundary + + /* + * try { iClient.sendRequest(request, 1, "ActionString"); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + * + * try { dClient.sendRequest(request, "datat", ""); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + */ + + try { + iClient.sendRequest(request, 1, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + /* + * try { dClient.sendRequest(request, "datat", "&^(&^%$#{}?_?#@*"); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); } + */ + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class)} + * . + */ + @Test + public final void testGetResponses() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + Iterable> responses = dClient + .getResponses(EchoResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = response.getResult().getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + // boundary + + try { + Iterable> responses = dClient + .getResponses(null); + logger.Error("Expected exception not thrown"); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = response.getResult().getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (NullPointerException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + + } catch (Throwable e) { + logger.Error("UE when getting responses", e); + + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener)} + * . + */ + @Test + public final void testSetResponseHandler() { + logger.Start(); + + // functional + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned( + BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", + e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", + e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request ", + e); + + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + e1.printStackTrace(); + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener)} + * . + */ + @Test + public final void testSetResponseHandler_E1() { + logger.Start(); + + // boundary + // when the responsehandler is null + + try { + iClient.setResponseHandler(EchoResponse.class, null); + logger.Error("EE is not thrown."); + } catch (NullPointerException e) { + logger.Info("NullPointerException is expected."); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#dispose()}. + */ + @Ignore + public final void testDispose() { + // we do not test dispose here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} + * . + */ + @Test + public final void testEndRequestsInt() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.endRequests(3000); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when end requests ", e); + + } catch (SessionException e) { + logger.Error("Excpetion when end requests ", e); + + } // BUG this cannot throw InvalidOperationException + + // boundary + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} + * . + */ + @Test + public final void testEndRequestsInt_1() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.endRequests(0); + } catch (Throwable e) { + logger.Error("UE for 0 timeout ", e); + + } + + // boundary + + logger.End(); + + } + + @Test + public final void testEndRequestsInt_0() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.endRequests(-1); + logger.Error("EE is not thrown. -1"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + + } + + try { + dClient.endRequests(Integer.MIN_VALUE); + logger.Error("EE is not thrown. min"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + + } + + /* + * try { dClient.endRequests(1); //endrequest use the larger + * timeoutThrottlingMS which is default 60 seconds + * logger.Error("EE is not thrown. 1"); } catch (Throwable e) { + * logger.Info("Expected Exception %s", e.toString()); + * } + */ + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test + public final void testFlush() { + + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + for (int i = 0; i < config.NbOfCalls; i++) { + dClient.sendRequest(request, "data"); + } + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + logger.Info("start to flush"); + dClient.flush(); // BUG flush should throw SessionException or + // InvalidOperationException + dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // get responses + try { + logger.Info("start go get response"); + Iterable> responses = dClient + .getResponses(EchoResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = response.getResult().getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID().toString()); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + // boundary + + // flush without any requests sent + /* + * try { dClient.flush(); // BUG flush should throw SessionException or + * // InvalidOperationException + * + * } catch (Throwable e) { + * logger.Error("Excpetion when sending requests %s", e.toString()); + * } + */ + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test(timeout = 180000) + public final void testFlush_1() { + + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + for (int i = 0; i < 100; i++) { + try { + dClient.sendRequest(request, "data"); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + } + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.flush(); // BUG flush should throw SessionException or + // InvalidOperationException + dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // get responses + try { + for (BrokerResponse response : dClient + .getResponses(EchoResponse.class)) { + ComputerInfo reply; + try { + reply = response.getResult().getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + // boundary + + // flush without any requests sent + /* + * try { dClient.flush(); // BUG flush should throw SessionException or + * // InvalidOperationException + * + * } catch (Throwable e) { + * logger.Error("Excpetion when sending requests %s", e.toString()); + * } + */ + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Ignore + //@Test(timeout = 180000) + public final void testFlush_Bug1() { + + // functional + logger.Start(); + final Echo request = Util.generateEchoRequest(); + + try { + for (int i = 0; i < 10; i++) { + try { + dClient.sendRequest(request, "data"); + } catch (SocketTimeoutException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.flush(); + //dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests ", e); + + } + + final CountDownLatch l = new CountDownLatch(1); + dClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + @Override + public void responseReturned( + BrokerResponse response) { + + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", + e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", + e); + + } + logger.Info("\tReceived response for request %s: %d", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request ", e); + + } + }); + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + // boundary + + // flush without any requests sent + /* + * try { dClient.flush(); // BUG flush should throw SessionException or + * // InvalidOperationException + * + * } catch (Throwable e) { + * logger.Error("Excpetion when sending requests %s", e.toString()); + * } + */ + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush(int)}. + */ + @Test + public final void testFlushInt() { + + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.flush(3000); // BUG flush should throw SessionException or + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when flushing requests ", e); + + } + + // boundary + + try { + dClient.flush(-1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests ", e); + + } + + try { + dClient.flush(1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests ", e); + + } + + try { + dClient.flush(0); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + + } + + try { + dClient.flush(Integer.MIN_VALUE); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when sending requests %s", e.toString()); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests() { + + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.endRequests(); // BUG this cannot throw + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when end requests ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests_1() { + + // boundary + logger.Start(); + + // endrequest before any requests sent + try { + dClient.endRequests(); // BUG this cannot throw + // InvalidOperationException + } catch (IllegalStateException e) { + logger.Info("EE when end requests %s", e.toString()); + + } catch (Throwable e) { + logger.Error("UE when end requests ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close()}. + */ + @Test + public final void testClose() { + // functional + // bug 11821 + logger.Start(); + + try { + dClient.close(); + } catch (Throwable e) { + logger.Error("Excpetion when close the client ", e); + + } + + // boundary + + // close the client the second time + try { + dClient.close(); + logger.Info("Exception should not be thrown."); + } catch (Throwable e) { + logger.Error("UE when closing the client ", e); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean)} + * . + */ + @Test + public final void testCloseBoolean() { + // functional + // bug 11821 + logger.Start(); + + try { + dClient.close(true); + } catch (IllegalStateException e) { + logger.Info("IllegalStateException is thrown. %s", e.toString()); + + } catch (Throwable e) { + logger.Error("Excpetion when close the client ", e); + + } + + // boundary + + // close the client the second time + try { + dClient.close(true); + logger.Info("Exception should not be thrown."); + } catch (Throwable e) { + logger.Error("UE when closing the client ", e); + + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + // functional + logger.Start(); + + try { + dClient.close(false, 5000); + dClient = null; + } catch (Throwable e) { + logger.Error("Excpetion when close the client ", e); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt_1() { + // boundary + // bug 11821 + logger.Start(); + + try { + dClient.close(false, -1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + + } + + try { + dClient.close(true, Integer.MIN_VALUE); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + + } + + + + try { + dClient.close(true, 1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + + } + + try { + dClient.close(true, 0); + + } catch (Throwable e) { + logger.Error("Excpetion when close the client ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, int)} + * . + */ + @Test + public final void testSendRequestObjectObjectInt() { + logger.Start(); + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1, 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(request, "data", Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + iClient.sendRequest(request, 1, 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // boundary + + try { + iClient.sendRequest(request, 1, -1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + dClient.sendRequest(request, "datat", Integer.MIN_VALUE); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + iClient.sendRequest(request, 1, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + iClient.sendRequest(request, 1, -5000); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + try { + iClient.sendRequest(request, null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, java.lang.String, int)} + * . + */ + @Test + public final void testSendRequestObjectObjectStringInt() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo", + 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo", 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + // boundary + logger.End(); + } + + + /** + * Test method for GetRequestCount + */ + @Test + public final void testGetRequestCount() { + logger.Start(); + try { + logger.Info(dClient.getRequestCount()); + logger.Info(iClient.getRequestCount()); + + logger.assertEqual("dClient request count", dClient.getRequestCount(), 0); + logger.assertEqual("iClient request count", iClient.getRequestCount(),0); + + + + int refId = Util.generateRandomInteger(); + for (int i = 0; i < 100; i++) { + Echo request = Util.generateEchoRequest(refId); + iClient.sendRequest(request, i); + + } + logger.Info(iClient.getRequestCount()); + // logger.assertEqual("iClient request count", iClient.getRequestCount(), 100); + // getRequestCount - the name is confusing, what does it stand for? + + logger.Info("Call endRequests()..."); + + iClient.endRequests(); + logger.Info(iClient.getRequestCount()); + logger.assertEqual("iClient request count", iClient.getRequestCount(), 100); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : iClient + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info( + "\tReceived response for request %s: refId: %d", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + + logger.Info(iClient.getRequestCount()); + logger.assertEqual("iClient request count", iClient.getRequestCount(), 100); + logger.Info("Done retrieving %d responses", 100); + + + } catch (SessionException e) { + logger.Error("UE is thrown ",e); + + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown ",e); + + } + + + logger.End(); + + + } + + /** + * Test method for GetStatus + */ + @Test + public final void testGetStatus() { + logger.Start(); + try { + logger.Info(dClient.getStatus().toString()); + logger.Info(iClient.getStatus().toString()); + + logger.assertEqual("dClient status", dClient.getStatus(), BrokerClientStatus.READY); + logger.assertEqual("iClient status", iClient.getStatus(),BrokerClientStatus.READY); + + + + int refId = Util.generateRandomInteger(); + for (int i = 0; i < 100; i++) { + Echo request = Util.generateEchoRequest(refId); + dClient.sendRequest(request, i); + + } + logger.Info(dClient.getStatus().toString()); + logger.assertEqual("dClient status", dClient.getStatus(), BrokerClientStatus.READY); + logger.Info("Call endRequests()..."); + + dClient.endRequests(); + logger.Info(dClient.getStatus().toString()); + logger.assertEqual("dClient status", dClient.getStatus(), BrokerClientStatus.PROCESSING); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : dClient + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info( + "\tReceived response for request %s: refId: %d", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + + logger.Info(dClient.getStatus().toString()); + logger.assertEqual("dClient status", dClient.getStatus(), BrokerClientStatus.FINISHED); + logger.Info("Done retrieving %d responses", 100); + + + } catch (SessionException e) { + logger.Error("UE is thrown ",e); + + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown ",e); + + } + + + logger.End(); + + + } + + /** + * Test method for {@link java.lang.Object#Object()}. + */ + @Ignore + public final void testObject() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#getClass()}. + */ + @Ignore + public final void testGetClass() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#hashCode()}. + */ + @Ignore + public final void testHashCode() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#equals(java.lang.Object)}. + */ + @Ignore + public final void testEquals() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#clone()}. + */ + @Ignore + public final void testClone() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#toString()}. + */ + @Ignore + public final void testToString() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#notify()}. + */ + @Ignore + public final void testNotify() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#notifyAll()}. + */ + @Ignore + public final void testNotifyAll() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait(long)}. + */ + @Ignore + public final void testWaitLong() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait(long, int)}. + */ + @Ignore + public final void testWaitLongInt() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait()}. + */ + @Ignore + public final void testWait() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class, int)} + * . + */ + @Test + public void testGetResponsesClassOfTMessageInt() { + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses()}. + */ + @Test + public void testGetResponses2() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + Iterable> responses = dClient.getResponses(EchoResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt() { + // functional + logger.Start(); + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + Iterable> responses = dClient.getResponses(EchoResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = ((EchoResponse) response.getResult()).getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + try { + Iterable> responses = dClient.getResponses(EchoResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + ComputerInfo reply; + try { + reply = ((EchoResponse) response.getResult()).getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + // boundary + + try { + Iterable> responses = dClient + .getResponses(-1); + logger.Error("Expected exception not thrown"); + + } catch (IllegalArgumentException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + + } catch (Throwable e) { + logger.Error("UE when getting responses ", e); + + } + + try { + Iterable> responses = dClient + .getResponses(Integer.MIN_VALUE); + logger.Error("Expected exception not thrown"); + + } catch (IllegalArgumentException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + + } catch (Throwable e) { + logger.Error("UE when getting responses ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt_E1() { + // functional + logger.Start(); + GenerateLoad request = Util.generateGeneratedLoad(null, null, + 1 * 1000, Util.generateRandomInteger()); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + Iterable> responses = dClient + .getResponses(GenerateLoadResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + StatisticInfo reply; + try { + reply = ((GenerateLoadResponse) response.getResult()) + .getGenerateLoadResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + try { + Iterable> responses = dClient + .getResponses(GenerateLoadResponse.class); + Iterator> iter = responses.iterator(); + BrokerResponse response = iter.next(); + StatisticInfo reply; + try { + reply = ((GenerateLoadResponse) response.getResult()) + .getGenerateLoadResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("Exception in getResponse ", e); + + } catch (SOAPException e) { + logger.Error("Exception in getResponse ", e); + + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses ", e); + + } + + // boundary + + try { + Iterable> responses = dClient + .getResponses(-1); + logger.Error("Expected exception not thrown"); + + } catch (IllegalArgumentException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + + } catch (Throwable e) { + logger.Error("UE when getting responses ", e); + + } + + try { + Iterable> responses = dClient + .getResponses(Integer.MIN_VALUE); + logger.Error("Expected exception not thrown"); + + } catch (IllegalArgumentException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + + } catch (Throwable e) { + logger.Error("UE when getting responses ", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt() { + + // functional + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + + iClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned( + BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", + e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", + e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request %s, raised error", + e.toString()); + + l.countDown(); + } + + }, 30000); + + try { + iClient.sendRequest(request, "data"); + iClient.sendRequest(request, "data"); + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + e1.printStackTrace(); + } + + logger.End(); + + } + + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . EOM bug 17154 + */ + @Test + public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt3() { + + // functional + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + + iClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned( + BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", + e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", + e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request %s, raised error", + e.toString()); + + l.countDown(); + } + + }, 30000); + + try { + iClient.sendRequest(request, "data"); + iClient.sendRequest(request, "data"); + iClient.sendRequest(request, "data"); + //sleep 10 seconds here to wait for all request done + Thread.sleep(10000); + //and then send the EOM + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests", e); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests", e); + } catch (InterruptedException e) { + logger.Error("Excpetion when sending requests", e); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch", e1); + + } + + logger.End(); + + } + + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt2() { + + // functional + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned( + BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", e); + } catch (SOAPException e) { + logger.Error("Error in process request ", e); + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request",e); + + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e ); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e ); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt_E1() { + + // boundary + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(EchoResponse.class, + new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned( + BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = response.getResult().getEchoResult() + .getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ",e); + + } catch (SOAPException e) { + logger.Error("Error in process request ",e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", reply.getRefID() + .compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + if (e instanceof WebServiceException) { + if (e.getCause() instanceof SocketTimeoutException) { + logger.Info("Expected timeout exception"); + + l.countDown(); + return; + } + } + logger.Error("Error in process request raised error",e); + l.countDown(); + return; + + } + + }, 5); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObject() { + + // functional + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned(BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = ((EchoResponse) response.getResult()) + .getEchoResult().getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", e); + + } catch (SOAPException e) { + logger.Error("Error in process request", e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request ", e ); + + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt() { + // functional + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned(BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = ((EchoResponse) response.getResult()) + .getEchoResult().getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request ", e); + + } + + }, 5000); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests ", e); + + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt_E1() { + // boundary + logger.Start(); + + final Echo request = Util.generateEchoRequest(); + final CountDownLatch l = new CountDownLatch(1); + + iClient.setResponseHandler(new ResponseListener() { + + private int count = 0; + + @Override + public void responseReturned(BrokerResponse response) { + count++; + ComputerInfo reply = null; + try { + reply = ((EchoResponse) response.getResult()) + .getEchoResult().getValue(); + } catch (SOAPFaultException e) { + logger.Error("Error in process request ", e); + + } catch (SOAPException e) { + logger.Error("Error in process request ", e); + + } + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID().compareTo(request.getRefID()) == 0); + + } + + @Override + public void endOfMessage() { + logger.Info("Done retrieving %d responses", count); + l.countDown(); + + } + + @Override + public void raiseError(Exception e) { + logger.Error("Error in process request ", e); + + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests ", e); + + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests", e); + + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch ", e1); + + } + logger.End(); + + } + + private static Session iSession = null; + private static DurableSession dSession = null; + private static BrokerClient iClient = null; + private static BrokerClient dClient = null; + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/BrokerResponseTest.java b/test/TestCase/functiontest/BrokerResponseTest.java new file mode 100644 index 0000000..5550f79 --- /dev/null +++ b/test/TestCase/functiontest/BrokerResponseTest.java @@ -0,0 +1,190 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import javax.xml.soap.SOAPException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import org.tempuri.GenerateLoad; +import org.tempuri.GenerateLoadResponse; + +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.BrokerResponse; +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; + +/** + * @author yutongs + * + */ +public class BrokerResponseTest { + + private static Echo request = Util.generateEchoRequest(); + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("BrokerResponseTest"); + logger = new Logger(true, true, "BrokerResponseTest"); + + // init sessions and clients + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSessionIdleTimeout(Integer.MAX_VALUE); + info.setClientIdleTimeout(Integer.MAX_VALUE); + + dSession = DurableSession.createSession(info); + iSession = Session.createSession(info); + + dClient = new BrokerClient(dSession, + AITestLibService.class); + iClient = new BrokerClient(iSession, + AITestLibService.class); + + dClient.sendRequest(request, 2); + dClient.endRequests(); + dResponse = dClient.getResponses(EchoResponse.class).iterator().next(); + + iClient.sendRequest(request, 1); + iClient.endRequests(); + iResponse = iClient.getResponses(EchoResponse.class).iterator().next(); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + dClient.close(); + iClient.close(); + dSession.close(); + iSession.close(); + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getMessage()}. + */ + @Test + public final void testGetMessage() { + logger.Start(); + logger.Info(iResponse.getMessage().toString()); + logger.Info(iResponse.getMessage().getContentDescription()); + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getResult()}. + */ + @Test + public final void testGetResult() { + logger.Start(); + try { + ComputerInfo value = dResponse.getResult().getEchoResult() + .getValue(); + logger.assertTrue("message compare", + value.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("response getresult error", e); + + } catch (SOAPException e) { + logger.Error("response getresult error", e); + + } + + try { + ComputerInfo value = iResponse.getResult().getEchoResult() + .getValue(); + logger.assertTrue("message compare", + value.getRefID().compareTo(request.getRefID()) == 0); + } catch (SOAPFaultException e) { + logger.Error("response getresult error",e); + + } catch (SOAPException e) { + logger.Error("response getresult error",e); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getUserData()}. + */ + @Test + public final void testGetUserData() { + logger.Start(); + logger.assertEqual("get user data", iResponse.getUserData(), "1"); + logger.assertEqual("get user data", dResponse.getUserData(), "2"); + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getSOAPMessage(java.lang.Object)} + * . + */ + @Test + public final void testGetSOAPMessage() { + logger.Start(); + + logger.Info(iResponse.getMessage().toString()); + // it is not public, do not test it here + + logger.End(); + } + + private static Session iSession = null; + private static DurableSession dSession = null; + private static BrokerClient iClient = null; + private static BrokerClient dClient = null; + + private static BrokerResponse iResponse = null; + private static BrokerResponse dResponse = null; + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/CommonDataBytes.java b/test/TestCase/functiontest/CommonDataBytes.java new file mode 100644 index 0000000..183cdab --- /dev/null +++ b/test/TestCase/functiontest/CommonDataBytes.java @@ -0,0 +1,26 @@ +/** + * + */ +package functiontest; + +import com.microsoft.hpc.scheduler.session.*; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Random; + +/** + * @author mingqw + * + */ + +public class CommonDataBytes { + public byte[] bytes = null; + public String md5Hash = null; + + public CommonDataBytes(byte[] _bytes, String _md5Hash) { + bytes = _bytes; + md5Hash = _md5Hash; + } +} diff --git a/test/TestCase/functiontest/CommonDataHelper.java b/test/TestCase/functiontest/CommonDataHelper.java new file mode 100644 index 0000000..2afc5bf --- /dev/null +++ b/test/TestCase/functiontest/CommonDataHelper.java @@ -0,0 +1,277 @@ +/** + * + */ +package functiontest; + +import com.microsoft.hpc.exceptions.FaultException; +import com.microsoft.hpc.exceptions.DataException; +import com.microsoft.hpc.scheduler.session.*; + +import java.io.File; +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import org.tempuri.GetCommonData; +import org.tempuri.GetCommonDataResponse; +import org.tempuri.ITestService; +import org.tempuri.ObjectFactory; + +/** + * @author mingqw + * + */ + +public class CommonDataHelper { + + private static Config config = new Config("CommonDataTest"); + public static String[] validDataClientId = new String[] { + "0123456789", + "abcdefghijklmnopqrstuvwxyz", + "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "_", + "-", + " -", + "{", + "}", + "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong" }; + public static String[] invalidDataClientId = new String[] { + "^", + "[", + "]", + "*", + "$", + "~", + "`", + "!", + "@", + "#", + "%", + "&", + "(", + ")", + "+", + "=", + "|", + "\\", + ";", + ":", + "\"", + "'", + "<", + ">", + "/", + "?", + ".", + ",", + " ", + "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong" }; + public static String defaultDataClientId = "defaultId"; + public static byte[] simpleCommonData = new byte[] { 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9 }; + public static int defaultSize = 100 * 1024 * 1024; + + public static CommonDataBytes GenerateCommonDataBytes(int size) { + Random r = new Random(); + byte[] data = new byte[size]; + r.nextBytes(data); + String md5Hash = Md5HashString(data); + return new CommonDataBytes(data, md5Hash); + } + + public static String Md5HashString(byte[] data) { + MessageDigest md = null; + try { + md = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + byte[] thedigest = md.digest(data); + StringBuilder builder = new StringBuilder(); + for (byte d : thedigest) { + builder.append(String.format("%2X", d)); + } + String md5 = builder.toString(); + return md5.replace(' ', '0'); + } + + public static boolean ValidateCommonDataBytes(byte[] commonData, + String expectedMd5Hash) { + String commonDataMd5Hash = Md5HashString(commonData); + return commonDataMd5Hash.equals(expectedMd5Hash); + + } + + public static void SetDataServer(String dataServer) throws IOException { + List cmds = new LinkedList(); + cmds.add(System.getenv().get("CCP_HOME") + File.separator + "bin" + + File.separator + "cluscfg"); + cmds.add("setenvs"); + cmds.add(String.format("HPC_RUNTIMESHARE=%s", dataServer)); + cmds.add(String.format("/scheduler:%s", config.Scheduler)); + runCmd(cmds); + cmds = new LinkedList(); + cmds.add("sc"); + cmds.add(String.format("\\\\%s", config.Scheduler)); + cmds.add("control"); + cmds.add("HpcSession"); + cmds.add("128"); + runCmd(cmds); + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static int runCmd(List cmd) throws IOException { + ProcessBuilder pb = new ProcessBuilder(); + pb.command(cmd); + Process p = pb.start(); + int rtnCode = Integer.MIN_VALUE; + try { + rtnCode = p.waitFor(); + } catch (InterruptedException e) { + return rtnCode; + } + return rtnCode; + } + + public static String GetDataServer() { + // hack: how to retrieve cluster cfg? + return config.getValue("DefaultDataServer"); + } + + public static long GetCommonDataFileSize(String defaultDataClientId) + throws DataException { + DataClient dataClient = DataClientHelper.Open(defaultDataClientId); + String filePath = dataClient.getStorePath(); + File file = new File(filePath); + return file.length(); + + } + + public static void SimpleSendGetCommonData(Logger logger, int dataSize, + boolean isDurable) throws SocketTimeoutException, SessionException, + DataException, DatatypeConfigurationException { + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SimpleSendGetCommonData(logger, ssi, dataSize, isDurable); + } + + public static void SimpleSendGetCommonData(Logger logger, + SessionStartInfo ssi, int dataSize, boolean isDurable) + throws SessionException, SocketTimeoutException, DataException, + DatatypeConfigurationException { + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + SessionBase session; + if (isDurable) + session = DurableSession.createSession(ssi); + else + session = Session.createSession(ssi); + if (ssi.getRunAsUsername().equalsIgnoreCase(config.UserName)) { + DataClientHelper.WriteAll(CommonDataHelper.defaultDataClientId, + commonData.bytes, session.getId(), isDurable); + } else { + DataClientHelper.WriteAll(CommonDataHelper.defaultDataClientId, + commonData.bytes, session.getId(), isDurable, + new String[] { config.UserName2 }); + } + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + DatatypeFactory df = DatatypeFactory.newInstance(); + Duration sleepBeforeGet = df.newDuration(0); + Duration sleepAfterGet = df.newDuration(0); + SendGetCommonData(logger, client, CommonDataHelper.defaultDataClientId, + commonData.md5Hash, sleepBeforeGet, sleepAfterGet); + session.close(); + } + + public static void SendGetCommonData(Logger logger, + BrokerClient client, String dataClientId, + String md5Hash, Duration sleepBeforeGet, Duration sleepAfterGet) + throws SessionException, DatatypeConfigurationException, + SocketTimeoutException { + SendGetCommonData(logger, client, config.NbOfCalls, dataClientId, + md5Hash, sleepBeforeGet, sleepAfterGet); + } + + public static void SendGetCommonData(Logger logger, + BrokerClient client, int reqCount, + String dataClientId, String md5Hash, Duration sleepBeforeGet, + Duration sleepAfterGet) throws SessionException, + DatatypeConfigurationException, SocketTimeoutException { + SendGetCommonData(logger, client, reqCount, dataClientId, md5Hash, + sleepBeforeGet, sleepAfterGet, + CommonDataTestActionId.Read_Raw_Bytes); + } + + public static void SendGetCommonData(Logger logger, + BrokerClient client, int reqCount, + String dataClientId, String md5Hash, Duration sleepBeforeGet, + Duration sleepAfterGet, CommonDataTestActionId testActionId) + throws DatatypeConfigurationException, SessionException, + SocketTimeoutException { + Random r = new Random(); + ObjectFactory of = new ObjectFactory(); + DatatypeFactory df = DatatypeFactory.newInstance(); + logger.Info("Begin to send requests"); + for (int i = 0; i < reqCount; i++) { + if (sleepBeforeGet == null) { + + sleepBeforeGet = df.newDuration(r.nextInt(2000)); + } + if (sleepAfterGet == null) { + sleepAfterGet = df.newDuration(r.nextInt(2000)); + } + GetCommonData request = new GetCommonData(); + request.setDataClientId(of + .createGetCommonDataDataClientId(dataClientId)); + request.setExpectedMd5Hash(of + .createGetCommonDataExpectedMd5Hash(md5Hash)); + request.setRefID(i); + request.setSleepAfterGet(sleepAfterGet); + request.setSleepBeforeGet(sleepBeforeGet); + request.setTestActionId(testActionId.getCode()); + client.sendRequest(request, String.valueOf(i)); + } + client.endRequests(); + for (BrokerResponse response : client + .getResponses(GetCommonDataResponse.class)) { + String refID = null; + try { + refID = response.getUserData(); + ComputerInfo rtn = response.getResult() + .getGetCommonDataResult().getValue(); + + // }catch (FaultException exception) { + // exception.logger.Error( + // "Common data is corrupted for req %s: %s", refID, + // exception.Detail.Reason); + } catch (Exception e) { + logger.Error("Unexpected exception for req %s: %s", refID, e + .getMessage()); + } + + } + logger.Info("All requests returned."); + } + +} diff --git a/test/TestCase/functiontest/CommonDataTestActionId.java b/test/TestCase/functiontest/CommonDataTestActionId.java new file mode 100644 index 0000000..0a28021 --- /dev/null +++ b/test/TestCase/functiontest/CommonDataTestActionId.java @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Define the error code for data operations +// +//------------------------------------------------------------------------------ +package functiontest; + +public enum CommonDataTestActionId { + Default(0), READ_AccessDenied(1), READ_AccessDenied_ReadBytes(2), No_Read_PerReq( + 3), Read_Raw_Bytes(4),No_Read_Raw_PerReq(5); + + private int code; + + private CommonDataTestActionId(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + + public static CommonDataTestActionId getEnum(int code) { + // @todo: if this turns out a bottleneck, we need a do a hash lookup + for (CommonDataTestActionId c : CommonDataTestActionId.class + .getEnumConstants()) { + if (c.getCode() == code) + return c; + } + + return CommonDataTestActionId.Default; + } +} diff --git a/test/TestCase/functiontest/CommonDataTestDurable.java b/test/TestCase/functiontest/CommonDataTestDurable.java new file mode 100644 index 0000000..f4c0829 --- /dev/null +++ b/test/TestCase/functiontest/CommonDataTestDurable.java @@ -0,0 +1,311 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.SocketTimeoutException; +import java.util.Arrays; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.tempuri.AITestLibService; + +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.DataLifeCycle; +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.SessionUnitType; +import com.microsoft.hpc.exceptions.DataException; + +/** + * @author mingqw + * + */ +public class CommonDataTestDurable { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("CommonDataTestDurable"); + logger = new Logger(true, true, "CommonDataTestDurable"); + String[] tmp = config.getValue("DataSizeToCheck").split(","); + dataSizeToCheck = new int[tmp.length]; + for (int i = 0; i < tmp.length; i++) { + dataSizeToCheck[i] = Integer.parseInt(tmp[i]); + } + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + for (String dataClientId : DataClientHelper.CreatedDataClients) { + try { + DataClient.delete(dataClientId, config.Scheduler, + config.UserName, config.Password); + } catch (Exception e) { + // ignore error + } + } + + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the session", + public final void V3_DataClient_E2E_1() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataHelper.SimpleSendGetCommonData(logger, dataSize, true); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - multiple common data for each batch + // within one session - serviceHost concurrent read + public final void V3_DataClient_E2E_2() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession session = DurableSession.createSession(ssi); + for (int i = 1; i <= 3; i++) { + logger.Info("Round %s", i); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClientHelper.WriteAll(String.format("data-%s", i), + data.bytes, session.getId(), true); + BrokerClient client = new BrokerClient( + String.valueOf(i), session, AITestLibService.class); + DatatypeFactory df = DatatypeFactory.newInstance(); + CommonDataHelper.SendGetCommonData(logger, client, String + .format("data-%s", i), data.md5Hash, df.newDuration(0), + df.newDuration(1000)); + } + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - multiple common data for each batch + // within one session - serviceHost read with random time + public final void V3_DataClient_E2E_3() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession session = DurableSession.createSession(ssi); + for (int i = 1; i <= 3; i++) { + logger.Info("Round %s", i); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClientHelper.WriteAll(String.format("data-%s", i), + data.bytes, session.getId()); + BrokerClient client = new BrokerClient( + String.valueOf(i), session, AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, String + .format("data-%s", i), data.md5Hash, null, null); + + } + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // one by one + public final void V3_DataClient_E2E_6() throws DataException, + SocketTimeoutException, SessionException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(data.bytes); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession session = DurableSession.createSession(ssi); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + DatatypeFactory df = DatatypeFactory.newInstance(); + CommonDataHelper.SendGetCommonData(logger, client, + CommonDataHelper.defaultDataClientId, data.md5Hash, df + .newDuration(0), df.newDuration(1000)); + + session.close(); + Thread.sleep(10 * 1000); + session = DurableSession.createSession(ssi); + client = new BrokerClient(session, + AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, + CommonDataHelper.defaultDataClientId, data.md5Hash, df + .newDuration(0), df.newDuration(1000)); + + session.close(); + + DataClientHelper.Delete(); + + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // node allocation + public final void V3_DataClient_E2E_8() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setResourceUnitType(SessionUnitType.Node); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // socket allocation", + public final void V3_DataClient_E2E_9() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setResourceUnitType(SessionUnitType.Socket); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the session - + // runas User + public final void V3_DataClient_E2E_10() throws SocketTimeoutException, + SessionException, DataException, DatatypeConfigurationException, + InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setRunAsUsername(config.UserName2); + ssi.setRunAsPassword(config.Password2); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - Common data read in static constructor + public final void V3_DataClient_E2E_11() throws DataException, + SocketTimeoutException, SessionException, InterruptedException, + DatatypeConfigurationException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.addEnvironment("ValidateCommonDataBytesInStaticContructor", + CommonDataHelper.defaultDataClientId + ":" + data.md5Hash); + DataClient dataClient = DataClientHelper.Create(); + logger.Info("Write data"); + dataClient.writeRawBytesAll(data.bytes, true); + logger.Info("Begin to create session"); + DurableSession session = DurableSession.createSession(ssi); + logger.Info("Bind data with session %s", session.getId()); + dataClient.setDataLifeCycle(new DataLifeCycle(session.getId())); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, + config.NbOfCalls, CommonDataHelper.defaultDataClientId, + data.md5Hash, null, null, + CommonDataTestActionId.No_Read_Raw_PerReq); + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + private static Config config; + private static Logger logger; + private static int[] dataSizeToCheck; +} diff --git a/test/TestCase/functiontest/CommonDataTestInteractive.java b/test/TestCase/functiontest/CommonDataTestInteractive.java new file mode 100644 index 0000000..9c732a2 --- /dev/null +++ b/test/TestCase/functiontest/CommonDataTestInteractive.java @@ -0,0 +1,311 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.SocketTimeoutException; +import java.util.Arrays; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.tempuri.AITestLibService; + +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.DataLifeCycle; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.SessionUnitType; +import com.microsoft.hpc.exceptions.DataException; + +/** + * @author mingqw + * + */ +public class CommonDataTestInteractive { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("CommonDataTestInteractive"); + logger = new Logger(true, true, "CommonDataTestInteractive"); + String[] tmp = config.getValue("DataSizeToCheck").split(","); + dataSizeToCheck = new int[tmp.length]; + for (int i = 0; i < tmp.length; i++) { + dataSizeToCheck[i] = Integer.parseInt(tmp[i]); + } + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + for (String dataClientId : DataClientHelper.CreatedDataClients) { + try { + DataClient.delete(dataClientId, config.Scheduler, + config.UserName, config.Password); + } catch (Exception e) { + // ignore error + } + } + + } + + @Test + // Simple send and get common data - one common data across the session", + public final void DataClient_BrokerClient_E2E_1() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataHelper.SimpleSendGetCommonData(logger, dataSize, false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - multiple common data for each batch + // within one session - serviceHost concurrent read + public final void DataClient_BrokerClient_E2E_2() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = Session.createSession(ssi); + for (int i = 1; i <= 3; i++) { + logger.Info("Round %s", i); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClientHelper.WriteAll(String.format("data-%s", i), + data.bytes, session.getId()); + BrokerClient client = new BrokerClient( + String.valueOf(i), session, AITestLibService.class); + DatatypeFactory df = DatatypeFactory.newInstance(); + CommonDataHelper.SendGetCommonData(logger, client, String + .format("data-%s", i), data.md5Hash, df.newDuration(0), + df.newDuration(1000)); + } + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - multiple common data for each batch + // within one session - serviceHost read with random time + public final void DataClient_BrokerClient_E2E_3() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = Session.createSession(ssi); + for (int i = 1; i <= 3; i++) { + logger.Info("Round %s", i); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClientHelper.WriteAll(String.format("data-%s", i), + data.bytes, session.getId()); + BrokerClient client = new BrokerClient( + String.valueOf(i), session, AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, String + .format("data-%s", i), data.md5Hash, null, null); + + } + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // one by one + public final void DataClient_BrokerClient_E2E_6() throws DataException, + SocketTimeoutException, SessionException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(data.bytes); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = Session.createSession(ssi); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + DatatypeFactory df = DatatypeFactory.newInstance(); + CommonDataHelper.SendGetCommonData(logger, client, + CommonDataHelper.defaultDataClientId, data.md5Hash, df + .newDuration(0), df.newDuration(1000)); + + session.close(); + Thread.sleep(10 * 1000); + session = Session.createSession(ssi); + client = new BrokerClient(session, + AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, + CommonDataHelper.defaultDataClientId, data.md5Hash, df + .newDuration(0), df.newDuration(1000)); + + session.close(); + + DataClientHelper.Delete(); + + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // node allocation + public final void DataClient_BrokerClient_E2E_8() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setResourceUnitType(SessionUnitType.Node); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the sessions - + // socket allocation", + public final void DataClient_BrokerClient_E2E_9() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setResourceUnitType(SessionUnitType.Socket); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - one common data across the session - + // runas User + public final void DataClient_BrokerClient_E2E_10() + throws SocketTimeoutException, SessionException, DataException, + DatatypeConfigurationException, InterruptedException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setRunAsUsername(config.UserName2); + ssi.setRunAsPassword(config.Password2); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, dataSize, + false); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + @Test(timeout = 600000) + // Simple send and get common data - Common data read in static constructor + public final void DataClient_BrokerClient_E2E_11() throws DataException, + SocketTimeoutException, SessionException, InterruptedException, + DatatypeConfigurationException { + logger.Start(); + for (int dataSize : dataSizeToCheck) { + logger.Info("Test common data size as %sB", dataSize); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(dataSize); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.addEnvironment("ValidateCommonDataBytesInStaticContructor", + CommonDataHelper.defaultDataClientId + ":" + data.md5Hash); + DataClient dataClient = DataClientHelper.Create(); + logger.Info("Write data"); + dataClient.writeRawBytesAll(data.bytes, true); + logger.Info("Begin to create session"); + Session session = Session.createSession(ssi); + logger.Info("Bind data with session %s", session.getId()); + dataClient.setDataLifeCycle(new DataLifeCycle(session.getId())); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + CommonDataHelper.SendGetCommonData(logger, client, + config.NbOfCalls, CommonDataHelper.defaultDataClientId, + data.md5Hash, null, null, + CommonDataTestActionId.No_Read_Raw_PerReq); + session.close(); + // Sleep some time for data cleanup before next session + Thread.sleep(10 * 1000); + } + logger.End(); + } + + private static Config config; + private static Logger logger; + private static int[] dataSizeToCheck; +} diff --git a/test/TestCase/functiontest/Config.java b/test/TestCase/functiontest/Config.java new file mode 100644 index 0000000..fb07bf7 --- /dev/null +++ b/test/TestCase/functiontest/Config.java @@ -0,0 +1,100 @@ +/** + * + */ +package functiontest; + +import java.io.*; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import javax.xml.parsers.*; +import javax.xml.xpath.*; + +/** + * @author yutongs This class is to store the config setting for the tests. + */ +public class Config { + + public String UserName = "username"; + public String Password = "password"; + public String UserName2 = "username2"; + public String Password2 = "password2"; + + public String Scheduler = "wcs-1515118"; + public String ServiceName = "AITestServiceLib"; + public int NbOfCalls = 12; + public int NbOfClients = 1; + public int NbOfBatches = 1; + public int NbOfSessions = 1; + + public Config() { + File f = new File("TestData.xml"); + if (f.exists()) { + DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder builder; + try { + builder = factory.newDocumentBuilder(); + doc = builder.parse(f); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + + XPathFactory xpFactory = XPathFactory.newInstance(); + path = xpFactory.newXPath(); + + // read the global config data + try { + Scheduler = path.evaluate("/Config/Global/Scheduler", doc); + UserName = path.evaluate("/Config/Global/UserName", doc); + Password = path.evaluate("/Config/Global/Password", doc); + UserName2 = path.evaluate("/Config/Global/UserName2", doc); + Password2 = path.evaluate("/Config/Global/Password2", doc); + + ServiceName = path.evaluate("/Config/Global/ServiceName", doc); + NbOfCalls = Integer.parseInt(path.evaluate( + "/Config/Global/NbOfCalls", doc)); + NbOfClients = Integer.parseInt(path.evaluate( + "/Config/Global/NbOfClients", doc)); + NbOfBatches = Integer.parseInt(path.evaluate( + "/Config/Global/NbOfBatches", doc)); + NbOfSessions = Integer.parseInt(path.evaluate( + "/Config/Global/NbOfSessions", doc)); + + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + + } + + } + + public Config(String groupName) { + this(); + this.groupName = groupName; + + } + + public String getValue(String name) { + String value = ""; + + try { + value = path.evaluate("/Config/Group[@name=\"" + groupName + "\"]/" + + name, doc); + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + + return value; + } + + private String groupName = ""; + private Document doc = null; + private XPath path = null; + +} diff --git a/test/TestCase/functiontest/DataClientHelper.java b/test/TestCase/functiontest/DataClientHelper.java new file mode 100644 index 0000000..8b21862 --- /dev/null +++ b/test/TestCase/functiontest/DataClientHelper.java @@ -0,0 +1,97 @@ +/** + * + */ +package functiontest; + +import com.microsoft.hpc.scheduler.session.*; +import com.microsoft.hpc.exceptions.DataException; + +import java.util.ArrayList; + +/** + * @author mingqw + * + */ + +public class DataClientHelper { + + // To Do: might need lock for this + public static ArrayList CreatedDataClients = new ArrayList(); + private static Config config = new Config(); + + public static DataClient Create() throws DataException { + return Create(CommonDataHelper.defaultDataClientId); + } + + public static DataClient Create(String dataClientId) throws DataException { + CreatedDataClients.add(dataClientId); + return DataClient.create(dataClientId, config.Scheduler, + config.UserName, config.Password); + } + + public static DataClient Create(String dataClientId, String[] allowedUsers) throws DataException { + CreatedDataClients.add(dataClientId); + return DataClient.create(dataClientId, config.Scheduler, + config.UserName, config.Password, allowedUsers); + } + + public static DataClient Create(int sessionId) throws DataException { + return Create(CommonDataHelper.defaultDataClientId, sessionId); + } + + public static DataClient Create(String dataClientId, int sessionId) + throws DataException { + CreatedDataClients.add(dataClientId); + DataClient client = DataClient.create(dataClientId, config.Scheduler, + config.UserName, config.Password); + client.setDataLifeCycle(new DataLifeCycle(sessionId)); + return client; + } + + public static DataClient Open() throws DataException { + return Open(CommonDataHelper.defaultDataClientId); + } + + public static DataClient Open(String dataClientId) throws DataException { + return DataClient.open(dataClientId, config.Scheduler, config.UserName, + config.Password); + } + + public static void Delete() throws DataException { + DataClient.delete(CommonDataHelper.defaultDataClientId, + config.Scheduler, config.UserName, config.Password); + } + + public static void Delete(String dataClientId) throws DataException { + DataClient.delete(dataClientId, config.Scheduler, config.UserName, + config.Password); + } + + public static void WriteAll(byte[] data, int sessionId) + throws DataException { + WriteAll(CommonDataHelper.defaultDataClientId, data, sessionId); + } + + public static void WriteAll(String dataClientId, byte[] data, int sessionId) + throws DataException { + DataClient dataClient = Create(dataClientId, sessionId); + dataClient.writeRawBytesAll(data); + + } + + public static void WriteAll(String dataClientId, byte[] data, + int sessionId, boolean compress) throws DataException { + DataClient dataClient = Create(dataClientId, sessionId); + dataClient.writeRawBytesAll(data, compress); + + } + + public static void WriteAll(String dataClientId, byte[] data, + int sessionId, boolean compress, String[] allowedUsers) throws DataException { + DataClient dataClient = Create(dataClientId, allowedUsers); + dataClient.setDataLifeCycle(new DataLifeCycle(sessionId)); + dataClient.writeRawBytesAll(data, compress); + + } + +} diff --git a/test/TestCase/functiontest/DataClientTest.java b/test/TestCase/functiontest/DataClientTest.java new file mode 100644 index 0000000..738be5a --- /dev/null +++ b/test/TestCase/functiontest/DataClientTest.java @@ -0,0 +1,1485 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.SocketTimeoutException; +import java.security.AccessControlException; +import java.util.Arrays; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.ws.WebServiceException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.exceptions.DataErrorCode; +import com.microsoft.hpc.exceptions.DataException; + +/** + * @author mingqw + * + */ +public class DataClientTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("DataClientTest"); + logger = new Logger(true, true, "DataClientTest"); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + for (String dataClientId : DataClientHelper.CreatedDataClients) { + try { + DataClient.delete(dataClientId, config.Scheduler, + config.UserName, config.Password); + } catch (Exception e) { + // ignore error + } + } + DataClientHelper.CreatedDataClients.clear(); + + } + + @Test(timeout = 600000) + // headnode=NULL + public final void DataClient_API_Create_1() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, null, + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + + logger.End(); + + } + + @Test(timeout = 600000) + // headnode=string.Empty + public final void DataClient_API_Create_2() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, "", config.UserName, + config.Password); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + logger.End(); + + } + + @Test(timeout = 600000) + // headnode is not existed + public final void DataClient_API_Create_3() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, "NotExistHeadNode", + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (WebServiceException e) { + logger.Info("WebException when headnode not exist: %s", e + .getMessage()); + } + logger.End(); + } + + // @Test + // HpcSession is down + // public final void DataClient_API_Create_4() throws IOException, + // InterruptedException + // { + // logger.Info("Test HpcSession of the headnode is down"); + // CommonDataHelper.runCmd(config.Scheduler, config.UserName, + // config.Password, "net", "stop", "HpcSession"); + // try + // { + // DataClient dataClient = DataClientHelper.Create(); + // logger.Error("No error got which is not expected"); + // } + // catch (DataException e) + // { + // // Assert(e.ErrorCode == DataErrorCode.GetDataServerInfoFailure, + // // "Unexpected DataException error code: %s", e.ErrorCode); + // logger.Info("DataException when session launcher is not started: %s", + // e.getMessage()); + // } + // CommonDataHelper.runCmd(config.Scheduler, config.UserName, + // config.Password, "net", "start", "HpcSession"); + // + // } + + @Test(timeout = 600000) + // dataClientId=NULL + public final void DataClient_API_Create_5() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClientHelper.Create(null); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // dataClientId=string.Empty + public final void DataClient_API_Create_6() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClientHelper.Create(""); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // valid dataClientId", + public final void DataClient_API_Create_7() { + logger.Start(); + for (String dataClientId : CommonDataHelper.validDataClientId) { + logger.Info("Try to use DataClientId %s", dataClientId); + try { + DataClient dataClient = DataClientHelper.Create(dataClientId); + dataClient.writeRawBytesAll(CommonDataHelper.simpleCommonData); + byte[] rtn = dataClient.readRawBytesAll(); + logger.assertTrue("Unexpected return of the common data", + Arrays.equals(CommonDataHelper.simpleCommonData, rtn)); + DataClientHelper.Delete(dataClientId); + } catch (Exception e) { + e.printStackTrace(); + logger.Error("Unexpected exception: %s", e.getMessage()); + } + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - invalid dataClientId + public final void DataClient_API_Create_8() { + logger.Start(); + for (String dataClientId : CommonDataHelper.invalidDataClientId) { + try { + logger.Info("Try to use DataClientId %s", dataClientId); + DataClient dataClient = DataClientHelper.Create(dataClientId); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - username=NULL + public final void DataClient_API_Create_9() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + null, config.Password); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - username is empty + public final void DataClient_API_Create_10() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, "", + config.Password); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - password=NULL + public final void DataClient_API_Create_11() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + config.UserName, null); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - password is empty + public final void DataClient_API_Create_12() throws DataException { + logger.Start(); + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + config.UserName, ""); + logger.Error("No error got which is not expected"); + } catch (javax.xml.ws.soap.SOAPFaultException e) { + logger.Info( + "javax.xml.ws.soap.SOAPFaultException got as expected: %s", + e.toString()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Create - create two DataClient with the same name + public final void DataClient_API_Create_13() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClientHelper.Create(); + logger.Error("No error got which is not expected"); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientAlreadyExists + .getCode()); + logger.Info("DataException when data client already exists: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - object is NULL + public final void DataClient_API_WriteRaw_1() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + dataClient.writeRawBytesAll(null); + logger.Error("No error which is not expected."); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - call WriteAll twice + public final void DataClient_API_WriteRaw_2() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(data.bytes); + try { + dataClient.writeRawBytesAll(data.bytes); + logger.Error("No error which is not expected"); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientNotWritable + .getCode()); + logger.Info("DataException when data client already exists: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Should not write with the same dataClientId + // if bind with different session Id + public final void DataClient_API_WriteRaw_6() throws IllegalStateException, + DataException { + logger.Start(); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + DataClient dataClient = DataClientHelper.Create( + CommonDataHelper.defaultDataClientId, 1); + dataClient.writeRawBytesAll(data.bytes); + try { + DataClient dataClient2 = DataClientHelper.Create( + CommonDataHelper.defaultDataClientId, 2); + dataClient2.writeRawBytesAll(data.bytes); + logger.Error("No error which is not expected."); + } catch (DataException e) { + logger.Info("Data exception got: %s", e.getMessage()); + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientAlreadyExists + .getCode()); + + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read before write + public final void DataClient_API_ReadRaw_1() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + byte[] rtn = dataClient.readRawBytesAll(); + } catch (DataException e) { + logger + .assertTrue(String.format( + "Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.NoDataAvailable + .getCode()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Multiple read + public final void DataClient_API_ReadRaw_2() throws IllegalStateException, + DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(data.bytes); + for (int i = 0; i < 10; i++) { + byte[] rtn = dataClient.readRawBytesAll(); + logger.assertTrue("Common data is corrupted", CommonDataHelper + .ValidateCommonDataBytes(rtn, data.md5Hash)); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_4() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(data.bytes); + DataClientHelper.Delete(); + try { + byte[] rtn = dataClient.readRawBytesAll(); + logger.Error("No error which is not expected"); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientDeleted + .getCode()); + + } + logger.End(); + } + + + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_6() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + DataClient dataClient2 = DataClientHelper.Open(); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(data.bytes); + DataClientHelper.Delete(); + try { + byte[] rtn = dataClient2.readRawBytesAll(); + logger.Error("No error which is not expected"); + DataClientHelper.Delete(); + } catch (DataException e) { + logger.Info("DataException got: %s", e.getMessage()); + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.DataClientDeleted + .getCode()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read raw from write raw could be + // serializable + public final void DataClient_API_ReadRaw_7() throws IOException, + DataException, ClassNotFoundException { + logger.Start(); + String object = "test"; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bos); + out.writeObject(object); + out.close(); + byte[] buf = bos.toByteArray(); + + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(buf); + byte[] rtnBytes = dataClient.readRawBytesAll(); + ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream( + rtnBytes)); + String rtn = (String) in.readObject(); + + logger.assertTrue("Common data is corrupted.", rtn.equals("test")); + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_8() throws DataException { + logger.Start(); + byte[] data = new byte[0]; + try { + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(data); + logger.Error("No error which is not expected."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_9() throws DataException { + logger.Start(); + byte[] data = new byte[0]; + try { + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(data, true); + logger.Error("No error which is not expected."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Unauthorized write + public void DataClient_API_WriteRaw_10() throws DataException { + logger.Start(); + byte[] data = new byte[] { 0 }; + try { + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + config.UserName2, config.Password2); + dataClient.writeRawBytesAll(data); + logger.Error("No error which is not expected."); + } catch (AccessControlException e) { + logger.Info("AccessControlException got as expected: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected Exception: %s", e.toString()); + } + DataClient.delete(CommonDataHelper.defaultDataClientId, + config.Scheduler, config.UserName2, config.Password2); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=NULL + public final void DataClient_API_Open_1() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + + try { + DataClient dataClient2 = DataClient.open( + CommonDataHelper.defaultDataClientId, null, + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=string.Empty + public final void DataClient_API_Open_2() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClient.open( + CommonDataHelper.defaultDataClientId, "", config.UserName, + config.Password); + logger.Error("No error got which is not expected"); + } + + catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode is not existed + public final void DataClient_API_Open_3() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClient.open( + CommonDataHelper.defaultDataClientId, "NotExistHeadNode", + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (WebServiceException e) { + logger.Info("WebException when headnode not exist: %s", e + .getMessage()); + } + + DataClientHelper.Delete(); + logger.End(); + } + + // to do + // [TestCase("DataClient_API_Open_4", + // Description = "DataClient.Open - HpcSession of the headnode is down", + // Category = "CommonData")] + // public void DataClient_API_Open_4() + // { + // using (DataClient dataClient = DataClientHelper.Create()) + // { + // Info("Test HpcSession of the headnode is down"); + // ReliabilityHelper.stopService(Config.server, "HpcSession", + // Config.userName, Config.passWord); + // try + // { + // DataClient dataClient2 = DataClient.Open(Config.server, + // CommonDataHelper.defaultDataClientId); + // Error("No error got which is not expected"); + // } + // catch (DataException e) + // { + // Assert(e.ErrorCode == DataErrorCode.GetDataServerInfoFailure, + // "Unexpected DataException error code: %s", e.ErrorCode); + // Info("DataException when session launcher is not started: %s", + // e.Message); + // } + // ReliabilityHelper.startService(Config.server, "HpcSession", + // Config.userName, Config.passWord); + // } + // DataClient.Delete(Config.server, CommonDataHelper.defaultDataClientId); + // } + + @Test(timeout = 600000) + // DataClient.Open - dataClientId=NULL + public final void DataClient_API_Open_5() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClient.open(null, config.Scheduler, + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (NullPointerException e) { + logger.Info("NullPointerException got as expected: %s", e + .getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - dataClientId=string.Empty + public final void DataClient_API_Open_6() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClient.open("", config.Scheduler, + config.UserName, config.Password); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - valid dataClientId + public final void DataClient_API_Open_7() throws DataException { + logger.Start(); + for (String dataClientId : CommonDataHelper.validDataClientId) { + DataClient dataClient = DataClientHelper.Create(dataClientId); + dataClient.writeRawBytesAll(CommonDataHelper.simpleCommonData); + logger.Info("Try to use DataClientId %s", dataClientId); + try { + DataClient dataClient2 = DataClientHelper.Open(dataClientId); + byte[] rtn = dataClient2.readRawBytesAll(); + logger.assertTrue("Unexpected return of the common data", + Arrays.equals(CommonDataHelper.simpleCommonData, rtn)); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + } + DataClientHelper.Delete(); + logger.End(); + + } + + @Test(timeout = 600000) + // DataClient.Open - invalid dataClientId + public void DataClient_API_Open_8() { + + logger.Start(); + for (String dataClientId : CommonDataHelper.invalidDataClientId) { + try { + logger.Info("Try to use DataClientId %s", dataClientId); + DataClient dataClient = DataClientHelper.Open(dataClientId); + logger.Error("No error got which is not expected"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException got as expected: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which does not exist + public final void DataClient_API_Open_9() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + try { + DataClient dataClient2 = DataClientHelper.Open("test"); + logger.Error("No error got which is not expected"); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientNotFound + .getCode()); + logger + .Info( + "DataException when open dataClient which does not exist: %s", + e.getMessage()); + } + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - multiple Open and Read + public final void DataClient_API_Open_10() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + DataClient[] dataClients = new DataClient[10]; + dataClient.writeRawBytesAll(CommonDataHelper.simpleCommonData); + for (int i = 0; i < 10; i++) { + dataClients[i] = DataClientHelper.Open(); + byte[] rtn = (dataClients[i]).readRawBytesAll(); + logger.assertTrue("Common data is corrupted. ", Arrays.equals(rtn, + CommonDataHelper.simpleCommonData)); + } + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which has been closed + public final void DataClient_API_Open_11() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + DataClientHelper.Delete(); + try { + DataClient dataClient2 = DataClientHelper.Open(); + logger.Error("No error got which is not expected"); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientNotFound + .getCode()); + + logger + .Info( + "DataException when open dataClient which does not exist: %s", + e.getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Open - Opened dataClient is read only + public final void DataClient_API_Open_12() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + DataClient dataClient2 = DataClientHelper.Open(); + try { + dataClient2.writeRawBytesAll(CommonDataHelper.simpleCommonData); + } catch (DataException e) { + logger.assertTrue(String + .format("Unexpected DataException error code: %s", e + .getErrorCode()), + e.getErrorCode() == DataErrorCode.DataClientReadOnly + .getCode()); + logger.Info( + "DataException when wrting with a readonly dataClient: %s", + e.getMessage()); + } + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server unreachable + public final void DataClient_SOADataServer_1() throws IOException { + logger.Start(); + if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) + return; + String dataServer = "\\\\NotReachableHN\\DataServer"; + logger.Info("Try CCP_SOADATASERVER=%s", dataServer); + String backup = CommonDataHelper.GetDataServer(); + CommonDataHelper.SetDataServer(dataServer); + try { + DataClient dataClient = DataClientHelper.Create(); + } catch (DataException e) { + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.DataServerUnreachable + .getCode()); + logger + .Info( + "DataException when open dataClient which does not exist: %s", + e.getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + CommonDataHelper.SetDataServer(backup); + logger.End(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server is empty + public final void DataClient_SOADataServer_2() throws IOException { + logger.Start(); + if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) + return; + String dataServer = ""; + logger.Info("Try CCP_SOADATASERVER=%s", dataServer); + String backup = CommonDataHelper.GetDataServer(); + CommonDataHelper.SetDataServer(dataServer); + try { + DataClient dataClient = DataClientHelper.Create(); + } catch (DataException e) { + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.NoDataServerConfigured + .getCode()); + logger + .Info( + "DataException when open dataClient which does not exist: %s", + e.getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + CommonDataHelper.SetDataServer(backup); + logger.End(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - multiple data server path + public final void DataClient_SOADataServer_3() throws IOException { + logger.Start(); + if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) + return; + String backup = CommonDataHelper.GetDataServer(); + logger.Info("Try CCP_SOADATASERVER=%s", backup + ";" + backup); + CommonDataHelper.SetDataServer(backup + ";" + backup); + try { + DataClient dataClient = DataClientHelper.Create(); + } catch (DataException e) { + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.DataServerMisconfigured + .getCode()); + logger.Info("DataException when invalid data server path: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + CommonDataHelper.SetDataServer(backup); + logger.End(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path + public void DataClient_SOADataServer_4() throws IOException { + logger.Start(); + if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) + return; + String dataServer = "!(&*#*#&*#&)#("; + logger.Info("Try CCP_SOADATASERVER=%s", dataServer); + String backup = CommonDataHelper.GetDataServer(); + CommonDataHelper.SetDataServer(dataServer); + try { + DataClient dataClient = DataClientHelper.Create(); + } catch (DataException e) { + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.DataServerMisconfigured + .getCode()); + logger.Info("DataException when invalid data server path: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + CommonDataHelper.SetDataServer(backup); + logger.End(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - local path + public final void DataClient_SOADataServer_5() throws IOException { + logger.Start(); + if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) + return; + String dataServer = "c:\\data"; + logger.Info("Try CCP_SOADATASERVER=%s", dataServer); + String backup = CommonDataHelper.GetDataServer(); + CommonDataHelper.SetDataServer(dataServer); + try { + DataClient dataClient = DataClientHelper.Create(); + } catch (DataException e) { + logger.assertTrue(String.format( + "Unexpected DataException error code: %s", DataErrorCode + .getEnum(e.getErrorCode())), + e.getErrorCode() == DataErrorCode.DataServerMisconfigured + .getCode()); + logger.Info("DataException when invalid data server path: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + CommonDataHelper.SetDataServer(backup); + logger.End(); + } + + + @Test(timeout = 600000) + // DataClient.Delete - Unauthorized delete + public final void DataClient_API_Delete_3() throws IOException, + DataException { + logger.Start(); + try { + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(data.bytes); + int rtn = DataClient_API_Delete_2_Helper(); + logger.assertTrue("Case fail.", rtn == 1); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.Delete - Authorized delete + public final void DataClient_API_Delete_4() throws IOException, + DataException { + logger.Start(); + try { + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + config.UserName, config.Password, + new String[] { config.UserName2 }); + dataClient.writeRawBytesAll(data.bytes); + int rtn = DataClient_API_Delete_2_Helper(); + logger.assertTrue("Case fail.", rtn == 0); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.getMessage()); + } + logger.End(); + } + + public int DataClient_API_Delete_2_Helper() throws DataException { + int rtn = -1; + + try { + DataClient.delete(CommonDataHelper.defaultDataClientId, + config.Scheduler, config.UserName2, config.Password2); + logger.Info("No error for DataClient.Delete"); + rtn = 0; + } catch (AccessControlException e) { + logger.Info("AccessControl got: %s", e.getMessage()); + rtn = 1; + } catch (Exception e) { + logger.Error("Unexpected Exception: %s", e.toString()); + } + DataClientHelper.Delete(); + return rtn; + + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll in compress + public final void DataClient_API_WriteCompress_1() throws DataException { + logger.Start(); + // use good compressible data per bug 12911 + byte[] commonData = new byte[CommonDataHelper.defaultSize]; + for (int i = 0; i < commonData.length; i++) + commonData[i] = 0; + String md5Hash = CommonDataHelper.Md5HashString(commonData); + + DataClient dataClient = DataClientHelper.Create(); + + dataClient.writeRawBytesAll(commonData, true); + byte[] rtn = dataClient.readRawBytesAll(); + long fileSize = CommonDataHelper + .GetCommonDataFileSize(CommonDataHelper.defaultDataClientId); + logger.Info("Common data size: %sB, acutal file size: %sB", + CommonDataHelper.defaultSize, fileSize); + logger.assertTrue("Data does not seem to be compressed.", + fileSize < (long) CommonDataHelper.defaultSize); + CommonDataHelper.ValidateCommonDataBytes(rtn, md5Hash); + DataClientHelper.Delete(); + logger.End(); + + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress + public final void DataClient_API_WriteCompress_2() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(commonData.bytes, false); + byte[] rtn = dataClient.readRawBytesAll(); + long fileSize = CommonDataHelper + .GetCommonDataFileSize(CommonDataHelper.defaultDataClientId); + logger.Info("Common data size: %sB, acutal file size: %sB", + CommonDataHelper.defaultSize, fileSize); + logger.assertTrue("Data does not seem to be compressed.", + fileSize >= (long) CommonDataHelper.defaultSize); + CommonDataHelper.ValidateCommonDataBytes(rtn, commonData.md5Hash); + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress (by default)", + public final void DataClient_API_WriteCompress_3() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(commonData.bytes); + byte[] rtn = dataClient.readRawBytesAll(); + long fileSize = CommonDataHelper + .GetCommonDataFileSize(CommonDataHelper.defaultDataClientId); + logger.Info("Common data size: %sB, acutal file size: %sB", + CommonDataHelper.defaultSize, fileSize); + logger.assertTrue("Data does not seem to be compressed.", + fileSize >= (long) CommonDataHelper.defaultSize); + CommonDataHelper.ValidateCommonDataBytes(rtn, commonData.md5Hash); + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - no data written + public final void DataClient_API_FilePath_1() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + String filePath = dataClient.getStorePath(); + logger.Info("The data file path is %s", filePath); + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data deleted + public final void DataClient_API_FilePath_2() throws DataException { + logger.Start(); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes data = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + dataClient.writeRawBytesAll(data.bytes); + DataClientHelper.Delete(); + logger + .Info("Still should be able to get common data file path after the data is deleted"); + String filePath = dataClient.getStorePath(); + logger.End(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data could be read by simple file solution + public final void DataClient_API_FilePath_3() throws IOException, + DataException, ClassNotFoundException { + logger.Start(); + String object = "test"; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bos); + out.writeObject(object); + out.close(); + byte[] buf = bos.toByteArray(); + DataClient dataClient = DataClientHelper.Create(); + dataClient.writeRawBytesAll(buf); + + dataClient = DataClientHelper.Open(); + String filePath = dataClient.getStorePath(); + logger.Info("The data file path is %s", filePath); + + File file = new File(filePath); + InputStream is = new FileInputStream(file); + byte[] bytes = new byte[(int) file.length()]; + + // Read in the bytes + int offset = 0; + int numRead = 0; + while (offset < bytes.length + && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { + offset += numRead; + } + + // Ensure all the bytes have been read in + if (offset < bytes.length) { + throw new IOException("Could not completely read file " + + file.getName()); + } + + // Close the input stream and return bytes + is.close(); + ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream( + bytes)); + String rtn = (String) in.readObject(); + + logger.assertTrue("Common data is corrupted.", rtn.equals("test")); + + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // DataSecurity - Unauthorized read (by default) + public final void DataClient_API_DataSecurity_2() throws DataException { + logger.Start(); + byte[] data = new byte[] { 0 }; + DataClient dataClient = DataClient.create( + CommonDataHelper.defaultDataClientId, config.Scheduler, + config.UserName2, config.Password2); + try { + dataClient.readRawBytesAll(); + } catch (AccessControlException e) { + logger.Info("AccessControlException got as expected: %s", e + .getMessage()); + } catch (Exception e) { + logger.Error("Unexpected Exception: %s", e.toString()); + } + DataClient.delete(CommonDataHelper.defaultDataClientId, + config.Scheduler, config.UserName2, config.Password2); + logger.End(); + + } + + @Test(timeout = 600000) + // DataSecurity - Authorized read for another user + public final void DataClient_API_DataSecurity_4() throws DataException, + SocketTimeoutException, SessionException, + DatatypeConfigurationException { + logger.Start(); + SessionStartInfo ssi = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + ssi.setRunAsUsername(config.UserName2); + ssi.setRunAsPassword(config.Password2); + CommonDataHelper.SimpleSendGetCommonData(logger, ssi, 10, false); + logger.End(); + } + + @Test(timeout = 600000) + // Concurrency write + public final void DataClient_Concurrency_1() throws InterruptedException, + BrokenBarrierException, DataException { + logger.Start(); + final int total = 100; + final CyclicBarrier evt = new CyclicBarrier(total + 1); + final AtomicInteger success = new AtomicInteger(0); + for (int i = 0; i < total; i++) { + Runnable runnable = new Runnable() { + public void run() { + logger.Info("Thread starts to run."); + try { + logger.Info("Try to create DataClient in thread"); + DataClient dataClient = DataClientHelper.Create(); + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(CommonDataHelper.defaultSize); + logger.Info("Try to write data in thread"); + dataClient.writeRawBytesAll(commonData.bytes); + logger.Info("Try to read data in thread"); + byte[] rtn = dataClient.readRawBytesAll(); + CommonDataHelper.ValidateCommonDataBytes(rtn, + commonData.md5Hash); + success.addAndGet(1); + } catch (DataException e) { + logger.Info("Catch DataException in thread"); + logger + .assertTrue( + String + .format( + "Unexpected data error code: %s", + DataErrorCode + .getEnum(e + .getErrorCode())), + e.getErrorCode() == DataErrorCode.DataClientAlreadyExists + .getCode()); + } finally { + try { + evt.await(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BrokenBarrierException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + Thread thread = new Thread(runnable); + thread.start(); + } + evt.await(); + logger + .assertTrue( + String + .format( + "Unexpected success time: %s when total %s try to create/write with the same dataClientId.", + success, total), success.get() == 1); + DataClientHelper.Delete(); + logger.End(); + } + + @Test(timeout = 600000) + // Concurrency read and close + public final void DataClient_Concurrency_2() throws InterruptedException, + BrokenBarrierException { + logger.Start(); + DataClient_Concurrency_2_Helper(CommonDataHelper.defaultDataClientId, + false, 100); + logger.End(); + } + + class DataClient_Concurrency_3_Helper_Class { + CyclicBarrier evt; + String dataClientId; + + public DataClient_Concurrency_3_Helper_Class(CyclicBarrier _evt, + String _dataClientId) { + evt = _evt; + dataClientId = _dataClientId; + } + + public void QueueWorkerItem() { + Runnable runnable = new Runnable() { + public void run() { + try { + DataClient_Concurrency_2_Helper(dataClientId, false, 10); + evt.await(); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (BrokenBarrierException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + + } + } + }; + Thread thread = new Thread(runnable); + thread.start(); + } + } + + @Test(timeout = 600000) + // Concurrency create, write, read and close + public final void DataClient_Concurrency_3() throws InterruptedException, + BrokenBarrierException { + logger.Start(); + int totalDataClient = 10; + final CyclicBarrier evt = new CyclicBarrier(totalDataClient + 1); + int totalDataClientFinished = 0; + for (int i = 0; i < totalDataClient; i++) { + DataClient_Concurrency_3_Helper_Class worker = new DataClient_Concurrency_3_Helper_Class( + evt, String.valueOf(i)); + worker.QueueWorkerItem(); + } + evt.await(); + logger.End(); + } + + class DataClient_Concurrency_2_Helper_Class { + boolean concurrentCreateOpen; + int run; + String md5Hash; + String dataClientId; + CyclicBarrier evt; + + public DataClient_Concurrency_2_Helper_Class( + boolean _concurrentCreateOpen, int _run, String _md5Hash, + String _dataClientId, CyclicBarrier _evt) { + concurrentCreateOpen = _concurrentCreateOpen; + run = _run; + md5Hash = _md5Hash; + dataClientId = _dataClientId; + evt = _evt; + } + + public void QueueWorkItem() { + Thread t; + Runnable runnable = null; + if (concurrentCreateOpen && run == 0) { + runnable = new Runnable() { + public void run() { + try { + logger.Info("Thread starts to run."); + logger.Info("Try to create DataClient in thread"); + DataClient dataClient = DataClientHelper + .Create(dataClientId); + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(5 * 1024 * 1024); + dataClient.writeRawBytesAll(commonData.bytes); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e + .toString()); + } finally { + try { + evt.await(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BrokenBarrierException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + } else { + runnable = new Runnable() { + public void run() { + byte[] rtn = null; + logger.Info("Thread starts to run."); + try { + logger.Info("Try to open DataClient in thread"); + DataClient dataClient = DataClient.open( + dataClientId, config.Scheduler, + config.UserName, config.Password); + try { + rtn = dataClient.readRawBytesAll(); + } catch (DataException e) { + logger + .Info("Catch DataException in thread for DataClient.Read"); + boolean assertResult = false; + if (concurrentCreateOpen) { + assertResult = (e.getErrorCode() == DataErrorCode.DataInconsistent + .getCode() | e.getErrorCode() == DataErrorCode.DataClientBeingCreated + .getCode()); + } else { + assertResult = (e.getErrorCode() == DataErrorCode.DataInconsistent + .getCode() | e.getErrorCode() == DataErrorCode.DataClientDeleted + .getCode()); + } + logger + .assertTrue( + String + .format( + "Unexpected data error code for DataClient.Read: %s,%s", + DataErrorCode + .getEnum(e + .getErrorCode()), + e.getMessage()), + assertResult); + } + try { + DataClientHelper.Delete(dataClientId); + } catch (DataException e) { + logger + .Info("Catch DataException in thread for DataClient.Delete"); + logger + .assertTrue( + String + .format( + "Unexpected data error code for DataClient.Delete: %s,%s", + DataErrorCode + .getEnum(e + .getErrorCode()), + e.getMessage()), + e.getErrorCode() == DataErrorCode.DataClientBusy + .getCode()); + } + } catch (DataException e) { + logger + .Info("Catch DataException in thread for DataClient.Open"); + logger + .assertTrue( + String + .format( + "Unexpected data error code for DataClient.Open: %s,%s", + DataErrorCode + .getEnum(e + .getErrorCode()), + e.getMessage()), + e.getErrorCode() == DataErrorCode.DataClientNotFound + .getCode() + | e.getErrorCode() == DataErrorCode.DataClientBusy + .getCode()); + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e + .toString()); + } + try { + if (rtn != null) + CommonDataHelper.ValidateCommonDataBytes(rtn, + md5Hash); + } catch (Exception e) { + logger + .Error( + "Unexpected exception when validating data: %s", + e.toString()); + } finally { + try { + evt.await(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BrokenBarrierException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + } + t = new Thread(runnable); + t.start(); + } + } + + private void DataClient_Concurrency_2_Helper(String dataClientId, + boolean concurrentCreateOpen, int totalThread) + throws InterruptedException, BrokenBarrierException { + String md5Hash = null; + if (!concurrentCreateOpen) { + try { + DataClient dataClient = DataClientHelper.Create(dataClientId); + CommonDataBytes commonData = CommonDataHelper + .GenerateCommonDataBytes(5 * 1024 * 1024); + md5Hash = commonData.md5Hash; + dataClient.writeRawBytesAll(commonData.bytes); + + } catch (Exception e) { + logger.Error("Unexpected exception: %s", e.toString()); + } + } + final CyclicBarrier evt = new CyclicBarrier(totalThread + 1); + for (int i = 0; i < totalThread; i++) { + int run = i; + DataClient_Concurrency_2_Helper_Class worker = new DataClient_Concurrency_2_Helper_Class( + concurrentCreateOpen, run, md5Hash, dataClientId, evt); + worker.QueueWorkItem(); + } + evt.await(); + } + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/DurableSessionTest.java b/test/TestCase/functiontest/DurableSessionTest.java new file mode 100644 index 0000000..426cf77 --- /dev/null +++ b/test/TestCase/functiontest/DurableSessionTest.java @@ -0,0 +1,1284 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.net.SocketTimeoutException; + +import javax.xml.ws.WebServiceException; +import javax.xml.xpath.XPathExpressionException; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import org.tempuri.GenerateLoad; +import org.tempuri.GenerateLoadResponse; + +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.BrokerResponse; +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.SessionAttachInfo; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.Version; +import com.microsoft.hpc.sessionlauncher.ISessionLauncherGetServiceVersionsSessionFaultFaultFaultMessage; +import com.microsoft.hpc.sessionlauncher.SessionInfo; + +/** + * @author yutongs + * + */ +public class DurableSessionTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("DurableSessionTest"); + logger = new Logger(true, true, "DurableSessionTest"); + HpcJava.setUsername(config.UserName); + HpcJava.setPassword(config.Password); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.DurableSession#DurableSession(com.microsoft.hpc.sessionlauncher.SessionInfo, java.lang.String)} + * . + */ + @Ignore + public final void testDurableSession() { + // DurableSession ds = new DurableSession(null, null); //it is invisible + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.DurableSession#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfo() { + logger.Start("testCreateSessionSessionStartInfo"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } + + // boundary + try { + dSession = DurableSession.createSession(null); + logger.Error("Exception is not thrown."); + } catch (NullPointerException e) { + logger.Info("Exception is thrown when creating a durable session"); + + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + logger.Error("SocketTimeoutException was thrown", e); + } catch (SessionException e) { + // TODO Auto-generated catch block + + logger.Error("SessionException was thrown", e); + } + + SessionStartInfo info2 = new SessionStartInfo(config.Scheduler, + config.ServiceName); + + try { + dSession = DurableSession.createSession(info2); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + logger.Error("SocketTimeoutException was thrown", e); + } catch (SessionException e) { + // TODO Auto-generated catch block + + logger.Error("SessionException was thrown", e); + } finally { + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + } + + // more boundary test case for invalid startInfo would be included in + // SessionStartInfo test + + logger.End("testCreateSessionSessionStartInfo"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.DurableSession#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo, int)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfoInt() { + logger.Start("testCreateSessionSessionStartInfoInt"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + try { + dSession = DurableSession.createSession(info, 0); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + // boundary + + try { + dSession = DurableSession.createSession(info, -1); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session", e); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession = DurableSession.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession = DurableSession.createSession(info, Integer.MIN_VALUE); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + logger.End("testCreateSessionSessionStartInfoInt"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.DurableSession#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfoInt() { + logger.Start("testAttachSessionSessionAttachInfoInt"); + + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + dSession.getId(), config.UserName, config.Password); + + DurableSession dSession_attached = null; + try { + dSession_attached = DurableSession.attachSession(attachInfo, 5000); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("SessionException when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, -1); + logger.Error("EE is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, 1); + logger.Error("EE is not thrown."); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session", e1); + + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, + Integer.MIN_VALUE); + logger.Error("EE is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + logger.End("testAttachSessionSessionAttachInfoInt"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.DurableSession#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfo() { + // BUG there is exception thrown for this interface + // TODO change the following test code in this case + + logger.Start("testAttachSessionSessionAttachInfo"); + + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + dSession.getId(), config.UserName, config.Password); + + DurableSession dSession_attached = null; + try { + dSession_attached = DurableSession.attachSession(attachInfo); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session", e1); + + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession_attached = DurableSession.attachSession(null); + logger.Error("EE is not thrown."); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (NullPointerException e1) { + logger.Info("NullPointerException when attaching a durable session", e1); + + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session", e1); + + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + logger.End("testAttachSessionSessionAttachInfo"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getTraceSourceName()} + * . + */ + @Ignore + public final void testGetTraceSourceName() { + + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEventSource()}. + */ + @Ignore + public final void testGetEventSource() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#SessionBase(com.microsoft.hpc.sessionlauncher.SessionInfo, java.lang.String)} + * . + */ + @Ignore + public final void testSessionBase() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getInfo()}. + */ + @Ignore + public final void testGetInfo() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. + */ + @Test + public final void testGetId() { + logger.Start("testGetId"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + logger.assertTrue("Session id should be greater than 0", + dSession.getId() > 0); + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + logger.End("testGetId"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} + * . + */ + @Test + public final void testGetEndpointReference() { + + logger.Start("testGetEndpointReference"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + logger.Info("EPR is %s", dSession.getEndpointReference()); + logger.assertTrue("Session EPR", dSession.getEndpointReference() + .contains("http")); + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + logger.End("testGetEndpointReference"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getClientVersion()} + * . + */ + @Test + public final void testGetClientVersion() { + + logger.Start("testGetClientVersion"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getClientVersion(); + logger.Info(v.toString()); + logger.assertEqual("DurableSession clientVersion major", v.getMajor(), + 4); + logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), + 0); + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + logger.End("testGetClientVersion"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getServerVersion()} + * . + */ + @Test + public final void testGetServerVersion() { + //Bug 13405 + + logger.Start("testGetServerVersion"); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getServerVersion(); + logger.Info(v.toString()); + logger.assertEqual("DurableSession serverVersion major", v.getMajor(), + 4); + //logger.assertEqual("DurableSession serverVersion minor", v.getMinor(), + // 2); // BUG to check if the server Version + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + logger.End("testGetServerVersion"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#createSessionInternal(com.microsoft.hpc.scheduler.session.SessionStartInfo, int, java.lang.Boolean)} + * . + */ + @Ignore + public final void testCreateSessionInternalSessionStartInfoIntBoolean() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#dispose()}. + */ + @Ignore + public final void testDispose() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#createSessionInternal(com.microsoft.hpc.scheduler.session.SessionStartInfo, com.microsoft.hpc.scheduler.session.Timeout, java.lang.Boolean)} + * . + */ + @Ignore + public final void testCreateSessionInternalSessionStartInfoTimeoutBoolean() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close()}. + */ + @Test + public final void testClose() { + logger.Start("testClose"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + // boundary + // close the session twice + try { + dSession.close(); + logger.Info("E should not be thrown"); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + logger.End("testClose"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(java.lang.Boolean)} + * . + */ + @Test + public final void testCloseBoolean() { + + logger.Start("testCloseBoolean"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + int sessionId = 0; + int refId = Util.generateRandomInteger(); + try { + session = DurableSession.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(); + // close the session without purge + session.close(false); + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = DurableSession.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID() == refId); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + // close the session without purge + session.close(false); + + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + + try { + session = DurableSession.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client.getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID() == refId); + // logger.assertEqual("check whole string", reply, + // "SHPC-00421001:Java BVT"); + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + session.close(); + + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + } + + logger.End("testCloseBoolean"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + + logger.Start("testCloseBooleanInt"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + DurableSession dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(true, 5000); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(true, 0); + + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + // boundary + + dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(true, -1); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session", e); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession.close(true, 1); + logger.Error("EE is not thrown"); + } catch (SessionException e) { + logger.Info("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Info("Session exception when creating a durable session", e); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession.close(true, Integer.MIN_VALUE); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + + } catch (Throwable e) { + logger.Error("UE when creating a durable session", e); + + } + + try { + dSession.close(false, Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + logger.End("testCloseBooleanInt"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#attachInternal(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} + * . + */ + @Ignore + public final void testAttachInternalSessionAttachInfoInt() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#attachInternal(com.microsoft.hpc.scheduler.session.SessionAttachInfo, com.microsoft.hpc.scheduler.session.Timeout)} + * . + */ + @Ignore + public final void testAttachInternalSessionAttachInfoTimeout() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getTimeout(java.util.Date)} + * . + */ + @Ignore + public final void testGetTimeout() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#checkCredential(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Ignore + public final void testCheckCredential() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testGetServiceVersions() { + logger.Start("testGetServiceVersions"); + try { + logger.assertEqual("ccpechosvc version", DurableSession + .GetServiceVersions(config.Scheduler, config.ServiceName, + config.UserName, config.Password)[0].toString(), + "3.2"); + } catch (SessionException e) { + logger.Error("Session exception", e); + + } + + // get other service name + String serviceName = config.getValue("ServiceName"); + if (serviceName != "") { + try { + Version[] vers = DurableSession.GetServiceVersions( + config.Scheduler, serviceName, config.UserName, + config.Password); + for (Version ver : vers) { + logger.Info(ver.toString()); + } + + } catch (SessionException e) { + logger.Error("Session exception", e); + + } + + } + + // boundary + Version[] versions = null; + + try { + versions = DurableSession.GetServiceVersions("", + config.ServiceName, config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException is thrown"); + + } catch (SessionException e) { + logger.Info("SessionException is thrown"); + + } + + try { + versions = DurableSession.GetServiceVersions("abcxyz087879", + config.ServiceName, config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (WebServiceException e) { + logger.Info("WebServiceException is thrown", e); + + } catch (SessionException e) { + logger.Error("SessionException is thrown", e); + + } + + try { + versions = DurableSession.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException is thrown"); + + } catch (SessionException e) { + logger.Error("SessionException is thrown", e); + + } + + try { + versions = DurableSession.GetServiceVersions(config.Scheduler, + "abcxyz2329083", config.UserName, config.Password); + logger.assertEqual("versions", versions.length, 0); + } catch (IllegalArgumentException e) { + logger.Error("IllegalArgumentException is thrown", e); + + } catch (SessionException e) { + logger.Error("SessionException is thrown", e); + + } + + logger.End("testGetServiceVersions"); + + } + + /** + * Test method for {@link java.lang.Object#Object()}. + */ + @Ignore + public final void testObject() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#getClass()}. + */ + @Ignore + public final void testGetClass() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#hashCode()}. + */ + @Ignore + public final void testHashCode() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#equals(java.lang.Object)}. + */ + @Ignore + public final void testEquals() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#clone()}. + */ + @Ignore + public final void testClone() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#toString()}. + */ + @Ignore + public final void testToString() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#notify()}. + */ + @Ignore + public final void testNotify() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#notifyAll()}. + */ + @Ignore + public final void testNotifyAll() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait(long)}. + */ + @Ignore + public final void testWaitLong() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait(long, int)}. + */ + @Ignore + public final void testWaitLongInt() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#wait()}. + */ + @Ignore + public final void testWait() { + // we do not test it here + } + + /** + * Test method for {@link java.lang.Object#finalize()}. + */ + @Ignore + public final void testFinalize() { + // we do not test it here + } + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/GenericServiceTest.java b/test/TestCase/functiontest/GenericServiceTest.java new file mode 100644 index 0000000..fffa56b --- /dev/null +++ b/test/TestCase/functiontest/GenericServiceTest.java @@ -0,0 +1,230 @@ +/** + * + */ +package functiontest; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.concurrent.*; + +import javax.xml.bind.JAXBElement; +import javax.xml.soap.SOAPException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.apache.cxf.common.util.Base64Utility; +import org.apache.xml.security.utils.Base64; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; + +import com.microsoft.hpc.genericservice.*; +import com.microsoft.hpc.genericservice.ObjectFactory; +import com.microsoft.hpc.scheduler.session.*; +import java.io.*; +/** + * @author yutongs + * + */ +public class GenericServiceTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("GenericService"); + logger = new Logger(true, true, "GenericService"); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + // todo: check if the target cluster is in ready state + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + // todo: cleanup work for each case + } + + /** + * create a durable session, send requests and get responses + */ + + @Test + public void test_DurableGenericService() { + + logger.Start("test_DurableGenericService"); + String serviceName = config.getValue("ServiceName"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + serviceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", serviceName); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient(session, GenericService.class); + logger.Info("Sending generic operation requests..."); + + ObjectFactory of = new ObjectFactory(); + GenericOperation request = new GenericOperation(); + + + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + DataOutputStream doo = new DataOutputStream(bo); + doo.writeInt(0); // high byte first which is different with .net one + doo.writeInt(0); + doo.flush(); + bo.flush(); + + String bs = Base64.encode(bo.toByteArray()); + logger.Info(bs); + bo.close(); + request.setArgs(of.createGenericOperationArgs(bs)); + + client.sendRequest(request,1); + + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(GenericOperationResponse.class)) { + try { + String reply = response.getResult().getGenericOperationResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + + } catch (Throwable ex) { + logger.Error("Error in process request", ex); + + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + logger.End("test_DurableGenericService"); + + } + + + + /** + * create a durable session, send requests and get responses - boundary case + */ + + @Test + public void test_DurableGenericService_2() { + + logger.Start("test_DurableGenericService"); + String serviceName = config.getValue("ServiceName"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + serviceName, config.UserName, config.Password); + logger.Info("Creating a %s durable session.", serviceName); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient(session, GenericService.class); + logger.Info("Sending generic operation requests..."); + + ObjectFactory of = new ObjectFactory(); + GenericOperation request = new GenericOperation(); + + + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + DataOutputStream doo = new DataOutputStream(bo); + doo.writeInt(1); // high byte first which is different with .net one + doo.writeChars("hello"); + doo.flush(); + bo.flush(); + String bs = Base64.encode(bo.toByteArray()); + logger.Info(bs); + bo.close(); + request.setArgs(of.createGenericOperationArgs(bs)); + + client.sendRequest(request,1); + + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(GenericOperationResponse.class)) { + try { + String reply = response.getResult().getGenericOperationResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + + } catch (SOAPFaultException ee){ + logger.Info("EE is thrown. ", ee); + + } + catch (Throwable ee) { + logger.Error("Error in process request ", ee); + + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + logger.End("test_DurableGenericService"); + + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/Logger.java b/test/TestCase/functiontest/Logger.java new file mode 100644 index 0000000..9101880 --- /dev/null +++ b/test/TestCase/functiontest/Logger.java @@ -0,0 +1,296 @@ +/** + * + */ +package functiontest; + +import static java.lang.System.out; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.io.*; +import static org.junit.Assert.*; + +/** + * @author yutongs + * + */ +public class Logger { + + public Logger() { + + } + + public Logger(boolean toScreen, boolean toFile, String fileName) + throws IOException { + this.toScreen = toScreen; + if (toFile) { + this.toFile = true; + UUID uuid = UUID.randomUUID(); + this.fileName = fileName + "_" + uuid.toString() + ".testdata"; + outPrint = new PrintWriter(new FileWriter(this.fileName), true); + + } + } + + public void Start() { + String message = Thread.currentThread().getStackTrace()[2].getMethodName(); + Start(message); + } + + + public void Start(String message) { + String time = "[" + df.format(new Date()) + "]"; + message = "[Start]" + time + message; + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + errCount = 0; + + } + + public void Start(String fmt, Object... args) { + String time = "[" + df.format(new Date()) + "]"; + String message = String.format("[Start]" + time + fmt, args); + if (toScreen) { + out.println(message); + } + if (toFile) { + outPrint.println(message); + } + errCount = 0; + + } + + public void Info(String message) { + String time = "[" + df.format(new Date()) + "]"; + message = "[Info]" + time + message; + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + } + + public void Info(Object messageObj) { + String time = "[" + df.format(new Date()) + "]"; + String message = "[Info]" + time + messageObj.toString(); + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + } + + public void Info(String fmt, Object... args) { + String time = "[" + df.format(new Date()) + "]"; + String message = String.format("[Info]" + time + fmt, args); + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + } + + public void Info(String message, Throwable e){ + String time = "[" + df.format(new Date()) + "]"; + message = "[Info]" + time+ message ; + if (toScreen) + { + out.print(message); + e.printStackTrace(out); + } + if (toFile) + { + outPrint.print(message); + e.printStackTrace(outPrint); + } + + } + + public void Info(Throwable e){ + String time = "[" + df.format(new Date()) + "]"; + String message = "[Error]" + time ; + if (toScreen) + { + out.print(message); + e.printStackTrace(out); + } + if (toFile) + { + outPrint.print(message); + e.printStackTrace(outPrint); + } + // fail the test case if Error happened + // fail(message); + errCount++; + } + + public void Error(String message) { + String time = "[" + df.format(new Date()) + "]"; + message = "[Error]" + time + message; + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + // fail the test case if Error happened + // fail(message); + errCount++; + + } + + public void Error(String fmt, Object... args) { + String time = "[" + df.format(new Date()) + "]"; + String message = String.format("[Error]" + time + fmt, args); + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + // fail the test case if Error happened + // fail(message); + errCount++; + } + + public void Error(String message, Throwable e){ + String time = "[" + df.format(new Date()) + "]"; + message = "[Error]" + time+ message ; + if (toScreen) + { + out.print(message); + e.printStackTrace(out); + } + if (toFile) + { + outPrint.print(message); + e.printStackTrace(outPrint); + } + // fail the test case if Error happened + // fail(message); + errCount++; + } + + public void Error(Throwable e){ + String time = "[" + df.format(new Date()) + "]"; + String message = "[Error]" + time ; + if (toScreen) + { + out.print(message); + e.printStackTrace(out); + } + if (toFile) + { + outPrint.print(message); + e.printStackTrace(outPrint); + } + // fail the test case if Error happened + // fail(message); + errCount++; + } + + public void Warning(String message) { + String time = "[" + df.format(new Date()) + "]"; + message = "[Warning]" + time + message; + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + } + + public void Warning(String fmt, Object... args) { + String time = "[" + df.format(new Date()) + "]"; + String message = String.format("[Warning]" + time + fmt, args); + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + } + + public void End() { + String message = Thread.currentThread().getStackTrace()[2].getMethodName(); + End(message); + } + + public void End(String message) { + + String time = "[" + df.format(new Date()) + "]"; + if (errCount > 0) { + message = "[End]" + time + " Fail (" + errCount + " error(s)) " + + message; + } else { + message = "[End]" + time + " Pass " + message; + } + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + if (errCount > 0) { + fail(message); + } + } + + public void End(String fmt, Object... args) { + String time = "[" + df.format(new Date()) + "]"; + String message; + if (errCount > 0) { + message = String.format("[End]" + time + " Fail (" + errCount + + " error(s)) " + fmt, args); + } else { + message = String.format("[End]" + time + " Pass " + fmt, args); + } + + if (toScreen) + out.println(message); + if (toFile) + outPrint.println(message); + if (errCount > 0) { + fail(message); + } + } + + public void assertTrue(String message, boolean isTrue) { + if (!isTrue) { + Error("AssertTrue fail. " + message); + } + } + + public void assertEqual(String message, T a, T b) { + if (a != null && !a.equals(b)) { + if (b != null) { + Error("AsserEqual fail. " + message + " <" + a.toString() + + "><" + b.toString() + "> "); + } else { + Error("AsserEqual fail. " + message + " <" + a.toString() + + "> "); + } + } else if (a == null && b != null) { + Error("AsserEqual fail. " + message + " <" + b.toString() + + "> "); + } + + } + + public void assertNotNull(String message, Object a) { + if (a == null) { + Error("AsserNotNull fail. " + message); + } + + } + + public void assertNull(String message, Object a) { + if (a != null) { + Error("AsserNotNull fail. " + message); + } + + } + + public void close() { + if (toFile) { + outPrint.close(); + } + } + + private boolean toScreen = true; + private boolean toFile = false; + private String fileName = null; + private PrintWriter outPrint = null; + private SimpleDateFormat df = new SimpleDateFormat("MM-dd HH:mm:ss.SSS"); + private int errCount = 0; + +} diff --git a/test/TestCase/functiontest/SessionAttachInfoTest.java b/test/TestCase/functiontest/SessionAttachInfoTest.java new file mode 100644 index 0000000..747e409 --- /dev/null +++ b/test/TestCase/functiontest/SessionAttachInfoTest.java @@ -0,0 +1,177 @@ +/** + * + */ +package functiontest; + +import java.net.SocketTimeoutException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionAttachInfo; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; + +/** + * @author yutongs + * + */ +public class SessionAttachInfoTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("SessionAttachInfoTest"); + logger = new Logger(true, true, "SessionAttachInfoTest"); + + // init sessions and clients + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSessionIdleTimeout(Integer.MAX_VALUE); + info.setClientIdleTimeout(Integer.MAX_VALUE); + + dSession = DurableSession.createSession(info); + iSession = Session.createSession(info); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + dSession.close(); + iSession.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int)} + * . + */ + @Test + public final void testSessionAttachInfoStringInt() { + logger.Start(); + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + 1, config.UserName, config.Password); + try { + logger.assertEqual("hn", attachInfo.getHeadnode(), config.Scheduler); + logger.assertEqual("id", attachInfo.getId(), 1); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int, java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionAttachInfoStringIntStringString() { + logger.Start(); + int sessionId = dSession.getId(); + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + logger.assertEqual("hn", attachInfo.getHeadnode(), config.Scheduler); + logger.assertEqual("id", attachInfo.getId(), sessionId); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + DurableSession dSession_attached = null; + try { + dSession_attached = DurableSession.attachSession(attachInfo); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session", e1); + + } + + // boundary + try { + attachInfo = new SessionAttachInfo("", 0, "", ""); + dSession_attached = DurableSession.attachSession(attachInfo); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e1) { + logger.Info("Invalid sessionAttachInfo when attaching a durable session"); + + } catch (Exception e1) { + logger.Error("Invalid sessionAttachInfo when attaching a durable session", e1); + + } + + attachInfo = new SessionAttachInfo(config.Scheduler, 0, + config.UserName, config.Password); + try { + dSession_attached = DurableSession.attachSession(attachInfo); + logger.Error("EE is not thrown"); + } catch (Exception e1) { + logger.Info("Invalid sessionAttachInfo when attaching a durable session"); + + } + + attachInfo = new SessionAttachInfo(config.Scheduler, -1, "", ""); + try { + dSession_attached = DurableSession.attachSession(attachInfo); + logger.Error("EE is not thrown"); + } catch (Exception e1) { + logger.Info("Invalid sessionAttachInfo when attaching a durable session"); + + } + + attachInfo = new SessionAttachInfo(config.Scheduler, Integer.MAX_VALUE, + "abc", "xyz"); + try { + dSession_attached = DurableSession.attachSession(attachInfo); + logger.Error("EE is not thrown"); + } catch (Exception e1) { + logger.Info("Invalid sessionAttachInfo when attaching a durable session"); + + } + + logger.End(); + + } + + private static Session iSession = null; + private static DurableSession dSession = null; + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/SessionBaseTest.java b/test/TestCase/functiontest/SessionBaseTest.java new file mode 100644 index 0000000..676feb0 --- /dev/null +++ b/test/TestCase/functiontest/SessionBaseTest.java @@ -0,0 +1,464 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.net.SocketTimeoutException; + +import javax.xml.ws.WebServiceException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionBase; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.Version; +import com.microsoft.hpc.sessionlauncher.ISessionLauncherGetServiceVersionsSessionFaultFaultFaultMessage; + +/** + * @author yutongs + * + */ +public class SessionBaseTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("SessionBaseTest"); + logger = new Logger(true, true, "SessionBaseTest"); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. + */ + @Test + public final void testGetId() { + logger.Start(); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase sb = null; + try { + sb = DurableSession.createSession(info); + logger.Info("Session id %d", sb.getId()); + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + sb = Session.createSession(info); + logger.Info("Session id %d", sb.getId()); + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} + * . + */ + @Test + public final void testGetEndpointReference() { + logger.Start(); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase sb = null; + try { + sb = DurableSession.createSession(info); + logger.Info("EPR is %s", sb.getEndpointReference()); + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + sb = Session.createSession(info); + logger.Info("EPR is %s", sb.getEndpointReference()); + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getClientVersion()} + * and + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getServerVersion()} + * . + */ + @Test + public final void testGetClientVersion() { + logger.Start(); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase sb = null; + try { + sb = DurableSession.createSession(info); + logger.assertEqual("client version", sb.getClientVersion() + .toString(), "4.0"); + /* logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("4")); + + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + sb = Session.createSession(info); + logger.assertEqual("client version", sb.getClientVersion() + .toString(), "4.0"); + /*logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ + logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("4")); + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#checkSessionStartInfo(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Ignore + public final void testCheckSessionStartInfo() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#dispose()}. + */ + @Ignore + public final void testDispose() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(java.lang.Boolean)} + * . + */ + @Test + public final void testCloseBoolean() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase session = null; + try { + session = DurableSession.createSession(info); + session.close(true); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + session = Session.createSession(info); + session.close(false); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + SessionBase session = null; + try { + session = DurableSession.createSession(info); + session.close(true, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + session = Session.createSession(info); + session.close(true, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + session = Session.createSession(info); + session.close(true, 0); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + session.close(false, -1000); + logger.Error("EE is not thrown"); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session", e); + + } + + try { + session.close(true, 1); + logger.Error("EE is not thrown 1"); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } catch (IllegalArgumentException e) { + logger.Error("IllegalArgumentException when creating a durable session", e); + + } + + try { + session.close(false, Integer.MIN_VALUE); + logger.Error("EE is not thrown"); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session", e); + + } + + try { + session.close(true, Integer.MAX_VALUE); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("IllegalArgumentException when creating a durable session", e); + + } + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testGetServiceVersions() { + logger.Start(); + + try { + logger.assertEqual("ccpechosvc version", SessionBase + .GetServiceVersions(config.Scheduler, config.ServiceName, + config.UserName, config.Password)[0].toString(), + "3.2"); + } catch (SessionException e) { + logger.Error("Session exception", e); + + } + + // get other service name + String serviceName = config.getValue("ServiceName"); + + if (serviceName != "") { + try { + Version[] vers = SessionBase.GetServiceVersions( + config.Scheduler, serviceName, config.UserName, + config.Password); + for (Version ver : vers) { + logger.Info(ver.toString()); + } + + } catch (SessionException e) { + logger.Error("Session exception", e); + + } + + } + + // boundary + Version[] versions = null; + + try { + versions = SessionBase.GetServiceVersions("", config.ServiceName, + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException is thrown"); + + } catch (SessionException e) { + logger.Error("UE is thrown", e); + + } + + try { + versions = SessionBase.GetServiceVersions("abcxyz087879", + config.ServiceName, config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (WebServiceException e) { + logger.Info("SessionException is thrown"); + + } catch (SessionException e) { + logger.Error("SessionException is thrown", e); + + } + + try { + versions = SessionBase.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("SessionException is thrown"); + + } catch (SessionException e) { + logger.Error("SessionException is thrown", e); + + } + + try { + versions = SessionBase.GetServiceVersions(config.Scheduler, + "abcxyz2329083", config.UserName, config.Password); + logger.assertEqual("empty versions", versions.length, 0); + // logger.Error("EE is not thrown"); + } catch (SessionException e) { + logger.Info("SessionException is thrown"); + + } + logger.End(); + } + + /** + * Test method for NoServiceVersion + */ + @Test + public final void testNoServiceVersion() { + logger.Start(); + logger.assertEqual("noServiceVersion", SessionBase.NoServiceVersion, new Version(0,0)); + logger.End(); + } + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/SessionPool.java b/test/TestCase/functiontest/SessionPool.java new file mode 100644 index 0000000..6ac0643 --- /dev/null +++ b/test/TestCase/functiontest/SessionPool.java @@ -0,0 +1,589 @@ +/** + * + */ +package functiontest; + +import java.net.SocketTimeoutException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.xml.soap.SOAPException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import org.tempuri.AITestLibService; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import com.microsoft.hpc.scheduler.session.BrokerClient; +import com.microsoft.hpc.scheduler.session.BrokerResponse; +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.ResponseListener; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionAttachInfo; +import com.microsoft.hpc.scheduler.session.SessionBase; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; + +/** + * @author yutongs + * + */ +public class SessionPool { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("SessionPool"); + logger = new Logger(true, true, "SessionPool"); + + HpcJava.setUsername(config.UserName); + HpcJava.setPassword(config.Password); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + // todo: check if the target cluster is in ready state + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + // todo: cleanup work for each case + } + + /** + * create a durable session, send requests and get responses + */ + + @Test + public void test_SessionPool_DurableEcho() { + + logger.Start("test_SessionPool_DurableEcho"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName); + info.setSecure(true); + info.setShareSession(true); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session from session pool at %s.", config.ServiceName, + config.Scheduler); + + DurableSession session = null; + try { + session = DurableSession.createSession(info); + logger.Info("Session %d is created.", session.getId()); + BrokerClient client = new BrokerClient( + "clientid", session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + int refId = Util.generateRandomInteger(); + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + + logger.Info("Retrieving responses..."); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info( + "\tReceived response for request %s: refId: %d", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + logger.End("test_SessionPool_DurableEcho"); + + } + + /** + * create a durable session, send requests, attach the session and then get + * responses + */ + + @Test + public void test_SessionPool_DurableEcho_Attach() { + + logger.Start("test_SessionPool_DurableEcho_Attach"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSecure(false); + info.setShareSession(true); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + int sessionId = 0; + int refId = Util.generateRandomInteger(); + + try { + session = DurableSession.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = DurableSession.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + } + + logger.End("test_SessionPool_DurableEcho_Attach"); + + } + + + /** + * create a interactive session, send requests, attach the session and then get + * responses + */ + + @Test + public void test_SessionPool_InteractiveEcho_Attach() { + + logger.Start("test_SessionPool_InteractiveEcho_Attach"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSecure(false); + info.setShareSession(true); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + int sessionId = 0; + int refId = Util.generateRandomInteger(); + + try { + session = Session.createSession(info); + sessionId = session.getId(); + logger.Info("Session %d is created.", sessionId); + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Sending %d requests...", config.NbOfCalls); + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(refId); + client.sendRequest(request, i); + } + logger.Info("Call endRequests()..."); + client.endRequests(); + client.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = Session.attachSession(attInfo); + logger.Info("Session %d is attached.", sessionId); + logger.assertEqual("autoclose should be false", session.getAutoCloseJob(), false); + + + BrokerClient client = new BrokerClient( + session, AITestLibService.class); + logger.Info("Retrieving responses..."); + + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult().getEchoResult() + .getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID()); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown ", e1); + + } + } + + logger.End("test_SessionPool_InteractiveEcho_Attach"); + + } + + + /** + * interactive multiple batches + */ + @Test + public void test_SessionPool_InteractiveMultipleBatches() { + logger.Start("test_SessionPool_InteractiveMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setShareSession(true); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + Echo[] requests = new Echo[config.NbOfClients]; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + + logger.Info("Client%d sending %d requests...", k, + config.NbOfCalls); + requests[k] = Util.generateEchoRequest(); + for (int i = 0; i < config.NbOfCalls; i++) { + client.sendRequest(requests[k], i); + } + logger.Info("Client%d calling endRequests()...", k); + client.endRequests(); + } + + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + k, session, AITestLibService.class); + + logger.Info("Client%d retrieving responses...", k); + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + logger.Info("\tReceived response for request %s: %s", + response.getUserData(), reply.getRefID() + .toString()); + logger.assertTrue("check response", reply.getRefID() + .compareTo(requests[k].getRefID()) == 0); + + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + } + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + logger.End("test_SessionPool_InteractiveMultipleBatches"); + } + + /** + * error - not shared + */ + @Test + public void test_SessionPool_NotShared() { + logger.Start("test_SessionPool_NotShared"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setShareSession(false); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session.", config.ServiceName); + + DurableSession session = null; + int sessionId = 0; + + try { + session = DurableSession.createSession(info); + sessionId = session.getId(); + logger.Error("Session %d is created.", sessionId); + + } catch (Throwable e) { + logger.Info("Exception is thrown %s%n%s", e.toString(), + e.getStackTrace()); + } + logger.End("test_SessionPool_NotShared"); + + } + + + class ConcurrentClient implements Runnable { + public ConcurrentClient(int m, CountDownLatch l, SessionBase session, + int sendget) { + this.m = m; + this.l = l; + this.session = session; + this.sendget = sendget; + + } + + @Override + public void run() { + if (sendget == 0) { + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + + logger.Info("Client %s sending %d requests...", + m + "_" + k, config.NbOfCalls); + + for (int i = 0; i < config.NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(m * k); + try { + client.sendRequest(request, i); + } catch (SessionException e) { + logger.Error("SessionException: ", e); + + } catch (SocketTimeoutException e) { + logger.Error("SessionException: ", e); + + } + } + logger.Info("Client %s calling endRequests()...", m + "_" + + k); + try { + client.endRequests(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + } + l.countDown(); + } else if (sendget == 1) { + for (int k = 0; k < config.NbOfClients; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + logger.Info("Client%s retrieving responses...", m + "_" + k); + try { + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + logger.Info( + "\tReceived response for request %s: %s", + response.getUserData(), reply); + logger.assertTrue("check response", + reply.getRefID() == m * k); + + } catch (Throwable ex) { + logger.Error("Error in process request ", ex); + + } + + } + } catch (SessionException e) { + logger.Error("SessionException: ", e); + + } + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + try { + client.close(true); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + + } catch (SessionException e) { + // TODO Auto-generated catch block + + } + + } + l.countDown(); + } + + } + + private int m = 0; + private CountDownLatch l = null; + private SessionBase session = null; + private int sendget = 0; + + } + + /** + * interactive concurrent multiple batches, n * m batches + */ + @Test + public void test_SessionPool_InteractiveConcurrentMultipleBatches() { + logger.Start("test_SessionPool_InteractiveConcurrentMultipleBatches"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setShareSession(true); + info.setUseSessionPool(true); + + logger.Info("Creating a %s durable session.", config.ServiceName); + + Session session = null; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.", session.getId()); + + CountDownLatch L = new CountDownLatch(config.NbOfBatches); + + Thread[] workers = new Thread[config.NbOfBatches]; + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L, session, 0)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L.await(10, TimeUnit.MINUTES); + + CountDownLatch L2 = new CountDownLatch(config.NbOfBatches); + + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m] = new Thread(new ConcurrentClient(m, L2, session, 1)); + } + for (int m = 0; m < config.NbOfBatches; m++) { + workers[m].start(); + } + + L2.await(10, TimeUnit.MINUTES); + + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + + logger.End("test_SessionPool_InteractiveConcurrentMultipleBatches"); + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/SessionStartInfoTest.java b/test/TestCase/functiontest/SessionStartInfoTest.java new file mode 100644 index 0000000..3186698 --- /dev/null +++ b/test/TestCase/functiontest/SessionStartInfoTest.java @@ -0,0 +1,515 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.net.SocketTimeoutException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionBase; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.SessionUnitType; +import com.microsoft.hpc.scheduler.session.Version; + +/** + * @author yutongs + * + */ +public class SessionStartInfoTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + + config = new Config("SessionStartInfoTest"); + logger = new Logger(true, true, "SessionStartInfoTest"); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringStringStringString() { + logger.Start(); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + logger.assertEqual("allocationGrowLoadRatioThreshold", + info.getAllocationGrowLoadRatioThreshold(), 0); + logger.assertEqual("allocationShrinkLoadRatioThreshold", + info.getAllocationShrinkLoadRatioThreshold(), 0); + logger.assertEqual("clientIdleTimeout", info.clientIdleTimeout(), 0); + logger.assertEqual("getResourceUnitType", + info.getResourceUnitType(), SessionUnitType.Core); + logger.assertEqual("headnode", info.getHeadnode(), config.Scheduler); + logger.assertEqual("isSecure", info.isSecure(), true); + logger.assertEqual("isShareSession", info.isShareSession(), false); + logger.assertEqual("jobTemplate", info.getJobTemplate(), "Default"); + logger.assertEqual("maxUnits", info.getMaxUnits(), 0); + logger.assertEqual("minUnits", info.getMinUnits(), 0); + logger.assertEqual("messagesThrottleStartThreshold", + info.messagesThrottleStartThreshold(), 0); // TODO, is this + // default value ok? + logger.assertEqual("messagesThrottleStopThreshold", + info.messagesThrottleStopThreshold(), 0); // TODO, is this + // default value ok? + logger.assertEqual("nodeGroupsStr", info.getNodeGroups(), null); + // logger.assertEqual("password", info.getPassword(), config.Password); + logger.assertEqual("priority", info.getPriority(), 0); + logger.assertEqual("requestedNodesStr", info.getRequestedNodesStr(), null); + logger.assertEqual("runtime", info.getRuntime(), 0); + logger.assertEqual("serviceJobName", info.getServiceJobName(), null); + logger.assertEqual("serviceName", info.getServiceName(), + config.ServiceName); + logger.assertEqual("sessionIdleTimeout", info.sessionIdleTimeout(), 0); + logger.assertEqual("username", info.getUsername(), config.UserName); + logger.assertEqual("runas username", info.getRunAsUsername(), config.UserName); + + logger.assertEqual("isPreemptable", info.isPreemptive(), false); + + // BUG the default value is not consistent + + info = new SessionStartInfo(config.Scheduler, + config.ServiceName,config.UserName ,config.Password ); + + info.setAllocationGrowLoadRatioThreshold(10); + info.setAllocationShrinkLoadRatioThreshold(2); + info.setClientIdleTimeout(3000); + info.setJobTemplate("Default"); + info.setMaxUnits(12); + info.setMinUnits(1); + info.setMessagesThrottleStartThreshold(4000); + info.setMessagesThrottleStopThreshold(3000); + info.setNodeGroupsStr("ComputeNodes"); + info.setRunAsPassword(config.Password2); + info.setRequestedNodesStr(""); + info.setResourceUnitType(SessionUnitType.Socket); + info.setSecure(true); + info.setServiceJobName("service job name"); + info.setServiceJobProject("service job project"); // BUG no api to get + // this + + info.setServiceName(config.ServiceName); //BUG why we can set this but cannot set scheduler name u/p? + info.setServiceVersion(new Version(3, 2)); + info.setSessionIdleTimeout(5000); + info.setShareSession(true); + info.setRunAsUsername(config.UserName2); + info.setRuntime(3600); + info.setPriority(4); + info.addEnvironment("Env1", "Value1"); + info.addEnvironment("Env2", "Value2"); + + info.setPreemptive(true); + + logger.assertEqual("allocationGrowLoadRatioThreshold", + info.getAllocationGrowLoadRatioThreshold(), 10); + logger.assertEqual("allocationShrinkLoadRatioThreshold", + info.getAllocationShrinkLoadRatioThreshold(), 2); + logger.assertEqual("clientIdleTimeout", info.clientIdleTimeout(), 3000); + logger.assertEqual("getResourceUnitType", info.getResourceUnitType(), + SessionUnitType.Socket); + logger.assertEqual("headnode", info.getHeadnode(), config.Scheduler); + logger.assertEqual("isSecure", info.isSecure(), true); + logger.assertEqual("isShareSession", info.isShareSession(), true); + logger.assertEqual("jobTemplate", info.getJobTemplate(), "Default"); + logger.assertEqual("maxUnits", info.getMaxUnits(), 12); + logger.assertEqual("minUnits", info.getMinUnits(), 1); + logger.assertEqual("messagesThrottleStartThreshold", + info.messagesThrottleStartThreshold(), 4000); + logger.assertEqual("messagesThrottleStopThreshold", + info.messagesThrottleStopThreshold(), 3000); + logger.assertEqual("nodeGroupsStr", info.getNodeGroups(), + "ComputeNodes"); + // logger.assertEqual("password", info.getPassword(), "Pa55word"); + logger.assertEqual("priority", info.getPriority(), 4); + logger.assertEqual("requestedNodesStr", info.getRequestedNodesStr(), + ""); + logger.assertEqual("runtime", info.getRuntime(), 3600); // BUG no set + // runtime + + logger.assertEqual("serviceJobName", info.getServiceJobName(), + "service job name"); + logger.assertEqual("serviceJobName", info.getServiceJobProject(), + "service job project"); + logger.assertEqual("serviceName", info.getServiceName(), config.ServiceName); + logger.assertEqual("sessionIdleTimeout", info.sessionIdleTimeout(), + 5000); + logger.assertEqual("username", info.getUsername(), config.UserName); + logger.assertEqual("runas username", info.getRunAsUsername(), config.UserName2); + logger.assertEqual("isPreemptive", info.isPreemptive(), true); + // BUG no get ServerVersion + HashMap map = info.getEnvironments(); + Iterator> iter = map.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = iter.next(); + logger.Info("key %s value %s", entry.getKey(), entry.getValue()); + logger.assertTrue("validate key and value", entry.getKey().startsWith("Env")); + logger.assertTrue("validate key and value", entry.getValue().startsWith("Value")); + } + + + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + //should check the session created. + if (session !=null) { + try { + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + } + + + // boundary + info = new SessionStartInfo("", config.ServiceName, config.UserName, + config.Password); + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + + } + + + + info = new SessionStartInfo(config.Scheduler, "", config.UserName, + config.Password); + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + + } + logger.End(); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringStringStringString_1() { + logger.Start(); + SessionStartInfo info = null; + Session session = null; + + // boundary + // invalid password + info = new SessionStartInfo(config.Scheduler, config.ServiceName, + "abcxyz", "abcxyz"); + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + + } + logger.End(); + } + + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringStringStringString_2() { + logger.Start(); + SessionStartInfo info = null; + Session session = null; + + // boundary + // invalid password + info = new SessionStartInfo(config.Scheduler, config.ServiceName, + config.UserName, ""); + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + + } + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringString() { + logger.Start(); + // TODO + HpcJava.setUsername(config.UserName); + HpcJava.setPassword(config.Password); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName); + logger.assertEqual("", info.getHeadnode(), config.Scheduler); + //logger.assertEqual("", info.getPassword(), null); + logger.assertEqual("", info.getServiceName(), config.ServiceName); + logger.assertEqual("", info.getUsername(), config.UserName); + + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + } + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String, com.microsoft.hpc.scheduler.session.Version)} + * . + */ + @Test + public final void testSessionStartInfoStringStringVersion() { + logger.Start(); + Version v = new Version(2, 0); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, v, config.UserName, config.Password); + + logger.assertEqual("hn", info.getHeadnode(), config.Scheduler); + // logger.assertEqual("pw", info.getPassword(), config.Password); + logger.assertEqual("sn", info.getServiceName(), config.ServiceName); + logger.assertEqual("un", info.getUsername(), config.UserName); + // BUG should be able to get service version + logger.assertEqual("sv", info.getServiceVersion().toString(), "2.0"); + + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + } + logger.End(); + } + + + + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString() { + logger.Start(); + String serviceName = config.getValue("ServiceName"); + Version[] vs = null; + try { + vs = SessionBase.GetServiceVersions(config.Scheduler, serviceName, config.UserName, config.Password); + } catch (SessionException e1) { + logger.Error("Exception when getting service version", e1); + + } + for (Version v : vs) { + logger.Info(v); + } + Version latest = vs[0]; + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + serviceName, latest, config.UserName, config.Password); + + Session session = null; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.",session.getId()); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + } + logger.End(); + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_noVersion() { + logger.Start(); + Version[] vs = null; + try { + vs = SessionBase.GetServiceVersions(config.Scheduler, config.ServiceName, config.UserName, config.Password); + } catch (SessionException e1) { + logger.Error("Exception when getting service version", e1); + + } + for (Version v : vs) { + logger.Info(v); + } + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, SessionBase.NoServiceVersion, config.UserName, config.Password); + + Session session = null; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.",session.getId()); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + } + logger.End(); + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_Er() { + logger.Start(); + String serviceName = config.getValue("ServiceName"); + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + serviceName, new Version(-1,0), config.UserName, config.Password); + + Session session = null; + try { + session = Session.createSession(info); + logger.Info("Session %d is created.",session.getId()); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown ", e); + + } + } + logger.End(); + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/SessionTest.java b/test/TestCase/functiontest/SessionTest.java new file mode 100644 index 0000000..b7d72ce --- /dev/null +++ b/test/TestCase/functiontest/SessionTest.java @@ -0,0 +1,508 @@ +/** + * + */ +package functiontest; + +import static org.junit.Assert.*; + +import java.net.SocketTimeoutException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.DurableSession; +import com.microsoft.hpc.scheduler.session.Session; +import com.microsoft.hpc.scheduler.session.SessionAttachInfo; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; + +/** + * @author yutongs + * + */ +public class SessionTest { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("SessionTest"); + logger = new Logger(true, true, "SessionTest"); + + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + info.setSessionIdleTimeout(Integer.MAX_VALUE); + info.setClientIdleTimeout(Integer.MAX_VALUE); + + iSession = Session.createSession(info); + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + iSession.close(); + logger.close(); + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#dispose()}. + */ + @Ignore + public final void testDispose() { + // we do not test it here + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#getAutoCloseJob()}. + */ + @Test + public final void testGetAutoCloseJob() { + logger.Start(); + logger.Info(iSession.getAutoCloseJob().toString()); // BUG what's this + // for? + + logger.End(); + } + + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#netTcpEndpointReference()} + * . + */ + @Ignore + public final void testNetTcpEndpointReference() { + // deprecated + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#httpEndpointReference()} + * . + */ + @Test + public final void testHttpEndpointReference() { + logger.Start(); + logger.Info(iSession.httpEndpointReference()); + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfo() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } + + // boundary + try { + session = Session.createSession(null); + logger.Error("EException is not thrown."); + } catch (Throwable e) { + logger.Info("Timeout when creating a durable session"); + + } + + SessionStartInfo info2 = new SessionStartInfo("abc", + config.ServiceName, config.UserName, config.Password); + + // info2.setHeadnode("abcxyz1341235"); + + try { + session = Session.createSession(info2); + logger.Error("EException is not thrown."); + } catch (Throwable e) { + logger.Info("Timeout when creating a durable session"); + + } + + // more boundary test case for invalid startInfo would be included in + // SessionStartInfo test + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo, com.microsoft.hpc.scheduler.session.Timeout)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfoTimeout() { + logger.Start(); + logger.End(); + // BUG why need Timeout here. + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo, int)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfoInt() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = null; + try { + session = Session.createSession(info, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + try { + session = Session.createSession(info, Integer.MAX_VALUE); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + try { + session = Session.createSession(info, 0); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + // boundary + + try { + session = Session.createSession(info, -1); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + try { + session = Session.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a session"); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + try { + session = Session.createSession(info, Integer.MIN_VALUE); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfo() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session == null) { + logger.Error("creating dSession failed"); + return; + } + + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + session.getId(), config.UserName, config.Password); + + Session session_attached = null; + try { + session_attached = Session.attachSession(attachInfo); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a session", e1); + + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a session", e); + + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a session", e); + + } + + if (session == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + session_attached = Session.attachSession(null); + logger.Error("EE is not thrown."); + } catch (NullPointerException e1) { + logger.Info("Timeout when attaching a durable session", e1); + + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + logger.End(); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfoInt() { + logger.Start(); + // functional + SessionStartInfo info = new SessionStartInfo(config.Scheduler, + config.ServiceName, config.UserName, config.Password); + Session session = null; + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (session == null) { + logger.Error("creating dSession failed"); + return; + } + + SessionAttachInfo attachInfo = new SessionAttachInfo(config.Scheduler, + session.getId(), config.UserName, config.Password); + + Session session_attached = null; + try { + session_attached = Session.attachSession(attachInfo, 5000); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } + + try { + session_attached = Session.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session", e1); + + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session", e); + + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session", e); + + } + + if (session == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + session_attached = Session.attachSession(attachInfo, -1); + logger.Error("EE is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session", e); + + } catch (Throwable e) { + logger.Error("UE when creating a session", e); + + } + + try { + session_attached = Session.attachSession(attachInfo, 1); + logger.Error("EE is not thrown."); + } catch (SessionException e1) { + logger.Info("Timeout when attaching a durable session", e1); + + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session", e1); + + } + + try { + session_attached = Session.attachSession(attachInfo, + Integer.MIN_VALUE); + logger.Error("EE is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session", e); + + } catch (Throwable e) { + logger.Error("UE when creating a session", e); + + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session", e); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session", e); + + } + logger.End(); + } + + private static Session iSession = null; + private static Config config; + private static Logger logger; + +} diff --git a/test/TestCase/functiontest/Util.java b/test/TestCase/functiontest/Util.java new file mode 100644 index 0000000..f3e62be --- /dev/null +++ b/test/TestCase/functiontest/Util.java @@ -0,0 +1,81 @@ +/** + * + */ +package functiontest; + +import com.microsoft.hpc.scheduler.session.*; + +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Random; + +import org.tempuri.Echo; +import org.tempuri.GenerateLoad; +import org.tempuri.ObjectFactory; + +/** + * @author yutongs + * + */ + +public class Util { + + public static SessionBase CreateSession(SessionStartInfo info, + boolean isDurable) throws SocketTimeoutException, SessionException { + if (isDurable) { + return DurableSession.createSession(info); + } else { + return Session.createSession(info); + } + + } + + public static ArrayList intValues = new ArrayList(); + + public static ArrayList stringValues = new ArrayList(); + + static { + intValues.add(0); + intValues.add(1); + intValues.add(-1); + intValues.add(Integer.MAX_VALUE); + intValues.add(Integer.MIN_VALUE); + + stringValues.add(""); + stringValues.add(" "); + stringValues.add(null); + stringValues.add("a"); + stringValues.add("a b c"); + stringValues.add("xyz123"); + stringValues.add("!!*^*(&*)@#%^&*()!+_}{?<>"); + stringValues.add("asdi088&*^&%$&"); + + } + + public static int generateRandomInteger() { + Random rand = new Random(); + return rand.nextInt(Integer.MAX_VALUE); + } + + public static Echo generateEchoRequest() { + return generateEchoRequest(generateRandomInteger()); + } + + public static Echo generateEchoRequest(int refId) { + Echo request = new Echo(); + request.setRefID(refId); + return request; + } + + public static GenerateLoad generateGeneratedLoad(String commonDataPath, + byte[] inputData, long milliSec, int refId) { + GenerateLoad request = new GenerateLoad(); + ObjectFactory of = new ObjectFactory(); + request.setCommonDataPath(of + .createGenerateLoadCommonDataPath(commonDataPath)); + request.setInputData(of.createGenerateLoadInputData(inputData)); + request.setMillisec(milliSec); + request.setRefID(refId); + return request; + } +} diff --git a/test/TestCase/runtests_BVT.cmd b/test/TestCase/runtests_BVT.cmd new file mode 100644 index 0000000..81a5b45 --- /dev/null +++ b/test/TestCase/runtests_BVT.cmd @@ -0,0 +1,10 @@ + @echo off + set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 + set CXF_HOME=c:\java\apache-cxf-2.4.0 + set JAVAC="%JAVA_HOME%\bin\javac.exe" + set JAR="%JAVA_HOME%\bin\jar.exe" + set CLASSPATH=.;%CXF_HOME%\lib\cxf-manifest.jar;junit.jar;org.hamcrest.core_1.1.0.v20090501071000.jar;JavaTestServiceClient.jar;..\Microsoft-HpcSession-3.0.jar + + java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore functiontest.BVT + + \ No newline at end of file diff --git a/test/TestCase/runtests_BVT.sh b/test/TestCase/runtests_BVT.sh new file mode 100644 index 0000000..5cfe23f --- /dev/null +++ b/test/TestCase/runtests_BVT.sh @@ -0,0 +1,5 @@ +#!bin/sh +export CXF_HOME=/usr/java/apache-cxf-2.4.0 +export CLASSPATH=.:$CXF_HOME/lib/cxf-manifest.jar:./junit.jar:./org.hamcrest.core_1.1.0.v20090501071000.jar:./JavaTestServiceClient.jar:../Microsoft-HpcSession-3.0.jar + +java -Xmx1024m -Djava.ext.dirs=/usr/java/jdk1.6.0_23/jre/lib/ext:/usr/java/apache-cxf-2.4.0/lib:/usr/java/apache-cxf-2.4.0/lib/endorsed org.junit.runner.JUnitCore functiontest.BVT diff --git a/test/TestCase/runtests_Full.cmd b/test/TestCase/runtests_Full.cmd new file mode 100644 index 0000000..ce22015 --- /dev/null +++ b/test/TestCase/runtests_Full.cmd @@ -0,0 +1,10 @@ + @echo off + set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 + set CXF_HOME=c:\java\apache-cxf-2.4.0 + set JAVAC="%JAVA_HOME%\bin\javac.exe" + set JAR="%JAVA_HOME%\bin\jar.exe" + set CLASSPATH=.;%CXF_HOME%\lib\cxf-manifest.jar;junit.jar;org.hamcrest.core_1.1.0.v20090501071000.jar;JavaTestServiceClient.jar;..\Microsoft-HpcSession-3.0.jar + + java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore fullpass.Full + + \ No newline at end of file diff --git a/test/TestCase/runtests_Full.sh b/test/TestCase/runtests_Full.sh new file mode 100644 index 0000000..f2bb6fd --- /dev/null +++ b/test/TestCase/runtests_Full.sh @@ -0,0 +1,5 @@ +#!bin/sh +export CXF_HOME=/usr/java/apache-cxf-2.4.0 +export CLASSPATH=.:$CXF_HOME/lib/cxf-manifest.jar:./junit.jar:./org.hamcrest.core_1.1.0.v20090501071000.jar:./JavaTestServiceClient.jar:../Microsoft-HpcSession-3.0.jar + +java -Xmx1024m -Djava.ext.dirs=/usr/java/jdk1.6.0_23/jre/lib/ext:/usr/java/apache-cxf-2.4.0/lib:/usr/java/apache-cxf-2.4.0/lib/endorsed org.junit.runner.JUnitCore fullpass.Full diff --git a/test/TestService/AITestLib.Helper.xsd b/test/TestService/AITestLib.Helper.xsd new file mode 100644 index 0000000..a285fe4 --- /dev/null +++ b/test/TestService/AITestLib.Helper.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/JavaTestService.config b/test/TestService/JavaTestService.config new file mode 100644 index 0000000..20caf10 --- /dev/null +++ b/test/TestService/JavaTestService.config @@ -0,0 +1,175 @@ + + + + + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/System.xsd b/test/TestService/System.xsd new file mode 100644 index 0000000..44a1898 --- /dev/null +++ b/test/TestService/System.xsd @@ -0,0 +1,1085 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + 8 + + + + + + + 9 + + + + + + + 12 + + + + + + + 13 + + + + + + + 19 + + + + + + + 27 + + + + + + + 32 + + + + + + + 33 + + + + + + + 34 + + + + + + + 35 + + + + + + + 36 + + + + + + + 37 + + + + + + + 38 + + + + + + + 39 + + + + + + + 40 + + + + + + + 41 + + + + + + + 42 + + + + + + + 43 + + + + + + + 44 + + + + + + + 45 + + + + + + + 46 + + + + + + + 47 + + + + + + + 48 + + + + + + + 49 + + + + + + + 50 + + + + + + + 51 + + + + + + + 52 + + + + + + + 53 + + + + + + + 54 + + + + + + + 55 + + + + + + + 56 + + + + + + + 57 + + + + + + + 65 + + + + + + + 66 + + + + + + + 67 + + + + + + + 68 + + + + + + + 69 + + + + + + + 70 + + + + + + + 71 + + + + + + + 72 + + + + + + + 73 + + + + + + + 74 + + + + + + + 75 + + + + + + + 76 + + + + + + + 77 + + + + + + + 78 + + + + + + + 79 + + + + + + + 80 + + + + + + + 81 + + + + + + + 82 + + + + + + + 83 + + + + + + + 84 + + + + + + + 85 + + + + + + + 86 + + + + + + + 87 + + + + + + + 88 + + + + + + + 89 + + + + + + + 90 + + + + + + + 91 + + + + + + + 92 + + + + + + + 93 + + + + + + + 95 + + + + + + + 96 + + + + + + + 97 + + + + + + + 98 + + + + + + + 99 + + + + + + + 100 + + + + + + + 101 + + + + + + + 102 + + + + + + + 103 + + + + + + + 104 + + + + + + + 105 + + + + + + + 106 + + + + + + + 107 + + + + + + + 108 + + + + + + + 109 + + + + + + + 110 + + + + + + + 111 + + + + + + + 112 + + + + + + + 113 + + + + + + + 114 + + + + + + + 115 + + + + + + + 116 + + + + + + + 117 + + + + + + + 118 + + + + + + + 119 + + + + + + + 120 + + + + + + + 121 + + + + + + + 122 + + + + + + + 123 + + + + + + + 124 + + + + + + + 125 + + + + + + + 126 + + + + + + + 127 + + + + + + + 128 + + + + + + + 129 + + + + + + + 130 + + + + + + + 131 + + + + + + + 132 + + + + + + + 133 + + + + + + + 134 + + + + + + + 135 + + + + + + + 166 + + + + + + + 167 + + + + + + + 168 + + + + + + + 169 + + + + + + + 170 + + + + + + + 171 + + + + + + + 172 + + + + + + + 173 + + + + + + + 174 + + + + + + + 175 + + + + + + + 176 + + + + + + + 177 + + + + + + + 178 + + + + + + + 179 + + + + + + + 180 + + + + + + + 181 + + + + + + + 182 + + + + + + + 183 + + + + + + + 186 + + + + + + + 187 + + + + + + + 188 + + + + + + + 189 + + + + + + + 190 + + + + + + + 191 + + + + + + + 192 + + + + + + + 219 + + + + + + + 220 + + + + + + + 221 + + + + + + + 222 + + + + + + + 223 + + + + + + + 226 + + + + + + + 229 + + + + + + + 231 + + + + + + + 246 + + + + + + + 247 + + + + + + + 248 + + + + + + + 249 + + + + + + + 250 + + + + + + + 251 + + + + + + + 252 + + + + + + + 253 + + + + + + + 254 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/com/microsoft/hpc/aitestsvclib/session/AuthenticationFailure.java b/test/TestService/com/microsoft/hpc/aitestsvclib/session/AuthenticationFailure.java new file mode 100644 index 0000000..d91d5b3 --- /dev/null +++ b/test/TestService/com/microsoft/hpc/aitestsvclib/session/AuthenticationFailure.java @@ -0,0 +1,63 @@ + +package com.microsoft.hpc.aitestsvclib.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for AuthenticationFailure complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="AuthenticationFailure">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="userName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AuthenticationFailure", propOrder = { + "userName" +}) +public class AuthenticationFailure { + + @XmlElementRef(name = "userName", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement userName; + + /** + * Gets the value of the userName property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getUserName() { + return userName; + } + + /** + * Sets the value of the userName property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setUserName(JAXBElement value) { + this.userName = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/com/microsoft/hpc/aitestsvclib/session/ObjectFactory.java b/test/TestService/com/microsoft/hpc/aitestsvclib/session/ObjectFactory.java new file mode 100644 index 0000000..9f643cf --- /dev/null +++ b/test/TestService/com/microsoft/hpc/aitestsvclib/session/ObjectFactory.java @@ -0,0 +1,91 @@ + +package com.microsoft.hpc.aitestsvclib.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.hpc.session package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _RetryOperationError_QNAME = new QName("http://hpc.microsoft.com/session/", "RetryOperationError"); + private final static QName _AuthenticationFailure_QNAME = new QName("http://hpc.microsoft.com/session/", "AuthenticationFailure"); + private final static QName _AuthenticationFailureUserName_QNAME = new QName("http://hpc.microsoft.com/session/", "userName"); + private final static QName _RetryOperationErrorReason_QNAME = new QName("http://hpc.microsoft.com/session/", "reason"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc.session + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link AuthenticationFailure } + * + */ + public AuthenticationFailure createAuthenticationFailure() { + return new AuthenticationFailure(); + } + + /** + * Create an instance of {@link RetryOperationError } + * + */ + public RetryOperationError createRetryOperationError() { + return new RetryOperationError(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RetryOperationError }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "RetryOperationError") + public JAXBElement createRetryOperationError(RetryOperationError value) { + return new JAXBElement(_RetryOperationError_QNAME, RetryOperationError.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link AuthenticationFailure }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "AuthenticationFailure") + public JAXBElement createAuthenticationFailure(AuthenticationFailure value) { + return new JAXBElement(_AuthenticationFailure_QNAME, AuthenticationFailure.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "userName", scope = AuthenticationFailure.class) + public JAXBElement createAuthenticationFailureUserName(String value) { + return new JAXBElement(_AuthenticationFailureUserName_QNAME, String.class, AuthenticationFailure.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "reason", scope = RetryOperationError.class) + public JAXBElement createRetryOperationErrorReason(String value) { + return new JAXBElement(_RetryOperationErrorReason_QNAME, String.class, RetryOperationError.class, value); + } + +} diff --git a/test/TestService/com/microsoft/hpc/aitestsvclib/session/RetryOperationError.java b/test/TestService/com/microsoft/hpc/aitestsvclib/session/RetryOperationError.java new file mode 100644 index 0000000..fcae5d4 --- /dev/null +++ b/test/TestService/com/microsoft/hpc/aitestsvclib/session/RetryOperationError.java @@ -0,0 +1,117 @@ + +package com.microsoft.hpc.aitestsvclib.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RetryOperationError complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RetryOperationError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="lastFailedServiceId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="retryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RetryOperationError", propOrder = { + "lastFailedServiceId", + "reason", + "retryCount" +}) +public class RetryOperationError { + + protected Integer lastFailedServiceId; + @XmlElementRef(name = "reason", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement reason; + protected Integer retryCount; + + /** + * Gets the value of the lastFailedServiceId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getLastFailedServiceId() { + return lastFailedServiceId; + } + + /** + * Sets the value of the lastFailedServiceId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setLastFailedServiceId(Integer value) { + this.lastFailedServiceId = value; + } + + /** + * Gets the value of the reason property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReason() { + return reason; + } + + /** + * Sets the value of the reason property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReason(JAXBElement value) { + this.reason = ((JAXBElement ) value); + } + + /** + * Gets the value of the retryCount property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRetryCount() { + return retryCount; + } + + /** + * Sets the value of the retryCount property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRetryCount(Integer value) { + this.retryCount = value; + } + +} diff --git a/test/TestService/com/microsoft/hpc/aitestsvclib/session/package-info.java b/test/TestService/com/microsoft/hpc/aitestsvclib/session/package-info.java new file mode 100644 index 0000000..7e3bb6a --- /dev/null +++ b/test/TestService/com/microsoft/hpc/aitestsvclib/session/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com/session/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.hpc.aitestsvclib.session; diff --git a/test/TestService/com/microsoft/hpc/session/AuthenticationFailure.java b/test/TestService/com/microsoft/hpc/session/AuthenticationFailure.java new file mode 100644 index 0000000..49f72ea --- /dev/null +++ b/test/TestService/com/microsoft/hpc/session/AuthenticationFailure.java @@ -0,0 +1,63 @@ + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for AuthenticationFailure complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="AuthenticationFailure">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="userName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AuthenticationFailure", propOrder = { + "userName" +}) +public class AuthenticationFailure { + + @XmlElementRef(name = "userName", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement userName; + + /** + * Gets the value of the userName property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getUserName() { + return userName; + } + + /** + * Sets the value of the userName property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setUserName(JAXBElement value) { + this.userName = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/com/microsoft/hpc/session/ObjectFactory.java b/test/TestService/com/microsoft/hpc/session/ObjectFactory.java new file mode 100644 index 0000000..289b9fd --- /dev/null +++ b/test/TestService/com/microsoft/hpc/session/ObjectFactory.java @@ -0,0 +1,91 @@ + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.hpc.session package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _RetryOperationError_QNAME = new QName("http://hpc.microsoft.com/session/", "RetryOperationError"); + private final static QName _AuthenticationFailure_QNAME = new QName("http://hpc.microsoft.com/session/", "AuthenticationFailure"); + private final static QName _RetryOperationErrorReason_QNAME = new QName("http://hpc.microsoft.com/session/", "reason"); + private final static QName _AuthenticationFailureUserName_QNAME = new QName("http://hpc.microsoft.com/session/", "userName"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc.session + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link AuthenticationFailure } + * + */ + public AuthenticationFailure createAuthenticationFailure() { + return new AuthenticationFailure(); + } + + /** + * Create an instance of {@link RetryOperationError } + * + */ + public RetryOperationError createRetryOperationError() { + return new RetryOperationError(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RetryOperationError }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "RetryOperationError") + public JAXBElement createRetryOperationError(RetryOperationError value) { + return new JAXBElement(_RetryOperationError_QNAME, RetryOperationError.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link AuthenticationFailure }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "AuthenticationFailure") + public JAXBElement createAuthenticationFailure(AuthenticationFailure value) { + return new JAXBElement(_AuthenticationFailure_QNAME, AuthenticationFailure.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "reason", scope = RetryOperationError.class) + public JAXBElement createRetryOperationErrorReason(String value) { + return new JAXBElement(_RetryOperationErrorReason_QNAME, String.class, RetryOperationError.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "userName", scope = AuthenticationFailure.class) + public JAXBElement createAuthenticationFailureUserName(String value) { + return new JAXBElement(_AuthenticationFailureUserName_QNAME, String.class, AuthenticationFailure.class, value); + } + +} diff --git a/test/TestService/com/microsoft/hpc/session/RetryOperationError.java b/test/TestService/com/microsoft/hpc/session/RetryOperationError.java new file mode 100644 index 0000000..0e7310f --- /dev/null +++ b/test/TestService/com/microsoft/hpc/session/RetryOperationError.java @@ -0,0 +1,117 @@ + +package com.microsoft.hpc.session; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RetryOperationError complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RetryOperationError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="lastFailedServiceId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="retryCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RetryOperationError", propOrder = { + "lastFailedServiceId", + "reason", + "retryCount" +}) +public class RetryOperationError { + + protected Integer lastFailedServiceId; + @XmlElementRef(name = "reason", namespace = "http://hpc.microsoft.com/session/", type = JAXBElement.class, required = false) + protected JAXBElement reason; + protected Integer retryCount; + + /** + * Gets the value of the lastFailedServiceId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getLastFailedServiceId() { + return lastFailedServiceId; + } + + /** + * Sets the value of the lastFailedServiceId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setLastFailedServiceId(Integer value) { + this.lastFailedServiceId = value; + } + + /** + * Gets the value of the reason property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReason() { + return reason; + } + + /** + * Sets the value of the reason property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReason(JAXBElement value) { + this.reason = ((JAXBElement ) value); + } + + /** + * Gets the value of the retryCount property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRetryCount() { + return retryCount; + } + + /** + * Sets the value of the retryCount property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRetryCount(Integer value) { + this.retryCount = value; + } + +} diff --git a/test/TestService/com/microsoft/hpc/session/package-info.java b/test/TestService/com/microsoft/hpc/session/package-info.java new file mode 100644 index 0000000..e6ba294 --- /dev/null +++ b/test/TestService/com/microsoft/hpc/session/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com/session/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.hpc.session; diff --git a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java new file mode 100644 index 0000000..a31cc62 --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java @@ -0,0 +1,249 @@ + +package com.microsoft.schemas._2003._10.serialization; + +import java.math.BigDecimal; +import java.math.BigInteger; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.schemas._2003._10.serialization package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _AnyURI_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "anyURI"); + private final static QName _DateTime_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "dateTime"); + private final static QName _Char_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "char"); + private final static QName _QName_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "QName"); + private final static QName _UnsignedShort_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedShort"); + private final static QName _Float_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "float"); + private final static QName _Long_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "long"); + private final static QName _Short_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "short"); + private final static QName _Base64Binary_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "base64Binary"); + private final static QName _Byte_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "byte"); + private final static QName _Boolean_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "boolean"); + private final static QName _UnsignedByte_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedByte"); + private final static QName _AnyType_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "anyType"); + private final static QName _UnsignedInt_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedInt"); + private final static QName _Int_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "int"); + private final static QName _Decimal_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "decimal"); + private final static QName _Double_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "double"); + private final static QName _Guid_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "guid"); + private final static QName _Duration_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "duration"); + private final static QName _String_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "string"); + private final static QName _UnsignedLong_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/", "unsignedLong"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas._2003._10.serialization + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "anyURI") + public JAXBElement createAnyURI(String value) { + return new JAXBElement(_AnyURI_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "dateTime") + public JAXBElement createDateTime(XMLGregorianCalendar value) { + return new JAXBElement(_DateTime_QNAME, XMLGregorianCalendar.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "char") + public JAXBElement createChar(Integer value) { + return new JAXBElement(_Char_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link QName }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "QName") + public JAXBElement createQName(QName value) { + return new JAXBElement(_QName_QNAME, QName.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedShort") + public JAXBElement createUnsignedShort(Integer value) { + return new JAXBElement(_UnsignedShort_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "float") + public JAXBElement createFloat(Float value) { + return new JAXBElement(_Float_QNAME, Float.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "long") + public JAXBElement createLong(Long value) { + return new JAXBElement(_Long_QNAME, Long.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "short") + public JAXBElement createShort(Short value) { + return new JAXBElement(_Short_QNAME, Short.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "base64Binary") + public JAXBElement createBase64Binary(byte[] value) { + return new JAXBElement(_Base64Binary_QNAME, byte[].class, null, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Byte }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "byte") + public JAXBElement createByte(Byte value) { + return new JAXBElement(_Byte_QNAME, Byte.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Boolean }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "boolean") + public JAXBElement createBoolean(Boolean value) { + return new JAXBElement(_Boolean_QNAME, Boolean.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedByte") + public JAXBElement createUnsignedByte(Short value) { + return new JAXBElement(_UnsignedByte_QNAME, Short.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "anyType") + public JAXBElement createAnyType(Object value) { + return new JAXBElement(_AnyType_QNAME, Object.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedInt") + public JAXBElement createUnsignedInt(Long value) { + return new JAXBElement(_UnsignedInt_QNAME, Long.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "int") + public JAXBElement createInt(Integer value) { + return new JAXBElement(_Int_QNAME, Integer.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BigDecimal }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "decimal") + public JAXBElement createDecimal(BigDecimal value) { + return new JAXBElement(_Decimal_QNAME, BigDecimal.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Double }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "double") + public JAXBElement createDouble(Double value) { + return new JAXBElement(_Double_QNAME, Double.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "guid") + public JAXBElement createGuid(String value) { + return new JAXBElement(_Guid_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Duration }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "duration") + public JAXBElement createDuration(Duration value) { + return new JAXBElement(_Duration_QNAME, Duration.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "string") + public JAXBElement createString(String value) { + return new JAXBElement(_String_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/", name = "unsignedLong") + public JAXBElement createUnsignedLong(BigInteger value) { + return new JAXBElement(_UnsignedLong_QNAME, BigInteger.class, null, value); + } + +} diff --git a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java new file mode 100644 index 0000000..e0291b7 --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java @@ -0,0 +1,163 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfKeyValueOfstringstring complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfKeyValueOfstringstring">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="KeyValueOfstringstring" maxOccurs="unbounded" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="Key" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   <element name="Value" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfKeyValueOfstringstring", propOrder = { + "keyValueOfstringstring" +}) +public class ArrayOfKeyValueOfstringstring { + + @XmlElement(name = "KeyValueOfstringstring") + protected List keyValueOfstringstring; + + /** + * Gets the value of the keyValueOfstringstring property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the keyValueOfstringstring property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getKeyValueOfstringstring().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ArrayOfKeyValueOfstringstring.KeyValueOfstringstring } + * + * + */ + public List getKeyValueOfstringstring() { + if (keyValueOfstringstring == null) { + keyValueOfstringstring = new ArrayList(); + } + return this.keyValueOfstringstring; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="Key" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         <element name="Value" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class KeyValueOfstringstring { + + @XmlElement(name = "Key", required = true, nillable = true) + protected String key; + @XmlElement(name = "Value", required = true, nillable = true) + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + } + +} diff --git a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java new file mode 100644 index 0000000..3356f02 --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java @@ -0,0 +1,69 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfstring complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfstring">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="string" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfstring", propOrder = { + "string" +}) +public class ArrayOfstring { + + @XmlElement(nillable = true) + protected List string; + + /** + * Gets the value of the string property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the string property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getString().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getString() { + if (string == null) { + string = new ArrayList(); + } + return this.string; + } + +} diff --git a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java new file mode 100644 index 0000000..33e8d97 --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java @@ -0,0 +1,79 @@ + +package com.microsoft.schemas._2003._10.serialization.arrays; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.schemas._2003._10.serialization.arrays package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ArrayOfstring_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfstring"); + private final static QName _ArrayOfKeyValueOfstringstring_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfKeyValueOfstringstring"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas._2003._10.serialization.arrays + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ArrayOfKeyValueOfstringstring } + * + */ + public ArrayOfKeyValueOfstringstring createArrayOfKeyValueOfstringstring() { + return new ArrayOfKeyValueOfstringstring(); + } + + /** + * Create an instance of {@link ArrayOfstring } + * + */ + public ArrayOfstring createArrayOfstring() { + return new ArrayOfstring(); + } + + /** + * Create an instance of {@link ArrayOfKeyValueOfstringstring.KeyValueOfstringstring } + * + */ + public ArrayOfKeyValueOfstringstring.KeyValueOfstringstring createArrayOfKeyValueOfstringstringKeyValueOfstringstring() { + return new ArrayOfKeyValueOfstringstring.KeyValueOfstringstring(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfstring") + public JAXBElement createArrayOfstring(ArrayOfstring value) { + return new JAXBElement(_ArrayOfstring_QNAME, ArrayOfstring.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfKeyValueOfstringstring") + public JAXBElement createArrayOfKeyValueOfstringstring(ArrayOfKeyValueOfstringstring value) { + return new JAXBElement(_ArrayOfKeyValueOfstringstring_QNAME, ArrayOfKeyValueOfstringstring.class, null, value); + } + +} diff --git a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java new file mode 100644 index 0000000..9e8a334 --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.schemas._2003._10.serialization.arrays; diff --git a/test/TestService/hpc.microsoft.com.session.xsd b/test/TestService/hpc.microsoft.com.session.xsd new file mode 100644 index 0000000..86e2479 --- /dev/null +++ b/test/TestService/hpc.microsoft.com.session.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/makejar.cmd b/test/TestService/makejar.cmd new file mode 100644 index 0000000..40cea6d --- /dev/null +++ b/test/TestService/makejar.cmd @@ -0,0 +1,20 @@ +@echo off +setlocal + +set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 +set JAVAC="%JAVA_HOME%\bin\javac.exe" +set CXF_HOME=c:\java\apache-cxf-2.4.0 +set CLASSPATH=.;..\Microsoft-HpcSession-3.0.jar;%CXF_HOME%\lib\cxf-manifest.jar + + +dir src.list > nul 2>&1 && del src.list + +echo Compiling +FOR /F %%i IN ('dir /b/s *.java') DO echo %%i >> src.list +%javac% -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" @src.list + +echo Packing +"%JAVA_HOME%\bin\jar.exe" cf JavaTestService.jar org com + +echo Done + diff --git a/test/TestService/makejar.sh b/test/TestService/makejar.sh new file mode 100644 index 0000000..b9e6d54 --- /dev/null +++ b/test/TestService/makejar.sh @@ -0,0 +1,14 @@ +#!bin/sh +export CXF_HOME=/usr/java/apache-cxf-2.4.0 +export JAVA_HOME=/usr/java/jdk1.6.0_23 +export CLASSPATH=.:../Microsoft-HpcSession-3.0.jar:$CXF_HOME/lib/cxf-manifest.jar + +echo Compiling +find . -name *.java -print | xargs $JAVA_HOME/bin/javac -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" + +echo Packing + +$JAVA_HOME/bin/jar cf JavaTestService.jar org com + +echo Done + diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/CommonDataError.java b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/CommonDataError.java new file mode 100644 index 0000000..ca89e9a --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/CommonDataError.java @@ -0,0 +1,92 @@ + +package org.datacontract.schemas._2004._07.aitestlib; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CommonDataError complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CommonDataError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ErrorCode" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="Reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CommonDataError", propOrder = { + "errorCode", + "reason" +}) +public class CommonDataError { + + @XmlElement(name = "ErrorCode") + protected Integer errorCode; + @XmlElementRef(name = "Reason", namespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper", type = JAXBElement.class, required = false) + protected JAXBElement reason; + + /** + * Gets the value of the errorCode property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getErrorCode() { + return errorCode; + } + + /** + * Sets the value of the errorCode property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setErrorCode(Integer value) { + this.errorCode = value; + } + + /** + * Gets the value of the reason property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReason() { + return reason; + } + + /** + * Sets the value of the reason property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReason(JAXBElement value) { + this.reason = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/ObjectFactory.java b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/ObjectFactory.java new file mode 100644 index 0000000..60110a2 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/ObjectFactory.java @@ -0,0 +1,63 @@ + +package org.datacontract.schemas._2004._07.aitestlib; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.datacontract.schemas._2004._07.aitestlib package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _CommonDataError_QNAME = new QName("http://schemas.datacontract.org/2004/07/AITestLib.Helper", "CommonDataError"); + private final static QName _CommonDataErrorReason_QNAME = new QName("http://schemas.datacontract.org/2004/07/AITestLib.Helper", "Reason"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.datacontract.schemas._2004._07.aitestlib + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link CommonDataError } + * + */ + public CommonDataError createCommonDataError() { + return new CommonDataError(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CommonDataError }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper", name = "CommonDataError") + public JAXBElement createCommonDataError(CommonDataError value) { + return new JAXBElement(_CommonDataError_QNAME, CommonDataError.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper", name = "Reason", scope = CommonDataError.class) + public JAXBElement createCommonDataErrorReason(String value) { + return new JAXBElement(_CommonDataErrorReason_QNAME, String.class, CommonDataError.class, value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/package-info.java b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/package-info.java new file mode 100644 index 0000000..a72fb04 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.datacontract.schemas._2004._07.aitestlib; diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassFoo.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassFoo.java new file mode 100644 index 0000000..422d537 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassFoo.java @@ -0,0 +1,144 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ClassFoo complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ClassFoo">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="e" type="{http://schemas.datacontract.org/2004/07/services}TestEnum" minOccurs="0"/>
+ *         <element name="f" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
+ *         <element name="i" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ClassFoo", propOrder = { + "e", + "f", + "i", + "s" +}) +public class ClassFoo { + + protected TestEnum e; + protected Float f; + protected Integer i; + @XmlElementRef(name = "s", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement s; + + /** + * Gets the value of the e property. + * + * @return + * possible object is + * {@link TestEnum } + * + */ + public TestEnum getE() { + return e; + } + + /** + * Sets the value of the e property. + * + * @param value + * allowed object is + * {@link TestEnum } + * + */ + public void setE(TestEnum value) { + this.e = value; + } + + /** + * Gets the value of the f property. + * + * @return + * possible object is + * {@link Float } + * + */ + public Float getF() { + return f; + } + + /** + * Sets the value of the f property. + * + * @param value + * allowed object is + * {@link Float } + * + */ + public void setF(Float value) { + this.f = value; + } + + /** + * Gets the value of the i property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getI() { + return i; + } + + /** + * Sets the value of the i property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setI(Integer value) { + this.i = value; + } + + /** + * Gets the value of the s property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getS() { + return s; + } + + /** + * Sets the value of the s property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setS(JAXBElement value) { + this.s = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassObj.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassObj.java new file mode 100644 index 0000000..5598807 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassObj.java @@ -0,0 +1,95 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ClassObj complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ClassObj">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="o" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ClassObj", propOrder = { + "o", + "type" +}) +@XmlSeeAlso({ + ClassStr.class +}) +public class ClassObj { + + @XmlElementRef(name = "o", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement o; + @XmlElementRef(name = "type", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement type; + + /** + * Gets the value of the o property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public JAXBElement getO() { + return o; + } + + /** + * Sets the value of the o property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public void setO(JAXBElement value) { + this.o = ((JAXBElement ) value); + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setType(JAXBElement value) { + this.type = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassStr.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassStr.java new file mode 100644 index 0000000..c50e283 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ClassStr.java @@ -0,0 +1,65 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ClassStr complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ClassStr">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/services}ClassObj">
+ *       <sequence>
+ *         <element name="str" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ClassStr", propOrder = { + "str" +}) +public class ClassStr + extends ClassObj +{ + + @XmlElementRef(name = "str", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement str; + + /** + * Gets the value of the str property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getStr() { + return str; + } + + /** + * Sets the value of the str property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setStr(JAXBElement value) { + this.str = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java new file mode 100644 index 0000000..536d326 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java @@ -0,0 +1,409 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.XMLGregorianCalendar; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; + + +/** + *

Java class for ComputerInfo complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ComputerInfo">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="callIn" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *         <element name="callOut" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *         <element name="envs" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfKeyValueOfstringstring" minOccurs="0"/>
+ *         <element name="jobID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="onExitCalled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="processId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="runAsUser" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="scheduler" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="sub" type="{http://schemas.datacontract.org/2004/07/services}Sub" minOccurs="0"/>
+ *         <element name="taskID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ts" type="{http://schemas.datacontract.org/2004/07/services}TestStruct" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ComputerInfo", propOrder = { + "name", + "callIn", + "callOut", + "envs", + "jobID", + "onExitCalled", + "processId", + "refID", + "runAsUser", + "scheduler", + "sub", + "taskID", + "ts" +}) +public class ComputerInfo { + + @XmlElementRef(name = "Name", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement name; + @XmlElement(name = "callIn", namespace = "http://schemas.datacontract.org/2004/07/services") + protected XMLGregorianCalendar callIn; + @XmlElement(name = "callOut", namespace = "http://schemas.datacontract.org/2004/07/services") + protected XMLGregorianCalendar callOut; + @XmlElementRef(name = "envs", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement envs; + @XmlElement(name = "jobID", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer jobID; + @XmlElement(name = "onExitCalled", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Boolean onExitCalled; + @XmlElement(name = "processId", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer processId; + @XmlElement(name = "refID", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer refID; + @XmlElementRef(name = "runAsUser", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement runAsUser; + @XmlElementRef(name = "scheduler", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement scheduler; + @XmlElementRef(name = "sub", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement sub; + @XmlElement(name = "taskID", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer taskID; + @XmlElement(name = "ts", namespace = "http://schemas.datacontract.org/2004/07/services") + protected TestStruct ts; + + public ComputerInfo() + { + ObjectFactory fact = new ObjectFactory(); + envs = fact.createComputerInfoEnvs(new com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring()); + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setName(JAXBElement value) { + this.name = ((JAXBElement ) value); + } + + /** + * Gets the value of the callIn property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getCallIn() { + return callIn; + } + + /** + * Sets the value of the callIn property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setCallIn(XMLGregorianCalendar value) { + this.callIn = value; + } + + /** + * Gets the value of the callOut property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getCallOut() { + return callOut; + } + + /** + * Sets the value of the callOut property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setCallOut(XMLGregorianCalendar value) { + this.callOut = value; + } + + /** + * Gets the value of the envs property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >} + * + */ + public JAXBElement getEnvs() { + return envs; + } + + /** + * Sets the value of the envs property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >} + * + */ + public void setEnvs(JAXBElement value) { + this.envs = ((JAXBElement ) value); + } + + /** + * Gets the value of the jobID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getJobID() { + return jobID; + } + + /** + * Sets the value of the jobID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setJobID(Integer value) { + this.jobID = value; + } + + /** + * Gets the value of the onExitCalled property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isOnExitCalled() { + return onExitCalled; + } + + /** + * Sets the value of the onExitCalled property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setOnExitCalled(Boolean value) { + this.onExitCalled = value; + } + + /** + * Gets the value of the processId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getProcessId() { + return processId; + } + + /** + * Sets the value of the processId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setProcessId(Integer value) { + this.processId = value; + } + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the runAsUser property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getRunAsUser() { + return runAsUser; + } + + /** + * Sets the value of the runAsUser property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setRunAsUser(JAXBElement value) { + this.runAsUser = ((JAXBElement ) value); + } + + /** + * Gets the value of the scheduler property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getScheduler() { + return scheduler; + } + + /** + * Sets the value of the scheduler property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setScheduler(JAXBElement value) { + this.scheduler = ((JAXBElement ) value); + } + + /** + * Gets the value of the sub property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Sub }{@code >} + * + */ + public JAXBElement getSub() { + return sub; + } + + /** + * Sets the value of the sub property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Sub }{@code >} + * + */ + public void setSub(JAXBElement value) { + this.sub = ((JAXBElement ) value); + } + + /** + * Gets the value of the taskID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getTaskID() { + return taskID; + } + + /** + * Sets the value of the taskID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setTaskID(Integer value) { + this.taskID = value; + } + + /** + * Gets the value of the ts property. + * + * @return + * possible object is + * {@link TestStruct } + * + */ + public TestStruct getTs() { + return ts; + } + + /** + * Sets the value of the ts property. + * + * @param value + * allowed object is + * {@link TestStruct } + * + */ + public void setTs(TestStruct value) { + this.ts = value; + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfoSub.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfoSub.java new file mode 100644 index 0000000..26c8437 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfoSub.java @@ -0,0 +1,148 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ComputerInfo.Sub complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ComputerInfo.Sub">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sub_e" type="{http://schemas.datacontract.org/2004/07/services}TestEnum" minOccurs="0"/>
+ *         <element name="sub_f" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
+ *         <element name="sub_i" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="sub_s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ComputerInfo.Sub", propOrder = { + "subE", + "subF", + "subI", + "subS" +}) +public class ComputerInfoSub { + + @XmlElement(name = "sub_e") + protected TestEnum subE; + @XmlElement(name = "sub_f") + protected Float subF; + @XmlElement(name = "sub_i") + protected Integer subI; + @XmlElementRef(name = "sub_s", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement subS; + + /** + * Gets the value of the subE property. + * + * @return + * possible object is + * {@link TestEnum } + * + */ + public TestEnum getSubE() { + return subE; + } + + /** + * Sets the value of the subE property. + * + * @param value + * allowed object is + * {@link TestEnum } + * + */ + public void setSubE(TestEnum value) { + this.subE = value; + } + + /** + * Gets the value of the subF property. + * + * @return + * possible object is + * {@link Float } + * + */ + public Float getSubF() { + return subF; + } + + /** + * Sets the value of the subF property. + * + * @param value + * allowed object is + * {@link Float } + * + */ + public void setSubF(Float value) { + this.subF = value; + } + + /** + * Gets the value of the subI property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSubI() { + return subI; + } + + /** + * Sets the value of the subI property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSubI(Integer value) { + this.subI = value; + } + + /** + * Gets the value of the subS property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getSubS() { + return subS; + } + + /** + * Sets the value of the subS property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setSubS(JAXBElement value) { + this.subS = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java new file mode 100644 index 0000000..141f8c9 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java @@ -0,0 +1,301 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.datacontract.schemas._2004._07.services package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _TestStruct_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "TestStruct"); + private final static QName _ComputerInfo_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "ComputerInfo"); + private final static QName _ClassObj_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "ClassObj"); + private final static QName _TestEnum_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "TestEnum"); + private final static QName _ClassFoo_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "ClassFoo"); + private final static QName _StatisticInfo_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "StatisticInfo"); + private final static QName _ClassStr_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "ClassStr"); + private final static QName _Sub_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "Sub"); + private final static QName _ComputerInfoRunAsUser_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "runAsUser"); + private final static QName _ComputerInfoEnvs_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "envs"); + private final static QName _ComputerInfoScheduler_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "scheduler"); + private final static QName _ComputerInfoName_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "Name"); + private final static QName _ComputerInfoSub_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "sub"); + private final static QName _SubSubS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "sub_s"); + private final static QName _ClassObjType_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "type"); + private final static QName _ClassObjO_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "o"); + private final static QName _StatisticInfoInstanceId_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "instanceId"); + private final static QName _StatisticInfoResponseData_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "responseData"); + private final static QName _TestStructS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "s"); + private final static QName _ClassStrStr_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "str"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.datacontract.schemas._2004._07.services + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ComputerInfo } + * + */ + public ComputerInfo createComputerInfo() { + return new ComputerInfo(); + } + + /** + * Create an instance of {@link StatisticInfo } + * + */ + public StatisticInfo createStatisticInfo() { + return new StatisticInfo(); + } + + /** + * Create an instance of {@link ClassFoo } + * + */ + public ClassFoo createClassFoo() { + return new ClassFoo(); + } + + /** + * Create an instance of {@link ClassObj } + * + */ + public ClassObj createClassObj() { + return new ClassObj(); + } + + /** + * Create an instance of {@link TestStruct } + * + */ + public TestStruct createTestStruct() { + return new TestStruct(); + } + + /** + * Create an instance of {@link ClassStr } + * + */ + public ClassStr createClassStr() { + return new ClassStr(); + } + + /** + * Create an instance of {@link Sub } + * + */ + public Sub createSub() { + return new Sub(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TestStruct }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "TestStruct") + public JAXBElement createTestStruct(TestStruct value) { + return new JAXBElement(_TestStruct_QNAME, TestStruct.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "ComputerInfo") + public JAXBElement createComputerInfo(ComputerInfo value) { + return new JAXBElement(_ComputerInfo_QNAME, ComputerInfo.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassObj }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "ClassObj") + public JAXBElement createClassObj(ClassObj value) { + return new JAXBElement(_ClassObj_QNAME, ClassObj.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TestEnum }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "TestEnum") + public JAXBElement createTestEnum(TestEnum value) { + return new JAXBElement(_TestEnum_QNAME, TestEnum.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassFoo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "ClassFoo") + public JAXBElement createClassFoo(ClassFoo value) { + return new JAXBElement(_ClassFoo_QNAME, ClassFoo.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "StatisticInfo") + public JAXBElement createStatisticInfo(StatisticInfo value) { + return new JAXBElement(_StatisticInfo_QNAME, StatisticInfo.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassStr }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "ClassStr") + public JAXBElement createClassStr(ClassStr value) { + return new JAXBElement(_ClassStr_QNAME, ClassStr.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Sub }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "Sub") + public JAXBElement createSub(Sub value) { + return new JAXBElement(_Sub_QNAME, Sub.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "runAsUser", scope = ComputerInfo.class) + public JAXBElement createComputerInfoRunAsUser(String value) { + return new JAXBElement(_ComputerInfoRunAsUser_QNAME, String.class, ComputerInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "envs", scope = ComputerInfo.class) + public JAXBElement createComputerInfoEnvs(ArrayOfKeyValueOfstringstring value) { + return new JAXBElement(_ComputerInfoEnvs_QNAME, ArrayOfKeyValueOfstringstring.class, ComputerInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "scheduler", scope = ComputerInfo.class) + public JAXBElement createComputerInfoScheduler(String value) { + return new JAXBElement(_ComputerInfoScheduler_QNAME, String.class, ComputerInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "Name", scope = ComputerInfo.class) + public JAXBElement createComputerInfoName(String value) { + return new JAXBElement(_ComputerInfoName_QNAME, String.class, ComputerInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Sub }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "sub", scope = ComputerInfo.class) + public JAXBElement createComputerInfoSub(Sub value) { + return new JAXBElement(_ComputerInfoSub_QNAME, Sub.class, ComputerInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "sub_s", scope = Sub.class) + public JAXBElement createSubSubS(String value) { + return new JAXBElement(_SubSubS_QNAME, String.class, Sub.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "type", scope = ClassObj.class) + public JAXBElement createClassObjType(String value) { + return new JAXBElement(_ClassObjType_QNAME, String.class, ClassObj.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "o", scope = ClassObj.class) + public JAXBElement createClassObjO(Object value) { + return new JAXBElement(_ClassObjO_QNAME, Object.class, ClassObj.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "instanceId", scope = StatisticInfo.class) + public JAXBElement createStatisticInfoInstanceId(String value) { + return new JAXBElement(_StatisticInfoInstanceId_QNAME, String.class, StatisticInfo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "responseData", scope = StatisticInfo.class) + public JAXBElement createStatisticInfoResponseData(byte[] value) { + return new JAXBElement(_StatisticInfoResponseData_QNAME, byte[].class, StatisticInfo.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "s", scope = TestStruct.class) + public JAXBElement createTestStructS(String value) { + return new JAXBElement(_TestStructS_QNAME, String.class, TestStruct.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "str", scope = ClassStr.class) + public JAXBElement createClassStrStr(String value) { + return new JAXBElement(_ClassStrStr_QNAME, String.class, ClassStr.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/services", name = "s", scope = ClassFoo.class) + public JAXBElement createClassFooS(String value) { + return new JAXBElement(_TestStructS_QNAME, String.class, ClassFoo.class, value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/StatisticInfo.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/StatisticInfo.java new file mode 100644 index 0000000..09a4a0e --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/StatisticInfo.java @@ -0,0 +1,180 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.XMLGregorianCalendar; + + +/** + *

Java class for StatisticInfo complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="StatisticInfo">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="endTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *         <element name="instanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="responseData" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *         <element name="startTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "StatisticInfo", propOrder = { + "endTime", + "instanceId", + "refID", + "responseData", + "startTime" +}) +public class StatisticInfo { + + @XmlSchemaType(name = "dateTime") + @XmlElement(name = "endTime", namespace = "http://schemas.datacontract.org/2004/07/services") + protected XMLGregorianCalendar endTime; + @XmlElementRef(name = "instanceId", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement instanceId; + @XmlElement(name = "refID", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer refID; + @XmlElementRef(name = "responseData", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement responseData; + @XmlSchemaType(name = "dateTime") + @XmlElement(name = "startTime", namespace = "http://schemas.datacontract.org/2004/07/services") + protected XMLGregorianCalendar startTime; + + /** + * Gets the value of the endTime property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getEndTime() { + return endTime; + } + + /** + * Sets the value of the endTime property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setEndTime(XMLGregorianCalendar value) { + this.endTime = value; + } + + /** + * Gets the value of the instanceId property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getInstanceId() { + return instanceId; + } + + /** + * Sets the value of the instanceId property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setInstanceId(JAXBElement value) { + this.instanceId = ((JAXBElement ) value); + } + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the responseData property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getResponseData() { + return responseData; + } + + /** + * Sets the value of the responseData property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setResponseData(JAXBElement value) { + this.responseData = ((JAXBElement ) value); + } + + /** + * Gets the value of the startTime property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getStartTime() { + return startTime; + } + + /** + * Sets the value of the startTime property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setStartTime(XMLGregorianCalendar value) { + this.startTime = value; + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/Sub.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/Sub.java new file mode 100644 index 0000000..21378f8 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/Sub.java @@ -0,0 +1,148 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for Sub complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Sub">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="sub_e" type="{http://schemas.datacontract.org/2004/07/services}TestEnum" minOccurs="0"/>
+ *         <element name="sub_f" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
+ *         <element name="sub_i" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="sub_s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Sub", propOrder = { + "subE", + "subF", + "subI", + "subS" +}) +public class Sub { + + @XmlElement(name = "sub_e", namespace = "http://schemas.datacontract.org/2004/07/services") + protected TestEnum subE; + @XmlElement(name = "sub_f", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Float subF; + @XmlElement(name = "sub_i", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer subI; + @XmlElementRef(name = "sub_s", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement subS; + + /** + * Gets the value of the subE property. + * + * @return + * possible object is + * {@link TestEnum } + * + */ + public TestEnum getSubE() { + return subE; + } + + /** + * Sets the value of the subE property. + * + * @param value + * allowed object is + * {@link TestEnum } + * + */ + public void setSubE(TestEnum value) { + this.subE = value; + } + + /** + * Gets the value of the subF property. + * + * @return + * possible object is + * {@link Float } + * + */ + public Float getSubF() { + return subF; + } + + /** + * Sets the value of the subF property. + * + * @param value + * allowed object is + * {@link Float } + * + */ + public void setSubF(Float value) { + this.subF = value; + } + + /** + * Gets the value of the subI property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getSubI() { + return subI; + } + + /** + * Sets the value of the subI property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setSubI(Integer value) { + this.subI = value; + } + + /** + * Gets the value of the subS property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getSubS() { + return subS; + } + + /** + * Sets the value of the subS property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setSubS(JAXBElement value) { + this.subS = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/TestEnum.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/TestEnum.java new file mode 100644 index 0000000..e5fb2d7 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/TestEnum.java @@ -0,0 +1,57 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for TestEnum. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="TestEnum">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="e0"/>
+ *     <enumeration value="e1"/>
+ *     <enumeration value="e2"/>
+ *     <enumeration value="e3"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "TestEnum") +@XmlEnum +public enum TestEnum { + + @XmlEnumValue("e0") + E_0("e0"), + @XmlEnumValue("e1") + E_1("e1"), + @XmlEnumValue("e2") + E_2("e2"), + @XmlEnumValue("e3") + E_3("e3"); + private final String value; + + TestEnum(String v) { + value = v; + } + + public String value() { + return value; + } + + public static TestEnum fromValue(String v) { + for (TestEnum c: TestEnum.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/TestStruct.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/TestStruct.java new file mode 100644 index 0000000..9b3525b --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/TestStruct.java @@ -0,0 +1,232 @@ + +package org.datacontract.schemas._2004._07.services; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for TestStruct complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="TestStruct">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="d" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
+ *         <element name="e" type="{http://schemas.datacontract.org/2004/07/services}TestEnum" minOccurs="0"/>
+ *         <element name="f" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
+ *         <element name="i32_1" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="i32_2" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="i64" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TestStruct", propOrder = { + "d", + "e", + "f", + "i321", + "i322", + "i64", + "s" +}) +public class TestStruct { + + @XmlElement(name = "d", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Double d; + @XmlElement(name = "e", namespace = "http://schemas.datacontract.org/2004/07/services") + protected TestEnum e; + @XmlElement(name = "f", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Float f; + @XmlElement(name = "i32_1", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer i321; + @XmlElement(name = "i32_2", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Integer i322; + @XmlElement(name = "i64", namespace = "http://schemas.datacontract.org/2004/07/services") + protected Long i64; + @XmlElementRef(name = "s", namespace = "http://schemas.datacontract.org/2004/07/services", type = JAXBElement.class, required = false) + protected JAXBElement s; + + /** + * Gets the value of the d property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getD() { + return d; + } + + /** + * Sets the value of the d property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setD(Double value) { + this.d = value; + } + + /** + * Gets the value of the e property. + * + * @return + * possible object is + * {@link TestEnum } + * + */ + public TestEnum getE() { + return e; + } + + /** + * Sets the value of the e property. + * + * @param value + * allowed object is + * {@link TestEnum } + * + */ + public void setE(TestEnum value) { + this.e = value; + } + + /** + * Gets the value of the f property. + * + * @return + * possible object is + * {@link Float } + * + */ + public Float getF() { + return f; + } + + /** + * Sets the value of the f property. + * + * @param value + * allowed object is + * {@link Float } + * + */ + public void setF(Float value) { + this.f = value; + } + + /** + * Gets the value of the i321 property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getI321() { + return i321; + } + + /** + * Sets the value of the i321 property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setI321(Integer value) { + this.i321 = value; + } + + /** + * Gets the value of the i322 property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getI322() { + return i322; + } + + /** + * Sets the value of the i322 property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setI322(Integer value) { + this.i322 = value; + } + + /** + * Gets the value of the i64 property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getI64() { + return i64; + } + + /** + * Sets the value of the i64 property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setI64(Long value) { + this.i64 = value; + } + + /** + * Gets the value of the s property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getS() { + return s; + } + + /** + * Sets the value of the s property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setS(JAXBElement value) { + this.s = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/package-info.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/package-info.java new file mode 100644 index 0000000..dd56638 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.datacontract.org/2004/07/services", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.datacontract.schemas._2004._07.services; diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentException.java new file mode 100644 index 0000000..7c1f7af --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentException.java @@ -0,0 +1,36 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArgumentException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArgumentException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}SystemException">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArgumentException") +@XmlSeeAlso({ + ArgumentNullException.class +}) +public class ArgumentException + extends SystemException +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentNullException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentNullException.java new file mode 100644 index 0000000..072a30f --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentNullException.java @@ -0,0 +1,32 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArgumentNullException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArgumentNullException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}ArgumentException">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArgumentNullException") +public class ArgumentNullException + extends ArgumentException +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ArithmeticException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArithmeticException.java new file mode 100644 index 0000000..8c29346 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ArithmeticException.java @@ -0,0 +1,36 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArithmeticException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArithmeticException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}SystemException">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArithmeticException") +@XmlSeeAlso({ + DivideByZeroException.class +}) +public class ArithmeticException + extends SystemException +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKey.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKey.java new file mode 100644 index 0000000..ea47821 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKey.java @@ -0,0 +1,451 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ConsoleKey. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="ConsoleKey">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="Backspace"/>
+ *     <enumeration value="Tab"/>
+ *     <enumeration value="Clear"/>
+ *     <enumeration value="Enter"/>
+ *     <enumeration value="Pause"/>
+ *     <enumeration value="Escape"/>
+ *     <enumeration value="Spacebar"/>
+ *     <enumeration value="PageUp"/>
+ *     <enumeration value="PageDown"/>
+ *     <enumeration value="End"/>
+ *     <enumeration value="Home"/>
+ *     <enumeration value="LeftArrow"/>
+ *     <enumeration value="UpArrow"/>
+ *     <enumeration value="RightArrow"/>
+ *     <enumeration value="DownArrow"/>
+ *     <enumeration value="Select"/>
+ *     <enumeration value="Print"/>
+ *     <enumeration value="Execute"/>
+ *     <enumeration value="PrintScreen"/>
+ *     <enumeration value="Insert"/>
+ *     <enumeration value="Delete"/>
+ *     <enumeration value="Help"/>
+ *     <enumeration value="D0"/>
+ *     <enumeration value="D1"/>
+ *     <enumeration value="D2"/>
+ *     <enumeration value="D3"/>
+ *     <enumeration value="D4"/>
+ *     <enumeration value="D5"/>
+ *     <enumeration value="D6"/>
+ *     <enumeration value="D7"/>
+ *     <enumeration value="D8"/>
+ *     <enumeration value="D9"/>
+ *     <enumeration value="A"/>
+ *     <enumeration value="B"/>
+ *     <enumeration value="C"/>
+ *     <enumeration value="D"/>
+ *     <enumeration value="E"/>
+ *     <enumeration value="F"/>
+ *     <enumeration value="G"/>
+ *     <enumeration value="H"/>
+ *     <enumeration value="I"/>
+ *     <enumeration value="J"/>
+ *     <enumeration value="K"/>
+ *     <enumeration value="L"/>
+ *     <enumeration value="M"/>
+ *     <enumeration value="N"/>
+ *     <enumeration value="O"/>
+ *     <enumeration value="P"/>
+ *     <enumeration value="Q"/>
+ *     <enumeration value="R"/>
+ *     <enumeration value="S"/>
+ *     <enumeration value="T"/>
+ *     <enumeration value="U"/>
+ *     <enumeration value="V"/>
+ *     <enumeration value="W"/>
+ *     <enumeration value="X"/>
+ *     <enumeration value="Y"/>
+ *     <enumeration value="Z"/>
+ *     <enumeration value="LeftWindows"/>
+ *     <enumeration value="RightWindows"/>
+ *     <enumeration value="Applications"/>
+ *     <enumeration value="Sleep"/>
+ *     <enumeration value="NumPad0"/>
+ *     <enumeration value="NumPad1"/>
+ *     <enumeration value="NumPad2"/>
+ *     <enumeration value="NumPad3"/>
+ *     <enumeration value="NumPad4"/>
+ *     <enumeration value="NumPad5"/>
+ *     <enumeration value="NumPad6"/>
+ *     <enumeration value="NumPad7"/>
+ *     <enumeration value="NumPad8"/>
+ *     <enumeration value="NumPad9"/>
+ *     <enumeration value="Multiply"/>
+ *     <enumeration value="Add"/>
+ *     <enumeration value="Separator"/>
+ *     <enumeration value="Subtract"/>
+ *     <enumeration value="Decimal"/>
+ *     <enumeration value="Divide"/>
+ *     <enumeration value="F1"/>
+ *     <enumeration value="F2"/>
+ *     <enumeration value="F3"/>
+ *     <enumeration value="F4"/>
+ *     <enumeration value="F5"/>
+ *     <enumeration value="F6"/>
+ *     <enumeration value="F7"/>
+ *     <enumeration value="F8"/>
+ *     <enumeration value="F9"/>
+ *     <enumeration value="F10"/>
+ *     <enumeration value="F11"/>
+ *     <enumeration value="F12"/>
+ *     <enumeration value="F13"/>
+ *     <enumeration value="F14"/>
+ *     <enumeration value="F15"/>
+ *     <enumeration value="F16"/>
+ *     <enumeration value="F17"/>
+ *     <enumeration value="F18"/>
+ *     <enumeration value="F19"/>
+ *     <enumeration value="F20"/>
+ *     <enumeration value="F21"/>
+ *     <enumeration value="F22"/>
+ *     <enumeration value="F23"/>
+ *     <enumeration value="F24"/>
+ *     <enumeration value="BrowserBack"/>
+ *     <enumeration value="BrowserForward"/>
+ *     <enumeration value="BrowserRefresh"/>
+ *     <enumeration value="BrowserStop"/>
+ *     <enumeration value="BrowserSearch"/>
+ *     <enumeration value="BrowserFavorites"/>
+ *     <enumeration value="BrowserHome"/>
+ *     <enumeration value="VolumeMute"/>
+ *     <enumeration value="VolumeDown"/>
+ *     <enumeration value="VolumeUp"/>
+ *     <enumeration value="MediaNext"/>
+ *     <enumeration value="MediaPrevious"/>
+ *     <enumeration value="MediaStop"/>
+ *     <enumeration value="MediaPlay"/>
+ *     <enumeration value="LaunchMail"/>
+ *     <enumeration value="LaunchMediaSelect"/>
+ *     <enumeration value="LaunchApp1"/>
+ *     <enumeration value="LaunchApp2"/>
+ *     <enumeration value="Oem1"/>
+ *     <enumeration value="OemPlus"/>
+ *     <enumeration value="OemComma"/>
+ *     <enumeration value="OemMinus"/>
+ *     <enumeration value="OemPeriod"/>
+ *     <enumeration value="Oem2"/>
+ *     <enumeration value="Oem3"/>
+ *     <enumeration value="Oem4"/>
+ *     <enumeration value="Oem5"/>
+ *     <enumeration value="Oem6"/>
+ *     <enumeration value="Oem7"/>
+ *     <enumeration value="Oem8"/>
+ *     <enumeration value="Oem102"/>
+ *     <enumeration value="Process"/>
+ *     <enumeration value="Packet"/>
+ *     <enumeration value="Attention"/>
+ *     <enumeration value="CrSel"/>
+ *     <enumeration value="ExSel"/>
+ *     <enumeration value="EraseEndOfFile"/>
+ *     <enumeration value="Play"/>
+ *     <enumeration value="Zoom"/>
+ *     <enumeration value="NoName"/>
+ *     <enumeration value="Pa1"/>
+ *     <enumeration value="OemClear"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "ConsoleKey") +@XmlEnum +public enum ConsoleKey { + + @XmlEnumValue("Backspace") + BACKSPACE("Backspace"), + @XmlEnumValue("Tab") + TAB("Tab"), + @XmlEnumValue("Clear") + CLEAR("Clear"), + @XmlEnumValue("Enter") + ENTER("Enter"), + @XmlEnumValue("Pause") + PAUSE("Pause"), + @XmlEnumValue("Escape") + ESCAPE("Escape"), + @XmlEnumValue("Spacebar") + SPACEBAR("Spacebar"), + @XmlEnumValue("PageUp") + PAGE_UP("PageUp"), + @XmlEnumValue("PageDown") + PAGE_DOWN("PageDown"), + @XmlEnumValue("End") + END("End"), + @XmlEnumValue("Home") + HOME("Home"), + @XmlEnumValue("LeftArrow") + LEFT_ARROW("LeftArrow"), + @XmlEnumValue("UpArrow") + UP_ARROW("UpArrow"), + @XmlEnumValue("RightArrow") + RIGHT_ARROW("RightArrow"), + @XmlEnumValue("DownArrow") + DOWN_ARROW("DownArrow"), + @XmlEnumValue("Select") + SELECT("Select"), + @XmlEnumValue("Print") + PRINT("Print"), + @XmlEnumValue("Execute") + EXECUTE("Execute"), + @XmlEnumValue("PrintScreen") + PRINT_SCREEN("PrintScreen"), + @XmlEnumValue("Insert") + INSERT("Insert"), + @XmlEnumValue("Delete") + DELETE("Delete"), + @XmlEnumValue("Help") + HELP("Help"), + @XmlEnumValue("D0") + D_0("D0"), + @XmlEnumValue("D1") + D_1("D1"), + @XmlEnumValue("D2") + D_2("D2"), + @XmlEnumValue("D3") + D_3("D3"), + @XmlEnumValue("D4") + D_4("D4"), + @XmlEnumValue("D5") + D_5("D5"), + @XmlEnumValue("D6") + D_6("D6"), + @XmlEnumValue("D7") + D_7("D7"), + @XmlEnumValue("D8") + D_8("D8"), + @XmlEnumValue("D9") + D_9("D9"), + A("A"), + B("B"), + C("C"), + D("D"), + E("E"), + F("F"), + G("G"), + H("H"), + I("I"), + J("J"), + K("K"), + L("L"), + M("M"), + N("N"), + O("O"), + P("P"), + Q("Q"), + R("R"), + S("S"), + T("T"), + U("U"), + V("V"), + W("W"), + X("X"), + Y("Y"), + Z("Z"), + @XmlEnumValue("LeftWindows") + LEFT_WINDOWS("LeftWindows"), + @XmlEnumValue("RightWindows") + RIGHT_WINDOWS("RightWindows"), + @XmlEnumValue("Applications") + APPLICATIONS("Applications"), + @XmlEnumValue("Sleep") + SLEEP("Sleep"), + @XmlEnumValue("NumPad0") + NUM_PAD_0("NumPad0"), + @XmlEnumValue("NumPad1") + NUM_PAD_1("NumPad1"), + @XmlEnumValue("NumPad2") + NUM_PAD_2("NumPad2"), + @XmlEnumValue("NumPad3") + NUM_PAD_3("NumPad3"), + @XmlEnumValue("NumPad4") + NUM_PAD_4("NumPad4"), + @XmlEnumValue("NumPad5") + NUM_PAD_5("NumPad5"), + @XmlEnumValue("NumPad6") + NUM_PAD_6("NumPad6"), + @XmlEnumValue("NumPad7") + NUM_PAD_7("NumPad7"), + @XmlEnumValue("NumPad8") + NUM_PAD_8("NumPad8"), + @XmlEnumValue("NumPad9") + NUM_PAD_9("NumPad9"), + @XmlEnumValue("Multiply") + MULTIPLY("Multiply"), + @XmlEnumValue("Add") + ADD("Add"), + @XmlEnumValue("Separator") + SEPARATOR("Separator"), + @XmlEnumValue("Subtract") + SUBTRACT("Subtract"), + @XmlEnumValue("Decimal") + DECIMAL("Decimal"), + @XmlEnumValue("Divide") + DIVIDE("Divide"), + @XmlEnumValue("F1") + F_1("F1"), + @XmlEnumValue("F2") + F_2("F2"), + @XmlEnumValue("F3") + F_3("F3"), + @XmlEnumValue("F4") + F_4("F4"), + @XmlEnumValue("F5") + F_5("F5"), + @XmlEnumValue("F6") + F_6("F6"), + @XmlEnumValue("F7") + F_7("F7"), + @XmlEnumValue("F8") + F_8("F8"), + @XmlEnumValue("F9") + F_9("F9"), + @XmlEnumValue("F10") + F_10("F10"), + @XmlEnumValue("F11") + F_11("F11"), + @XmlEnumValue("F12") + F_12("F12"), + @XmlEnumValue("F13") + F_13("F13"), + @XmlEnumValue("F14") + F_14("F14"), + @XmlEnumValue("F15") + F_15("F15"), + @XmlEnumValue("F16") + F_16("F16"), + @XmlEnumValue("F17") + F_17("F17"), + @XmlEnumValue("F18") + F_18("F18"), + @XmlEnumValue("F19") + F_19("F19"), + @XmlEnumValue("F20") + F_20("F20"), + @XmlEnumValue("F21") + F_21("F21"), + @XmlEnumValue("F22") + F_22("F22"), + @XmlEnumValue("F23") + F_23("F23"), + @XmlEnumValue("F24") + F_24("F24"), + @XmlEnumValue("BrowserBack") + BROWSER_BACK("BrowserBack"), + @XmlEnumValue("BrowserForward") + BROWSER_FORWARD("BrowserForward"), + @XmlEnumValue("BrowserRefresh") + BROWSER_REFRESH("BrowserRefresh"), + @XmlEnumValue("BrowserStop") + BROWSER_STOP("BrowserStop"), + @XmlEnumValue("BrowserSearch") + BROWSER_SEARCH("BrowserSearch"), + @XmlEnumValue("BrowserFavorites") + BROWSER_FAVORITES("BrowserFavorites"), + @XmlEnumValue("BrowserHome") + BROWSER_HOME("BrowserHome"), + @XmlEnumValue("VolumeMute") + VOLUME_MUTE("VolumeMute"), + @XmlEnumValue("VolumeDown") + VOLUME_DOWN("VolumeDown"), + @XmlEnumValue("VolumeUp") + VOLUME_UP("VolumeUp"), + @XmlEnumValue("MediaNext") + MEDIA_NEXT("MediaNext"), + @XmlEnumValue("MediaPrevious") + MEDIA_PREVIOUS("MediaPrevious"), + @XmlEnumValue("MediaStop") + MEDIA_STOP("MediaStop"), + @XmlEnumValue("MediaPlay") + MEDIA_PLAY("MediaPlay"), + @XmlEnumValue("LaunchMail") + LAUNCH_MAIL("LaunchMail"), + @XmlEnumValue("LaunchMediaSelect") + LAUNCH_MEDIA_SELECT("LaunchMediaSelect"), + @XmlEnumValue("LaunchApp1") + LAUNCH_APP_1("LaunchApp1"), + @XmlEnumValue("LaunchApp2") + LAUNCH_APP_2("LaunchApp2"), + @XmlEnumValue("Oem1") + OEM_1("Oem1"), + @XmlEnumValue("OemPlus") + OEM_PLUS("OemPlus"), + @XmlEnumValue("OemComma") + OEM_COMMA("OemComma"), + @XmlEnumValue("OemMinus") + OEM_MINUS("OemMinus"), + @XmlEnumValue("OemPeriod") + OEM_PERIOD("OemPeriod"), + @XmlEnumValue("Oem2") + OEM_2("Oem2"), + @XmlEnumValue("Oem3") + OEM_3("Oem3"), + @XmlEnumValue("Oem4") + OEM_4("Oem4"), + @XmlEnumValue("Oem5") + OEM_5("Oem5"), + @XmlEnumValue("Oem6") + OEM_6("Oem6"), + @XmlEnumValue("Oem7") + OEM_7("Oem7"), + @XmlEnumValue("Oem8") + OEM_8("Oem8"), + @XmlEnumValue("Oem102") + OEM_102("Oem102"), + @XmlEnumValue("Process") + PROCESS("Process"), + @XmlEnumValue("Packet") + PACKET("Packet"), + @XmlEnumValue("Attention") + ATTENTION("Attention"), + @XmlEnumValue("CrSel") + CR_SEL("CrSel"), + @XmlEnumValue("ExSel") + EX_SEL("ExSel"), + @XmlEnumValue("EraseEndOfFile") + ERASE_END_OF_FILE("EraseEndOfFile"), + @XmlEnumValue("Play") + PLAY("Play"), + @XmlEnumValue("Zoom") + ZOOM("Zoom"), + @XmlEnumValue("NoName") + NO_NAME("NoName"), + @XmlEnumValue("Pa1") + PA_1("Pa1"), + @XmlEnumValue("OemClear") + OEM_CLEAR("OemClear"); + private final String value; + + ConsoleKey(String v) { + value = v; + } + + public String value() { + return value; + } + + public static ConsoleKey fromValue(String v) { + for (ConsoleKey c: ConsoleKey.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKeyInfo.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKeyInfo.java new file mode 100644 index 0000000..1e86aa8 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKeyInfo.java @@ -0,0 +1,119 @@ + +package org.datacontract.schemas._2004._07.system; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlList; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ConsoleKeyInfo complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ConsoleKeyInfo">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="_key" type="{http://schemas.datacontract.org/2004/07/System}ConsoleKey"/>
+ *         <element name="_keyChar" type="{http://schemas.microsoft.com/2003/10/Serialization/}char"/>
+ *         <element name="_mods" type="{http://schemas.datacontract.org/2004/07/System}ConsoleModifiers"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ConsoleKeyInfo", propOrder = { + "key", + "keyChar", + "mods" +}) +public class ConsoleKeyInfo { + + @XmlElement(name = "_key", required = true) + protected ConsoleKey key; + @XmlElement(name = "_keyChar") + protected int keyChar; + @XmlList + @XmlElement(name = "_mods", required = true) + protected List mods; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link ConsoleKey } + * + */ + public ConsoleKey getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link ConsoleKey } + * + */ + public void setKey(ConsoleKey value) { + this.key = value; + } + + /** + * Gets the value of the keyChar property. + * + */ + public int getKeyChar() { + return keyChar; + } + + /** + * Sets the value of the keyChar property. + * + */ + public void setKeyChar(int value) { + this.keyChar = value; + } + + /** + * Gets the value of the mods property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mods property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMods().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMods() { + if (mods == null) { + mods = new ArrayList(); + } + return this.mods; + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/DivideByZeroException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/DivideByZeroException.java new file mode 100644 index 0000000..212aee4 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/DivideByZeroException.java @@ -0,0 +1,32 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for DivideByZeroException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="DivideByZeroException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}ArithmeticException">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "DivideByZeroException") +public class DivideByZeroException + extends ArithmeticException +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/Exception.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/Exception.java new file mode 100644 index 0000000..dbd0181 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/Exception.java @@ -0,0 +1,103 @@ + +package org.datacontract.schemas._2004._07.system; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import javax.xml.namespace.QName; +import org.w3c.dom.Element; + + +/** + *

Java class for Exception complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Exception">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <any processContents='skip' namespace='' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute ref="{http://schemas.microsoft.com/2003/10/Serialization/}FactoryType"/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Exception", propOrder = { + "any" +}) +@XmlSeeAlso({ + SystemException.class +}) +public class Exception { + + @XmlAnyElement + protected List any; + @XmlAttribute(name = "FactoryType", namespace = "http://schemas.microsoft.com/2003/10/Serialization/") + protected QName factoryType; + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + + /** + * Gets the value of the factoryType property. + * + * @return + * possible object is + * {@link QName } + * + */ + public QName getFactoryType() { + return factoryType; + } + + /** + * Sets the value of the factoryType property. + * + * @param value + * allowed object is + * {@link QName } + * + */ + public void setFactoryType(QName value) { + this.factoryType = value; + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java new file mode 100644 index 0000000..a28518e --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java @@ -0,0 +1,200 @@ + +package org.datacontract.schemas._2004._07.system; + +import java.util.List; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.datacontract.schemas._2004._07.system package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ArgumentException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ArgumentException"); + private final static QName _ConsoleKey_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ConsoleKey"); + private final static QName _ArithmeticException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ArithmeticException"); + private final static QName _SystemException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "SystemException"); + private final static QName _OutOfMemoryException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "OutOfMemoryException"); + private final static QName _ArgumentNullException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ArgumentNullException"); + private final static QName _ConsoleModifiers_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ConsoleModifiers"); + private final static QName _ConsoleKeyInfo_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "ConsoleKeyInfo"); + private final static QName _Exception_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "Exception"); + private final static QName _DivideByZeroException_QNAME = new QName("http://schemas.datacontract.org/2004/07/System", "DivideByZeroException"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.datacontract.schemas._2004._07.system + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Exception } + * + */ + public Exception createException() { + return new Exception(); + } + + /** + * Create an instance of {@link ArgumentException } + * + */ + public ArgumentException createArgumentException() { + return new ArgumentException(); + } + + /** + * Create an instance of {@link SystemException } + * + */ + public SystemException createSystemException() { + return new SystemException(); + } + + /** + * Create an instance of {@link DivideByZeroException } + * + */ + public DivideByZeroException createDivideByZeroException() { + return new DivideByZeroException(); + } + + /** + * Create an instance of {@link ConsoleKeyInfo } + * + */ + public ConsoleKeyInfo createConsoleKeyInfo() { + return new ConsoleKeyInfo(); + } + + /** + * Create an instance of {@link ArgumentNullException } + * + */ + public ArgumentNullException createArgumentNullException() { + return new ArgumentNullException(); + } + + /** + * Create an instance of {@link OutOfMemoryException } + * + */ + public OutOfMemoryException createOutOfMemoryException() { + return new OutOfMemoryException(); + } + + /** + * Create an instance of {@link ArithmeticException } + * + */ + public ArithmeticException createArithmeticException() { + return new ArithmeticException(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArgumentException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ArgumentException") + public JAXBElement createArgumentException(ArgumentException value) { + return new JAXBElement(_ArgumentException_QNAME, ArgumentException.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsoleKey }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ConsoleKey") + public JAXBElement createConsoleKey(ConsoleKey value) { + return new JAXBElement(_ConsoleKey_QNAME, ConsoleKey.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArithmeticException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ArithmeticException") + public JAXBElement createArithmeticException(ArithmeticException value) { + return new JAXBElement(_ArithmeticException_QNAME, ArithmeticException.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SystemException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "SystemException") + public JAXBElement createSystemException(SystemException value) { + return new JAXBElement(_SystemException_QNAME, SystemException.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link OutOfMemoryException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "OutOfMemoryException") + public JAXBElement createOutOfMemoryException(OutOfMemoryException value) { + return new JAXBElement(_OutOfMemoryException_QNAME, OutOfMemoryException.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArgumentNullException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ArgumentNullException") + public JAXBElement createArgumentNullException(ArgumentNullException value) { + return new JAXBElement(_ArgumentNullException_QNAME, ArgumentNullException.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link List }{@code <}{@link String }{@code >}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ConsoleModifiers") + public JAXBElement> createConsoleModifiers(List value) { + return new JAXBElement>(_ConsoleModifiers_QNAME, ((Class) List.class), null, ((List ) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsoleKeyInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "ConsoleKeyInfo") + public JAXBElement createConsoleKeyInfo(ConsoleKeyInfo value) { + return new JAXBElement(_ConsoleKeyInfo_QNAME, ConsoleKeyInfo.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Exception }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "Exception") + public JAXBElement createException(Exception value) { + return new JAXBElement(_Exception_QNAME, Exception.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DivideByZeroException }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.datacontract.org/2004/07/System", name = "DivideByZeroException") + public JAXBElement createDivideByZeroException(DivideByZeroException value) { + return new JAXBElement(_DivideByZeroException_QNAME, DivideByZeroException.class, null, value); + } + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/OutOfMemoryException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/OutOfMemoryException.java new file mode 100644 index 0000000..1c5c26a --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/OutOfMemoryException.java @@ -0,0 +1,32 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for OutOfMemoryException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OutOfMemoryException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}SystemException">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OutOfMemoryException") +public class OutOfMemoryException + extends SystemException +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java new file mode 100644 index 0000000..226a0ad --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java @@ -0,0 +1,38 @@ + +package org.datacontract.schemas._2004._07.system; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for SystemException complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SystemException">
+ *   <complexContent>
+ *     <extension base="{http://schemas.datacontract.org/2004/07/System}Exception">
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SystemException") +@XmlSeeAlso({ + ArgumentException.class, + OutOfMemoryException.class, + ArithmeticException.class +}) +public class SystemException + extends Exception +{ + + +} diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/system/package-info.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/package-info.java new file mode 100644 index 0000000..be03068 --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.datacontract.org/2004/07/System", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.datacontract.schemas._2004._07.system; diff --git a/test/TestService/org/tempuri/AITestSvcLib.java b/test/TestService/org/tempuri/AITestSvcLib.java new file mode 100644 index 0000000..240a4d8 --- /dev/null +++ b/test/TestService/org/tempuri/AITestSvcLib.java @@ -0,0 +1,99 @@ + +/* + * + */ + +package org.tempuri; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.Service; + +/** + * This class was generated by Apache CXF 2.3.3 + * 2011-03-23T15:01:50.630+08:00 + * Generated source version: 2.3.3 + * + */ + + +@WebServiceClient(name = "AITestSvcLib", + wsdlLocation = "file:tempuri.org.wsdl", + targetNamespace = "http://tempuri.org/") +public class AITestSvcLib extends Service { + + public final static URL WSDL_LOCATION; + + public final static QName SERVICE = new QName("http://tempuri.org/", "AITestSvcLib"); + public final static QName DefaultBindingITestService = new QName("http://tempuri.org/", "DefaultBinding_ITestService"); + static { + URL url = null; + try { + url = new URL("file:tempuri.org.wsdl"); + } catch (MalformedURLException e) { + System.err.println("Can not initialize the default wsdl from file:tempuri.org.wsdl"); + // e.printStackTrace(); + } + WSDL_LOCATION = url; + } + + public AITestSvcLib(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public AITestSvcLib(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public AITestSvcLib() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public AITestSvcLib(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public AITestSvcLib(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public AITestSvcLib(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService() { + return super.getPort(DefaultBindingITestService, ITestService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService(WebServiceFeature... features) { + return super.getPort(DefaultBindingITestService, ITestService.class, features); + } + +} diff --git a/test/TestService/org/tempuri/CheckACLOnAzure.java b/test/TestService/org/tempuri/CheckACLOnAzure.java new file mode 100644 index 0000000..7a2f8b2 --- /dev/null +++ b/test/TestService/org/tempuri/CheckACLOnAzure.java @@ -0,0 +1,34 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "CheckACLOnAzure") +public class CheckACLOnAzure { + + +} diff --git a/test/TestService/org/tempuri/CheckACLOnAzureResponse.java b/test/TestService/org/tempuri/CheckACLOnAzureResponse.java new file mode 100644 index 0000000..ad7b1aa --- /dev/null +++ b/test/TestService/org/tempuri/CheckACLOnAzureResponse.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CheckACLOnAzureResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "checkACLOnAzureResult" +}) +@XmlRootElement(name = "CheckACLOnAzureResponse") +public class CheckACLOnAzureResponse { + + @XmlElementRef(name = "CheckACLOnAzureResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement checkACLOnAzureResult; + + /** + * Gets the value of the checkACLOnAzureResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getCheckACLOnAzureResult() { + return checkACLOnAzureResult; + } + + /** + * Sets the value of the checkACLOnAzureResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setCheckACLOnAzureResult(JAXBElement value) { + this.checkACLOnAzureResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/ConsumeCPU.java b/test/TestService/org/tempuri/ConsumeCPU.java new file mode 100644 index 0000000..a547018 --- /dev/null +++ b/test/TestService/org/tempuri/ConsumeCPU.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="time" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "time" +}) +@XmlRootElement(name = "ConsumeCPU") +public class ConsumeCPU { + + @XmlElement(name = "time", namespace = "http://tempuri.org/") + protected Duration time; + + /** + * Gets the value of the time property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getTime() { + return time; + } + + /** + * Sets the value of the time property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setTime(Duration value) { + this.time = value; + } + +} diff --git a/test/TestService/org/tempuri/ConsumeCPUResponse.java b/test/TestService/org/tempuri/ConsumeCPUResponse.java new file mode 100644 index 0000000..15ffd30 --- /dev/null +++ b/test/TestService/org/tempuri/ConsumeCPUResponse.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ConsumeCPUResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "consumeCPUResult" +}) +@XmlRootElement(name = "ConsumeCPUResponse") +public class ConsumeCPUResponse { + + @XmlElementRef(name = "ConsumeCPUResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement consumeCPUResult; + + /** + * Gets the value of the consumeCPUResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getConsumeCPUResult() { + return consumeCPUResult; + } + + /** + * Sets the value of the consumeCPUResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setConsumeCPUResult(JAXBElement value) { + this.consumeCPUResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/Echo.java b/test/TestService/org/tempuri/Echo.java new file mode 100644 index 0000000..5eaaf29 --- /dev/null +++ b/test/TestService/org/tempuri/Echo.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID" +}) +@XmlRootElement(name = "Echo") +public class Echo { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoAppSettings.java b/test/TestService/org/tempuri/EchoAppSettings.java new file mode 100644 index 0000000..c75555a --- /dev/null +++ b/test/TestService/org/tempuri/EchoAppSettings.java @@ -0,0 +1,62 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID" +}) +@XmlRootElement(name = "EchoAppSettings") +public class EchoAppSettings { + + protected Integer refID; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoAppSettingsResponse.java b/test/TestService/org/tempuri/EchoAppSettingsResponse.java new file mode 100644 index 0000000..1b93df5 --- /dev/null +++ b/test/TestService/org/tempuri/EchoAppSettingsResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoAppSettingsResult" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfKeyValueOfstringstring" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoAppSettingsResult" +}) +@XmlRootElement(name = "EchoAppSettingsResponse") +public class EchoAppSettingsResponse { + + @XmlElementRef(name = "EchoAppSettingsResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoAppSettingsResult; + + /** + * Gets the value of the echoAppSettingsResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >} + * + */ + public JAXBElement getEchoAppSettingsResult() { + return echoAppSettingsResult; + } + + /** + * Sets the value of the echoAppSettingsResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >} + * + */ + public void setEchoAppSettingsResult(JAXBElement value) { + this.echoAppSettingsResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoClass.java b/test/TestService/org/tempuri/EchoClass.java new file mode 100644 index 0000000..14ef7a6 --- /dev/null +++ b/test/TestService/org/tempuri/EchoClass.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassFoo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cls" type="{http://schemas.datacontract.org/2004/07/services}ClassFoo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "cls" +}) +@XmlRootElement(name = "EchoClass") +public class EchoClass { + + @XmlElementRef(name = "cls", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement cls; + + /** + * Gets the value of the cls property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassFoo }{@code >} + * + */ + public JAXBElement getCls() { + return cls; + } + + /** + * Sets the value of the cls property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassFoo }{@code >} + * + */ + public void setCls(JAXBElement value) { + this.cls = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoClassResponse.java b/test/TestService/org/tempuri/EchoClassResponse.java new file mode 100644 index 0000000..4c125f6 --- /dev/null +++ b/test/TestService/org/tempuri/EchoClassResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassFoo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoClassResult" type="{http://schemas.datacontract.org/2004/07/services}ClassFoo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoClassResult" +}) +@XmlRootElement(name = "EchoClassResponse") +public class EchoClassResponse { + + @XmlElementRef(name = "EchoClassResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoClassResult; + + /** + * Gets the value of the echoClassResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassFoo }{@code >} + * + */ + public JAXBElement getEchoClassResult() { + return echoClassResult; + } + + /** + * Sets the value of the echoClassResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassFoo }{@code >} + * + */ + public void setEchoClassResult(JAXBElement value) { + this.echoClassResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoDouble.java b/test/TestService/org/tempuri/EchoDouble.java new file mode 100644 index 0000000..07a00b4 --- /dev/null +++ b/test/TestService/org/tempuri/EchoDouble.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="inp" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "inp" +}) +@XmlRootElement(name = "EchoDouble") +public class EchoDouble { + + @XmlElement(name = "inp", namespace = "http://tempuri.org/") + protected Double inp; + + /** + * Gets the value of the inp property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getInp() { + return inp; + } + + /** + * Sets the value of the inp property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setInp(Double value) { + this.inp = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoDoubleResponse.java b/test/TestService/org/tempuri/EchoDoubleResponse.java new file mode 100644 index 0000000..8e59e84 --- /dev/null +++ b/test/TestService/org/tempuri/EchoDoubleResponse.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoDoubleResult" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoDoubleResult" +}) +@XmlRootElement(name = "EchoDoubleResponse") +public class EchoDoubleResponse { + + @XmlElement(name = "EchoDoubleResult", namespace = "http://tempuri.org/") + protected Double echoDoubleResult; + + /** + * Gets the value of the echoDoubleResult property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getEchoDoubleResult() { + return echoDoubleResult; + } + + /** + * Sets the value of the echoDoubleResult property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setEchoDoubleResult(Double value) { + this.echoDoubleResult = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoException.java b/test/TestService/org/tempuri/EchoException.java new file mode 100644 index 0000000..3c5ebf9 --- /dev/null +++ b/test/TestService/org/tempuri/EchoException.java @@ -0,0 +1,93 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.system.Exception; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ex" type="{http://schemas.datacontract.org/2004/07/System}Exception" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "ex" +}) +@XmlRootElement(name = "EchoException") +public class EchoException { + + protected Integer refID; + @XmlElementRef(name = "ex", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement ex; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the ex property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Exception }{@code >} + * + */ + public JAXBElement getEx() { + return ex; + } + + /** + * Sets the value of the ex property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Exception }{@code >} + * + */ + public void setEx(JAXBElement value) { + this.ex = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoExceptionResponse.java b/test/TestService/org/tempuri/EchoExceptionResponse.java new file mode 100644 index 0000000..1388be0 --- /dev/null +++ b/test/TestService/org/tempuri/EchoExceptionResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoExceptionResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoExceptionResult" +}) +@XmlRootElement(name = "EchoExceptionResponse") +public class EchoExceptionResponse { + + @XmlElementRef(name = "EchoExceptionResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoExceptionResult; + + /** + * Gets the value of the echoExceptionResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoExceptionResult() { + return echoExceptionResult; + } + + /** + * Sets the value of the echoExceptionResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoExceptionResult(JAXBElement value) { + this.echoExceptionResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoFault.java b/test/TestService/org/tempuri/EchoFault.java new file mode 100644 index 0000000..ca08bd7 --- /dev/null +++ b/test/TestService/org/tempuri/EchoFault.java @@ -0,0 +1,95 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.system.Exception; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="ex" type="{http://schemas.datacontract.org/2004/07/System}Exception" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "ex" +}) +@XmlRootElement(name = "EchoFault") +public class EchoFault { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElementRef(name = "ex", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement ex; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the ex property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Exception }{@code >} + * + */ + public JAXBElement getEx() { + return ex; + } + + /** + * Sets the value of the ex property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Exception }{@code >} + * + */ + public void setEx(JAXBElement value) { + this.ex = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoFaultResponse.java b/test/TestService/org/tempuri/EchoFaultResponse.java new file mode 100644 index 0000000..25499ba --- /dev/null +++ b/test/TestService/org/tempuri/EchoFaultResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoFaultResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoFaultResult" +}) +@XmlRootElement(name = "EchoFaultResponse") +public class EchoFaultResponse { + + @XmlElementRef(name = "EchoFaultResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoFaultResult; + + /** + * Gets the value of the echoFaultResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoFaultResult() { + return echoFaultResult; + } + + /** + * Sets the value of the echoFaultResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoFaultResult(JAXBElement value) { + this.echoFaultResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoFaultWithName.java b/test/TestService/org/tempuri/EchoFaultWithName.java new file mode 100644 index 0000000..d4b1c22 --- /dev/null +++ b/test/TestService/org/tempuri/EchoFaultWithName.java @@ -0,0 +1,94 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="exceptionName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "exceptionName" +}) +@XmlRootElement(name = "EchoFaultWithName") +public class EchoFaultWithName { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElementRef(name = "exceptionName", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement exceptionName; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the exceptionName property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getExceptionName() { + return exceptionName; + } + + /** + * Sets the value of the exceptionName property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setExceptionName(JAXBElement value) { + this.exceptionName = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoFaultWithNameResponse.java b/test/TestService/org/tempuri/EchoFaultWithNameResponse.java new file mode 100644 index 0000000..52ae442 --- /dev/null +++ b/test/TestService/org/tempuri/EchoFaultWithNameResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoFaultWithNameResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoFaultWithNameResult" +}) +@XmlRootElement(name = "EchoFaultWithNameResponse") +public class EchoFaultWithNameResponse { + + @XmlElementRef(name = "EchoFaultWithNameResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoFaultWithNameResult; + + /** + * Gets the value of the echoFaultWithNameResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoFaultWithNameResult() { + return echoFaultWithNameResult; + } + + /** + * Sets the value of the echoFaultWithNameResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoFaultWithNameResult(JAXBElement value) { + this.echoFaultWithNameResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject.java b/test/TestService/org/tempuri/EchoObject.java new file mode 100644 index 0000000..7435f38 --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject.java @@ -0,0 +1,93 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="o" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "type", + "o" +}) +@XmlRootElement(name = "EchoObject") +public class EchoObject { + + @XmlElementRef(name = "type", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement type; + @XmlElementRef(name = "o", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement o; + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setType(JAXBElement value) { + this.type = ((JAXBElement ) value); + } + + /** + * Gets the value of the o property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public JAXBElement getO() { + return o; + } + + /** + * Sets the value of the o property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public void setO(JAXBElement value) { + this.o = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject2.java b/test/TestService/org/tempuri/EchoObject2.java new file mode 100644 index 0000000..4e747bf --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject2.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassObj; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="obj" type="{http://schemas.datacontract.org/2004/07/services}ClassObj" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "obj" +}) +@XmlRootElement(name = "EchoObject2") +public class EchoObject2 { + + @XmlElementRef(name = "obj", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement obj; + + /** + * Gets the value of the obj property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public JAXBElement getObj() { + return obj; + } + + /** + * Sets the value of the obj property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public void setObj(JAXBElement value) { + this.obj = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject2Response.java b/test/TestService/org/tempuri/EchoObject2Response.java new file mode 100644 index 0000000..f4ba964 --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject2Response.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassObj; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoObject2Result" type="{http://schemas.datacontract.org/2004/07/services}ClassObj" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoObject2Result" +}) +@XmlRootElement(name = "EchoObject2Response") +public class EchoObject2Response { + + @XmlElementRef(name = "EchoObject2Result", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoObject2Result; + + /** + * Gets the value of the echoObject2Result property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public JAXBElement getEchoObject2Result() { + return echoObject2Result; + } + + /** + * Sets the value of the echoObject2Result property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public void setEchoObject2Result(JAXBElement value) { + this.echoObject2Result = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject3.java b/test/TestService/org/tempuri/EchoObject3.java new file mode 100644 index 0000000..2adcdbf --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject3.java @@ -0,0 +1,93 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="o" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "type", + "o" +}) +@XmlRootElement(name = "EchoObject3") +public class EchoObject3 { + + @XmlElementRef(name = "type", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement type; + @XmlElementRef(name = "o", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement o; + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setType(JAXBElement value) { + this.type = ((JAXBElement ) value); + } + + /** + * Gets the value of the o property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public JAXBElement getO() { + return o; + } + + /** + * Sets the value of the o property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public void setO(JAXBElement value) { + this.o = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject3Response.java b/test/TestService/org/tempuri/EchoObject3Response.java new file mode 100644 index 0000000..93a2b3b --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject3Response.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoObject3Result" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoObject3Result" +}) +@XmlRootElement(name = "EchoObject3Response") +public class EchoObject3Response { + + @XmlElementRef(name = "EchoObject3Result", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoObject3Result; + + /** + * Gets the value of the echoObject3Result property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public JAXBElement getEchoObject3Result() { + return echoObject3Result; + } + + /** + * Sets the value of the echoObject3Result property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public void setEchoObject3Result(JAXBElement value) { + this.echoObject3Result = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject4.java b/test/TestService/org/tempuri/EchoObject4.java new file mode 100644 index 0000000..63891ec --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject4.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassObj; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="obj" type="{http://schemas.datacontract.org/2004/07/services}ClassObj" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "obj" +}) +@XmlRootElement(name = "EchoObject4") +public class EchoObject4 { + + @XmlElementRef(name = "obj", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement obj; + + /** + * Gets the value of the obj property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public JAXBElement getObj() { + return obj; + } + + /** + * Sets the value of the obj property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public void setObj(JAXBElement value) { + this.obj = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObject4Response.java b/test/TestService/org/tempuri/EchoObject4Response.java new file mode 100644 index 0000000..6d20981 --- /dev/null +++ b/test/TestService/org/tempuri/EchoObject4Response.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ClassObj; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoObject4Result" type="{http://schemas.datacontract.org/2004/07/services}ClassObj" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoObject4Result" +}) +@XmlRootElement(name = "EchoObject4Response") +public class EchoObject4Response { + + @XmlElementRef(name = "EchoObject4Result", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoObject4Result; + + /** + * Gets the value of the echoObject4Result property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public JAXBElement getEchoObject4Result() { + return echoObject4Result; + } + + /** + * Sets the value of the echoObject4Result property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ClassObj }{@code >} + * + */ + public void setEchoObject4Result(JAXBElement value) { + this.echoObject4Result = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoObjectResponse.java b/test/TestService/org/tempuri/EchoObjectResponse.java new file mode 100644 index 0000000..39e1a92 --- /dev/null +++ b/test/TestService/org/tempuri/EchoObjectResponse.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoObjectResult" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoObjectResult" +}) +@XmlRootElement(name = "EchoObjectResponse") +public class EchoObjectResponse { + + @XmlElementRef(name = "EchoObjectResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoObjectResult; + + /** + * Gets the value of the echoObjectResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public JAXBElement getEchoObjectResult() { + return echoObjectResult; + } + + /** + * Sets the value of the echoObjectResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link Object }{@code >} + * + */ + public void setEchoObjectResult(JAXBElement value) { + this.echoObjectResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoResponse.java b/test/TestService/org/tempuri/EchoResponse.java new file mode 100644 index 0000000..59e5384 --- /dev/null +++ b/test/TestService/org/tempuri/EchoResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoResult" +}) +@XmlRootElement(name = "EchoResponse") +public class EchoResponse { + + @XmlElementRef(name = "EchoResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoResult; + + /** + * Gets the value of the echoResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoResult() { + return echoResult; + } + + /** + * Sets the value of the echoResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoResult(JAXBElement value) { + this.echoResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoStruct.java b/test/TestService/org/tempuri/EchoStruct.java new file mode 100644 index 0000000..bddd20c --- /dev/null +++ b/test/TestService/org/tempuri/EchoStruct.java @@ -0,0 +1,93 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.TestStruct; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="s" type="{http://schemas.datacontract.org/2004/07/services}TestStruct" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "s" +}) +@XmlRootElement(name = "EchoStruct") +public class EchoStruct { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "s", namespace = "http://tempuri.org/") + protected TestStruct s; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the s property. + * + * @return + * possible object is + * {@link TestStruct } + * + */ + public TestStruct getS() { + return s; + } + + /** + * Sets the value of the s property. + * + * @param value + * allowed object is + * {@link TestStruct } + * + */ + public void setS(TestStruct value) { + this.s = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoStructResponse.java b/test/TestService/org/tempuri/EchoStructResponse.java new file mode 100644 index 0000000..2df6c91 --- /dev/null +++ b/test/TestService/org/tempuri/EchoStructResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoStructResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoStructResult" +}) +@XmlRootElement(name = "EchoStructResponse") +public class EchoStructResponse { + + @XmlElementRef(name = "EchoStructResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoStructResult; + + /** + * Gets the value of the echoStructResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoStructResult() { + return echoStructResult; + } + + /** + * Sets the value of the echoStructResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoStructResult(JAXBElement value) { + this.echoStructResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithDelay.java b/test/TestService/org/tempuri/EchoWithDelay.java new file mode 100644 index 0000000..c364c1c --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithDelay.java @@ -0,0 +1,93 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="delay" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "delay" +}) +@XmlRootElement(name = "EchoWithDelay") +public class EchoWithDelay { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "delay", namespace = "http://tempuri.org/") + protected Duration delay; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the delay property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getDelay() { + return delay; + } + + /** + * Sets the value of the delay property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setDelay(Duration value) { + this.delay = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoWithDelayOnSelectedNode.java b/test/TestService/org/tempuri/EchoWithDelayOnSelectedNode.java new file mode 100644 index 0000000..60f7ea4 --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithDelayOnSelectedNode.java @@ -0,0 +1,151 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="selectedNode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="delayOnSelectedNode" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="delayOnOtherNodes" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "selectedNode", + "delayOnSelectedNode", + "delayOnOtherNodes" +}) +@XmlRootElement(name = "EchoWithDelayOnSelectedNode") +public class EchoWithDelayOnSelectedNode { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElementRef(name = "selectedNode", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement selectedNode; + @XmlElement(name = "delayOnSelectedNode", namespace = "http://tempuri.org/") + protected Duration delayOnSelectedNode; + @XmlElement(name = "delayOnOtherNodes", namespace = "http://tempuri.org/") + protected Duration delayOnOtherNodes; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the selectedNode property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getSelectedNode() { + return selectedNode; + } + + /** + * Sets the value of the selectedNode property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setSelectedNode(JAXBElement value) { + this.selectedNode = ((JAXBElement ) value); + } + + /** + * Gets the value of the delayOnSelectedNode property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getDelayOnSelectedNode() { + return delayOnSelectedNode; + } + + /** + * Sets the value of the delayOnSelectedNode property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setDelayOnSelectedNode(Duration value) { + this.delayOnSelectedNode = value; + } + + /** + * Gets the value of the delayOnOtherNodes property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getDelayOnOtherNodes() { + return delayOnOtherNodes; + } + + /** + * Sets the value of the delayOnOtherNodes property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setDelayOnOtherNodes(Duration value) { + this.delayOnOtherNodes = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoWithDelayOnSelectedNodeResponse.java b/test/TestService/org/tempuri/EchoWithDelayOnSelectedNodeResponse.java new file mode 100644 index 0000000..79cf37c --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithDelayOnSelectedNodeResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoWithDelayOnSelectedNodeResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoWithDelayOnSelectedNodeResult" +}) +@XmlRootElement(name = "EchoWithDelayOnSelectedNodeResponse") +public class EchoWithDelayOnSelectedNodeResponse { + + @XmlElementRef(name = "EchoWithDelayOnSelectedNodeResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoWithDelayOnSelectedNodeResult; + + /** + * Gets the value of the echoWithDelayOnSelectedNodeResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoWithDelayOnSelectedNodeResult() { + return echoWithDelayOnSelectedNodeResult; + } + + /** + * Sets the value of the echoWithDelayOnSelectedNodeResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoWithDelayOnSelectedNodeResult(JAXBElement value) { + this.echoWithDelayOnSelectedNodeResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithDelayResponse.java b/test/TestService/org/tempuri/EchoWithDelayResponse.java new file mode 100644 index 0000000..bfb0f6c --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithDelayResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoWithDelayResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoWithDelayResult" +}) +@XmlRootElement(name = "EchoWithDelayResponse") +public class EchoWithDelayResponse { + + @XmlElementRef(name = "EchoWithDelayResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoWithDelayResult; + + /** + * Gets the value of the echoWithDelayResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoWithDelayResult() { + return echoWithDelayResult; + } + + /** + * Sets the value of the echoWithDelayResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoWithDelayResult(JAXBElement value) { + this.echoWithDelayResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithFail.java b/test/TestService/org/tempuri/EchoWithFail.java new file mode 100644 index 0000000..d40c7f5 --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithFail.java @@ -0,0 +1,92 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="failTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "failTime" +}) +@XmlRootElement(name = "EchoWithFail") +public class EchoWithFail { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "failTime", namespace = "http://tempuri.org/") + protected Integer failTime; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the failTime property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getFailTime() { + return failTime; + } + + /** + * Sets the value of the failTime property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setFailTime(Integer value) { + this.failTime = value; + } + +} diff --git a/test/TestService/org/tempuri/EchoWithFailResponse.java b/test/TestService/org/tempuri/EchoWithFailResponse.java new file mode 100644 index 0000000..f6a1ffa --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithFailResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoWithFailResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoWithFailResult" +}) +@XmlRootElement(name = "EchoWithFailResponse") +public class EchoWithFailResponse { + + @XmlElementRef(name = "EchoWithFailResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoWithFailResult; + + /** + * Gets the value of the echoWithFailResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoWithFailResult() { + return echoWithFailResult; + } + + /** + * Sets the value of the echoWithFailResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoWithFailResult(JAXBElement value) { + this.echoWithFailResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithOnExit.java b/test/TestService/org/tempuri/EchoWithOnExit.java new file mode 100644 index 0000000..4671f24 --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithOnExit.java @@ -0,0 +1,151 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="runTime" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="exitDelay" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="logPath" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "runTime", + "exitDelay", + "logPath" +}) +@XmlRootElement(name = "EchoWithOnExit") +public class EchoWithOnExit { + + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "runTime", namespace = "http://tempuri.org/") + protected Duration runTime; + @XmlElement(name = "exitDelay", namespace = "http://tempuri.org/") + protected Duration exitDelay; + @XmlElementRef(name = "logPath", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement logPath; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the runTime property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getRunTime() { + return runTime; + } + + /** + * Sets the value of the runTime property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setRunTime(Duration value) { + this.runTime = value; + } + + /** + * Gets the value of the exitDelay property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getExitDelay() { + return exitDelay; + } + + /** + * Sets the value of the exitDelay property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setExitDelay(Duration value) { + this.exitDelay = value; + } + + /** + * Gets the value of the logPath property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getLogPath() { + return logPath; + } + + /** + * Sets the value of the logPath property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setLogPath(JAXBElement value) { + this.logPath = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithOnExitResponse.java b/test/TestService/org/tempuri/EchoWithOnExitResponse.java new file mode 100644 index 0000000..3ad713d --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithOnExitResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoWithOnExitResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoWithOnExitResult" +}) +@XmlRootElement(name = "EchoWithOnExitResponse") +public class EchoWithOnExitResponse { + + @XmlElementRef(name = "EchoWithOnExitResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoWithOnExitResult; + + /** + * Gets the value of the echoWithOnExitResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoWithOnExitResult() { + return echoWithOnExitResult; + } + + /** + * Sets the value of the echoWithOnExitResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoWithOnExitResult(JAXBElement value) { + this.echoWithOnExitResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithParam.java b/test/TestService/org/tempuri/EchoWithParam.java new file mode 100644 index 0000000..68ed162 --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithParam.java @@ -0,0 +1,263 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.TestEnum; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="d" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
+ *         <element name="f" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
+ *         <element name="i64" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="i32_1" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="i32_2" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="e" type="{http://schemas.datacontract.org/2004/07/services}TestEnum" minOccurs="0"/>
+ *         <element name="s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "d", + "f", + "i64", + "i321", + "i322", + "e", + "s" +}) +@XmlRootElement(name = "EchoWithParam") +public class EchoWithParam { + + @XmlElement(name="refID",namespace="http://tempuri.org/") + protected Integer refID; + @XmlElement(name="d",namespace="http://tempuri.org/") + protected Double d; + @XmlElement(name="f",namespace="http://tempuri.org/") + protected Float f; + @XmlElement(name="i64",namespace="http://tempuri.org/") + protected Long i64; + @XmlElement(name="i32_1",namespace="http://tempuri.org/") + protected Integer i321; + @XmlElement(name = "i32_2",namespace="http://tempuri.org/") + protected Integer i322; + @XmlElement(name = "e",namespace="http://tempuri.org/") + protected TestEnum e; + @XmlElementRef(name = "s", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement s; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the d property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getD() { + return d; + } + + /** + * Sets the value of the d property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setD(Double value) { + this.d = value; + } + + /** + * Gets the value of the f property. + * + * @return + * possible object is + * {@link Float } + * + */ + public Float getF() { + return f; + } + + /** + * Sets the value of the f property. + * + * @param value + * allowed object is + * {@link Float } + * + */ + public void setF(Float value) { + this.f = value; + } + + /** + * Gets the value of the i64 property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getI64() { + return i64; + } + + /** + * Sets the value of the i64 property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setI64(Long value) { + this.i64 = value; + } + + /** + * Gets the value of the i321 property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getI321() { + return i321; + } + + /** + * Sets the value of the i321 property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setI321(Integer value) { + this.i321 = value; + } + + /** + * Gets the value of the i322 property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getI322() { + return i322; + } + + /** + * Sets the value of the i322 property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setI322(Integer value) { + this.i322 = value; + } + + /** + * Gets the value of the e property. + * + * @return + * possible object is + * {@link TestEnum } + * + */ + public TestEnum getE() { + return e; + } + + /** + * Sets the value of the e property. + * + * @param value + * allowed object is + * {@link TestEnum } + * + */ + public void setE(TestEnum value) { + this.e = value; + } + + /** + * Gets the value of the s property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getS() { + return s; + } + + /** + * Sets the value of the s property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setS(JAXBElement value) { + this.s = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EchoWithParamResponse.java b/test/TestService/org/tempuri/EchoWithParamResponse.java new file mode 100644 index 0000000..996691f --- /dev/null +++ b/test/TestService/org/tempuri/EchoWithParamResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="EchoWithParamResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "echoWithParamResult" +}) +@XmlRootElement(name = "EchoWithParamResponse") +public class EchoWithParamResponse { + + @XmlElementRef(name = "EchoWithParamResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement echoWithParamResult; + + /** + * Gets the value of the echoWithParamResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getEchoWithParamResult() { + return echoWithParamResult; + } + + /** + * Sets the value of the echoWithParamResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setEchoWithParamResult(JAXBElement value) { + this.echoWithParamResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/EnvVarNames.java b/test/TestService/org/tempuri/EnvVarNames.java new file mode 100644 index 0000000..d25d0c0 --- /dev/null +++ b/test/TestService/org/tempuri/EnvVarNames.java @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility class for EchoSvc +// +// Jiabin Hu +//----------------------------------------------------------------------- + +package org.tempuri; + +public class EnvVarNames +{ + public static final String CCP_SCHEDULER = "CCP_SCHEDULER"; + public static final String CCP_TASKSYSTEMID = "CCP_TASKSYSTEMID"; + public static final String CCP_JOBID = "CCP_JOBID"; + public static final String LONG_LOADING_TEST = "Long_loading_test"; + public static final String GRACEFUL_EXIT = "GracefulExit"; + public static final String CCP_ONAZURE = "CCP_OnAzure"; + public static final String TEST_ECHO_FAIL = "TestEchoFail"; + public static final String CCP_TASKID = "CCP_TASKID"; + public static final String CCP_TASKINSTANCEID = "CCP_TASKINSTANCEID"; + public static final String NON_TERMINATING_ERROR_RETRY_COUNT = "NonTerminatingErrorRetryCount"; + public static final String WRITE_FAIL_TEST = "WriteFailTest"; +} diff --git a/test/TestService/org/tempuri/GenerateLoad.java b/test/TestService/org/tempuri/GenerateLoad.java new file mode 100644 index 0000000..ad7d53a --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoad.java @@ -0,0 +1,150 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="millisec" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="input_data" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *         <element name="common_data_path" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "millisec", + "inputData", + "commonDataPath" +}) +@XmlRootElement(name = "GenerateLoad") +public class GenerateLoad { + + @XmlElement(name="refID", namespace="http://tempuri.org/") + protected Integer refID; + @XmlElement(name="millisec", namespace="http://tempuri.org/") + protected Long millisec; + @XmlElementRef(name = "input_data", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement inputData; + @XmlElementRef(name = "common_data_path", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement commonDataPath; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the millisec property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getMillisec() { + return millisec; + } + + /** + * Sets the value of the millisec property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setMillisec(Long value) { + this.millisec = value; + } + + /** + * Gets the value of the inputData property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getInputData() { + return inputData; + } + + /** + * Sets the value of the inputData property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setInputData(JAXBElement value) { + this.inputData = ((JAXBElement ) value); + } + + /** + * Gets the value of the commonDataPath property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getCommonDataPath() { + return commonDataPath; + } + + /** + * Sets the value of the commonDataPath property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setCommonDataPath(JAXBElement value) { + this.commonDataPath = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/GenerateLoadResponse.java b/test/TestService/org/tempuri/GenerateLoadResponse.java new file mode 100644 index 0000000..9624a31 --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoadResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.StatisticInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GenerateLoadResult" type="{http://schemas.datacontract.org/2004/07/services}StatisticInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "generateLoadResult" +}) +@XmlRootElement(name = "GenerateLoadResponse") +public class GenerateLoadResponse { + + @XmlElementRef(name = "GenerateLoadResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement generateLoadResult; + + /** + * Gets the value of the generateLoadResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public JAXBElement getGenerateLoadResult() { + return generateLoadResult; + } + + /** + * Sets the value of the generateLoadResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public void setGenerateLoadResult(JAXBElement value) { + this.generateLoadResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/GenerateLoadWithInputFile.java b/test/TestService/org/tempuri/GenerateLoadWithInputFile.java new file mode 100644 index 0000000..f5dc902 --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoadWithInputFile.java @@ -0,0 +1,147 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="millisec" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="input_data_path" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="common_data_path" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "millisec", + "inputDataPath", + "commonDataPath" +}) +@XmlRootElement(name = "GenerateLoadWithInputFile") +public class GenerateLoadWithInputFile { + + protected Integer refID; + protected Long millisec; + @XmlElementRef(name = "input_data_path", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement inputDataPath; + @XmlElementRef(name = "common_data_path", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement commonDataPath; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the millisec property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getMillisec() { + return millisec; + } + + /** + * Sets the value of the millisec property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setMillisec(Long value) { + this.millisec = value; + } + + /** + * Gets the value of the inputDataPath property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getInputDataPath() { + return inputDataPath; + } + + /** + * Sets the value of the inputDataPath property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setInputDataPath(JAXBElement value) { + this.inputDataPath = ((JAXBElement ) value); + } + + /** + * Gets the value of the commonDataPath property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getCommonDataPath() { + return commonDataPath; + } + + /** + * Sets the value of the commonDataPath property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setCommonDataPath(JAXBElement value) { + this.commonDataPath = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/GenerateLoadWithInputFileResponse.java b/test/TestService/org/tempuri/GenerateLoadWithInputFileResponse.java new file mode 100644 index 0000000..79c93e8 --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoadWithInputFileResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.StatisticInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GenerateLoadWithInputFileResult" type="{http://schemas.datacontract.org/2004/07/services}StatisticInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "generateLoadWithInputFileResult" +}) +@XmlRootElement(name = "GenerateLoadWithInputFileResponse") +public class GenerateLoadWithInputFileResponse { + + @XmlElementRef(name = "GenerateLoadWithInputFileResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement generateLoadWithInputFileResult; + + /** + * Gets the value of the generateLoadWithInputFileResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public JAXBElement getGenerateLoadWithInputFileResult() { + return generateLoadWithInputFileResult; + } + + /** + * Sets the value of the generateLoadWithInputFileResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public void setGenerateLoadWithInputFileResult(JAXBElement value) { + this.generateLoadWithInputFileResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/GenerateLoadWithResponseData.java b/test/TestService/org/tempuri/GenerateLoadWithResponseData.java new file mode 100644 index 0000000..578f9f2 --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoadWithResponseData.java @@ -0,0 +1,151 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="sleepTime" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="input_data" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *         <element name="output_data_size" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "sleepTime", + "inputData", + "outputDataSize" +}) +@XmlRootElement(name = "GenerateLoadWithResponseData") +public class GenerateLoadWithResponseData { + + @XmlElement(name = "refID", namespace="http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "sleepTime", namespace="http://tempuri.org/") + protected Duration sleepTime; + @XmlElementRef(name = "input_data", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement inputData; + @XmlElement(name = "output_data_size", namespace="http://tempuri.org/") + protected Integer outputDataSize; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the sleepTime property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getSleepTime() { + return sleepTime; + } + + /** + * Sets the value of the sleepTime property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setSleepTime(Duration value) { + this.sleepTime = value; + } + + /** + * Gets the value of the inputData property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getInputData() { + return inputData; + } + + /** + * Sets the value of the inputData property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setInputData(JAXBElement value) { + this.inputData = ((JAXBElement ) value); + } + + /** + * Gets the value of the outputDataSize property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getOutputDataSize() { + return outputDataSize; + } + + /** + * Sets the value of the outputDataSize property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setOutputDataSize(Integer value) { + this.outputDataSize = value; + } + +} diff --git a/test/TestService/org/tempuri/GenerateLoadWithResponseDataResponse.java b/test/TestService/org/tempuri/GenerateLoadWithResponseDataResponse.java new file mode 100644 index 0000000..ded41cb --- /dev/null +++ b/test/TestService/org/tempuri/GenerateLoadWithResponseDataResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.StatisticInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GenerateLoadWithResponseDataResult" type="{http://schemas.datacontract.org/2004/07/services}StatisticInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "generateLoadWithResponseDataResult" +}) +@XmlRootElement(name = "GenerateLoadWithResponseDataResponse") +public class GenerateLoadWithResponseDataResponse { + + @XmlElementRef(name = "GenerateLoadWithResponseDataResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement generateLoadWithResponseDataResult; + + /** + * Gets the value of the generateLoadWithResponseDataResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public JAXBElement getGenerateLoadWithResponseDataResult() { + return generateLoadWithResponseDataResult; + } + + /** + * Sets the value of the generateLoadWithResponseDataResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >} + * + */ + public void setGenerateLoadWithResponseDataResult(JAXBElement value) { + this.generateLoadWithResponseDataResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/GetCommonData.java b/test/TestService/org/tempuri/GetCommonData.java new file mode 100644 index 0000000..ffc8b65 --- /dev/null +++ b/test/TestService/org/tempuri/GetCommonData.java @@ -0,0 +1,207 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="sleepBeforeGet" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="sleepAfterGet" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="dataClientId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="expectedMd5Hash" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="testActionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "sleepBeforeGet", + "sleepAfterGet", + "dataClientId", + "expectedMd5Hash", + "testActionId" +}) +@XmlRootElement(name = "GetCommonData") +public class GetCommonData { + + @XmlElement(name = "refID", namespace="http://tempuri.org/") + protected Integer refID; + @XmlElement(name = "sleepBeforeGet", namespace="http://tempuri.org/") + protected Duration sleepBeforeGet; + @XmlElement(name = "sleepAfterGet", namespace="http://tempuri.org/") + protected Duration sleepAfterGet; + @XmlElementRef(name = "dataClientId", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement dataClientId; + @XmlElementRef(name = "expectedMd5Hash", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement expectedMd5Hash; + @XmlElement(name = "testActionId", namespace="http://tempuri.org/") + protected Integer testActionId; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the sleepBeforeGet property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getSleepBeforeGet() { + return sleepBeforeGet; + } + + /** + * Sets the value of the sleepBeforeGet property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setSleepBeforeGet(Duration value) { + this.sleepBeforeGet = value; + } + + /** + * Gets the value of the sleepAfterGet property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getSleepAfterGet() { + return sleepAfterGet; + } + + /** + * Sets the value of the sleepAfterGet property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setSleepAfterGet(Duration value) { + this.sleepAfterGet = value; + } + + /** + * Gets the value of the dataClientId property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getDataClientId() { + return dataClientId; + } + + /** + * Sets the value of the dataClientId property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setDataClientId(JAXBElement value) { + this.dataClientId = ((JAXBElement ) value); + } + + /** + * Gets the value of the expectedMd5Hash property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getExpectedMd5Hash() { + return expectedMd5Hash; + } + + /** + * Sets the value of the expectedMd5Hash property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setExpectedMd5Hash(JAXBElement value) { + this.expectedMd5Hash = ((JAXBElement ) value); + } + + /** + * Gets the value of the testActionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getTestActionId() { + return testActionId; + } + + /** + * Sets the value of the testActionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setTestActionId(Integer value) { + this.testActionId = value; + } + +} diff --git a/test/TestService/org/tempuri/GetCommonDataResponse.java b/test/TestService/org/tempuri/GetCommonDataResponse.java new file mode 100644 index 0000000..5c3fb45 --- /dev/null +++ b/test/TestService/org/tempuri/GetCommonDataResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetCommonDataResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getCommonDataResult" +}) +@XmlRootElement(name = "GetCommonDataResponse") +public class GetCommonDataResponse { + + @XmlElementRef(name = "GetCommonDataResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement getCommonDataResult; + + /** + * Gets the value of the getCommonDataResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getGetCommonDataResult() { + return getCommonDataResult; + } + + /** + * Sets the value of the getCommonDataResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setGetCommonDataResult(JAXBElement value) { + this.getCommonDataResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/ITestService.java b/test/TestService/org/tempuri/ITestService.java new file mode 100644 index 0000000..7d24994 --- /dev/null +++ b/test/TestService/org/tempuri/ITestService.java @@ -0,0 +1,388 @@ +package org.tempuri; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.FaultAction; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.192+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebService(targetNamespace = "http://tempuri.org/", name = "ITestService") +@XmlSeeAlso({ObjectFactory.class, org.datacontract.schemas._2004._07.aitestlib.ObjectFactory.class, org.datacontract.schemas._2004._07.system.ObjectFactory.class, org.datacontract.schemas._2004._07.services.ObjectFactory.class, com.microsoft.schemas._2003._10.serialization.ObjectFactory.class, com.microsoft.hpc.session.ObjectFactory.class, com.microsoft.schemas._2003._10.serialization.arrays.ObjectFactory.class}) +public interface ITestService { + + @WebResult(name = "EchoObject2Result", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoObject2", output = "http://tempuri.org/ITestService/EchoObject2Response") + @RequestWrapper(localName = "EchoObject2", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject2") + @WebMethod(operationName = "EchoObject2", action = "http://tempuri.org/ITestService/EchoObject2") + @ResponseWrapper(localName = "EchoObject2Response", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject2Response") + public org.datacontract.schemas._2004._07.services.ClassObj echoObject2( + @WebParam(name = "obj", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.services.ClassObj obj + ); + + @WebResult(name = "EchoDoubleResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoDouble", output = "http://tempuri.org/ITestService/EchoDoubleResponse") + @RequestWrapper(localName = "EchoDouble", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoDouble") + @WebMethod(operationName = "EchoDouble", action = "http://tempuri.org/ITestService/EchoDouble") + @ResponseWrapper(localName = "EchoDoubleResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoDoubleResponse") + public java.lang.Double echoDouble( + @WebParam(name = "inp", targetNamespace = "http://tempuri.org/") + java.lang.Double inp + ); + + @WebResult(name = "EchoWithParamResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoWithParam", output = "http://tempuri.org/ITestService/EchoWithParamResponse") + @RequestWrapper(localName = "EchoWithParam", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithParam") + @WebMethod(operationName = "EchoWithParam", action = "http://tempuri.org/ITestService/EchoWithParam") + @ResponseWrapper(localName = "EchoWithParamResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithParamResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithParam( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "d", targetNamespace = "http://tempuri.org/") + java.lang.Double d, + @WebParam(name = "f", targetNamespace = "http://tempuri.org/") + java.lang.Float f, + @WebParam(name = "i64", targetNamespace = "http://tempuri.org/") + java.lang.Long i64, + @WebParam(name = "i32_1", targetNamespace = "http://tempuri.org/") + java.lang.Integer i321, + @WebParam(name = "i32_2", targetNamespace = "http://tempuri.org/") + java.lang.Integer i322, + @WebParam(name = "e", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.services.TestEnum e, + @WebParam(name = "s", targetNamespace = "http://tempuri.org/") + java.lang.String s + ); + + @WebResult(name = "EchoObjectResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoObject", output = "http://tempuri.org/ITestService/EchoObjectResponse") + @RequestWrapper(localName = "EchoObject", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject") + @WebMethod(operationName = "EchoObject", action = "http://tempuri.org/ITestService/EchoObject") + @ResponseWrapper(localName = "EchoObjectResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObjectResponse") + public java.lang.Object echoObject( + @WebParam(name = "type", targetNamespace = "http://tempuri.org/") + java.lang.String type, + @WebParam(name = "o", targetNamespace = "http://tempuri.org/") + java.lang.Object o + ); + + @WebResult(name = "EchoStructResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoStruct", output = "http://tempuri.org/ITestService/EchoStructResponse") + @RequestWrapper(localName = "EchoStruct", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoStruct") + @WebMethod(operationName = "EchoStruct", action = "http://tempuri.org/ITestService/EchoStruct") + @ResponseWrapper(localName = "EchoStructResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoStructResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoStruct( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "s", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.services.TestStruct s + ); + + @WebResult(name = "EchoClassResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoClass", output = "http://tempuri.org/ITestService/EchoClassResponse") + @RequestWrapper(localName = "EchoClass", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoClass") + @WebMethod(operationName = "EchoClass", action = "http://tempuri.org/ITestService/EchoClass") + @ResponseWrapper(localName = "EchoClassResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoClassResponse") + public org.datacontract.schemas._2004._07.services.ClassFoo echoClass( + @WebParam(name = "cls", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.services.ClassFoo cls + ); + + @WebResult(name = "ServiceSideAsyncEchoResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/ServiceSideAsyncEcho", output = "http://tempuri.org/ITestService/ServiceSideAsyncEchoResponse") + @RequestWrapper(localName = "ServiceSideAsyncEcho", targetNamespace = "http://tempuri.org/", className = "org.tempuri.ServiceSideAsyncEcho") + @WebMethod(operationName = "ServiceSideAsyncEcho", action = "http://tempuri.org/ITestService/ServiceSideAsyncEcho") + @ResponseWrapper(localName = "ServiceSideAsyncEchoResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.ServiceSideAsyncEchoResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo serviceSideAsyncEcho( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID + ); + + @WebResult(name = "SerializationTestResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/SerializationTest", output = "http://tempuri.org/ITestService/SerializationTestResponse") + @RequestWrapper(localName = "SerializationTest", targetNamespace = "http://tempuri.org/", className = "org.tempuri.SerializationTest") + @WebMethod(operationName = "SerializationTest", action = "http://tempuri.org/ITestService/SerializationTest") + @ResponseWrapper(localName = "SerializationTestResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.SerializationTestResponse") + public java.lang.Boolean serializationTest( + @WebParam(name = "stream", targetNamespace = "http://tempuri.org/") + byte[] stream + ); + + @WebResult(name = "TraceResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/Trace", output = "http://tempuri.org/ITestService/TraceResponse", fault = {@FaultAction(className = ITestServiceTraceRetryOperationErrorFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/RetryOperationError"), @FaultAction(className = ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/TraceOutOfMemoryExceptionFault")}) + @RequestWrapper(localName = "Trace", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Trace") + @WebMethod(operationName = "Trace", action = "http://tempuri.org/ITestService/Trace") + @ResponseWrapper(localName = "TraceResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.TraceResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo trace( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "traceMsgs", targetNamespace = "http://tempuri.org/") + com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring traceMsgs, + @WebParam(name = "sleepBeforeTrace", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration sleepBeforeTrace, + @WebParam(name = "sleepAfterTrace", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration sleepAfterTrace, + @WebParam(name = "testActionId", targetNamespace = "http://tempuri.org/") + java.lang.Integer testActionId + ) throws ITestServiceTraceRetryOperationErrorFaultFaultMessage, ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage; + + @WebResult(name = "RunInprocSoaJobResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/RunInprocSoaJob", output = "http://tempuri.org/ITestService/RunInprocSoaJobResponse") + @RequestWrapper(localName = "RunInprocSoaJob", targetNamespace = "http://tempuri.org/", className = "org.tempuri.RunInprocSoaJob") + @WebMethod(operationName = "RunInprocSoaJob", action = "http://tempuri.org/ITestService/RunInprocSoaJob") + @ResponseWrapper(localName = "RunInprocSoaJobResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.RunInprocSoaJobResponse") + public java.lang.String runInprocSoaJob(); + + @WebResult(name = "EchoObject3Result", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoObject3", output = "http://tempuri.org/ITestService/EchoObject3Response") + @RequestWrapper(localName = "EchoObject3", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject3") + @WebMethod(operationName = "EchoObject3", action = "http://tempuri.org/ITestService/EchoObject3") + @ResponseWrapper(localName = "EchoObject3Response", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject3Response") + public java.lang.Object echoObject3( + @WebParam(name = "type", targetNamespace = "http://tempuri.org/") + java.lang.String type, + @WebParam(name = "o", targetNamespace = "http://tempuri.org/") + java.lang.Object o + ); + + @WebResult(name = "GetCommonDataResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/GetCommonData", output = "http://tempuri.org/ITestService/GetCommonDataResponse", fault = {@FaultAction(className = ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.class, value = "http://tempuri.org/ITestService/GetCommonDataCommonDataErrorFault")}) + @RequestWrapper(localName = "GetCommonData", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GetCommonData") + @WebMethod(operationName = "GetCommonData", action = "http://tempuri.org/ITestService/GetCommonData") + @ResponseWrapper(localName = "GetCommonDataResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GetCommonDataResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo getCommonData( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "sleepBeforeGet", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration sleepBeforeGet, + @WebParam(name = "sleepAfterGet", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration sleepAfterGet, + @WebParam(name = "dataClientId", targetNamespace = "http://tempuri.org/") + java.lang.String dataClientId, + @WebParam(name = "expectedMd5Hash", targetNamespace = "http://tempuri.org/") + java.lang.String expectedMd5Hash, + @WebParam(name = "testActionId", targetNamespace = "http://tempuri.org/") + java.lang.Integer testActionId + ) throws ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage; + + @WebResult(name = "PingResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/Ping", output = "http://tempuri.org/ITestService/PingResponse") + @RequestWrapper(localName = "Ping", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Ping") + @WebMethod(operationName = "Ping", action = "http://tempuri.org/ITestService/Ping") + @ResponseWrapper(localName = "PingResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.PingResponse") + public java.lang.Boolean ping(); + + @WebResult(name = "GenerateLoadWithInputFileResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/GenerateLoadWithInputFile", output = "http://tempuri.org/ITestService/GenerateLoadWithInputFileResponse") + @RequestWrapper(localName = "GenerateLoadWithInputFile", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadWithInputFile") + @WebMethod(operationName = "GenerateLoadWithInputFile", action = "http://tempuri.org/ITestService/GenerateLoadWithInputFile") + @ResponseWrapper(localName = "GenerateLoadWithInputFileResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadWithInputFileResponse") + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoadWithInputFile( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "millisec", targetNamespace = "http://tempuri.org/") + java.lang.Long millisec, + @WebParam(name = "input_data_path", targetNamespace = "http://tempuri.org/") + java.lang.String inputDataPath, + @WebParam(name = "common_data_path", targetNamespace = "http://tempuri.org/") + java.lang.String commonDataPath + ); + + @WebResult(name = "EchoWithDelayOnSelectedNodeResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoWithDelayOnSelectedNode", output = "http://tempuri.org/ITestService/EchoWithDelayOnSelectedNodeResponse") + @RequestWrapper(localName = "EchoWithDelayOnSelectedNode", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithDelayOnSelectedNode") + @WebMethod(operationName = "EchoWithDelayOnSelectedNode", action = "http://tempuri.org/ITestService/EchoWithDelayOnSelectedNode") + @ResponseWrapper(localName = "EchoWithDelayOnSelectedNodeResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithDelayOnSelectedNodeResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithDelayOnSelectedNode( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "selectedNode", targetNamespace = "http://tempuri.org/") + java.lang.String selectedNode, + @WebParam(name = "delayOnSelectedNode", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration delayOnSelectedNode, + @WebParam(name = "delayOnOtherNodes", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration delayOnOtherNodes + ); + + @Action(input = "http://tempuri.org/ITestService/Kill", output = "http://tempuri.org/ITestService/KillResponse") + @RequestWrapper(localName = "Kill", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Kill") + @WebMethod(operationName = "Kill", action = "http://tempuri.org/ITestService/Kill") + @ResponseWrapper(localName = "KillResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.KillResponse") + public void kill(); + + @WebResult(name = "EchoFaultWithNameResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoFaultWithName", output = "http://tempuri.org/ITestService/EchoFaultWithNameResponse", fault = {@FaultAction(className = ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultWithNameExceptionFault"), @FaultAction(className = ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultWithNameArgumentNullExceptionFault"), @FaultAction(className = ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultWithNameOutOfMemoryExceptionFault"), @FaultAction(className = ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultWithNameDivideByZeroExceptionFault")}) + @RequestWrapper(localName = "EchoFaultWithName", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoFaultWithName") + @WebMethod(operationName = "EchoFaultWithName", action = "http://tempuri.org/ITestService/EchoFaultWithName") + @ResponseWrapper(localName = "EchoFaultWithNameResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoFaultWithNameResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoFaultWithName( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "exceptionName", targetNamespace = "http://tempuri.org/") + java.lang.String exceptionName + ) throws ITestServiceEchoFaultWithNameExceptionFaultFaultMessage, ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage, ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage, ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage; + + @WebResult(name = "EchoWithFailResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoWithFail", output = "http://tempuri.org/ITestService/EchoWithFailResponse", fault = {@FaultAction(className = ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/AuthenticationFailure"), @FaultAction(className = ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/RetryOperationError")}) + @RequestWrapper(localName = "EchoWithFail", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithFail") + @WebMethod(operationName = "EchoWithFail", action = "http://tempuri.org/ITestService/EchoWithFail") + @ResponseWrapper(localName = "EchoWithFailResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithFailResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithFail( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "failTime", targetNamespace = "http://tempuri.org/") + java.lang.Integer failTime + ) throws ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage, ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage; + + @WebResult(name = "CheckACLOnAzureResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/CheckACLOnAzure", output = "http://tempuri.org/ITestService/CheckACLOnAzureResponse") + @RequestWrapper(localName = "CheckACLOnAzure", targetNamespace = "http://tempuri.org/", className = "org.tempuri.CheckACLOnAzure") + @WebMethod(operationName = "CheckACLOnAzure", action = "http://tempuri.org/ITestService/CheckACLOnAzure") + @ResponseWrapper(localName = "CheckACLOnAzureResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.CheckACLOnAzureResponse") + public java.lang.String checkACLOnAzure(); + + @WebResult(name = "EchoWithOnExitResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoWithOnExit", output = "http://tempuri.org/ITestService/EchoWithOnExitResponse") + @RequestWrapper(localName = "EchoWithOnExit", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithOnExit") + @WebMethod(operationName = "EchoWithOnExit", action = "http://tempuri.org/ITestService/EchoWithOnExit") + @ResponseWrapper(localName = "EchoWithOnExitResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithOnExitResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithOnExit( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "runTime", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration runTime, + @WebParam(name = "exitDelay", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration exitDelay, + @WebParam(name = "logPath", targetNamespace = "http://tempuri.org/") + java.lang.String logPath + ); + + @WebResult(name = "EchoFaultResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoFault", output = "http://tempuri.org/ITestService/EchoFaultResponse", fault = {@FaultAction(className = ITestServiceEchoFaultExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultExceptionFault"), @FaultAction(className = ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultArgumentNullExceptionFault"), @FaultAction(className = ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultOutOfMemoryExceptionFault"), @FaultAction(className = ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.class, value = "http://tempuri.org/ITestService/EchoFaultDivideByZeroExceptionFault")}) + @RequestWrapper(localName = "EchoFault", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoFault") + @WebMethod(operationName = "EchoFault", action = "http://tempuri.org/ITestService/EchoFault") + @ResponseWrapper(localName = "EchoFaultResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoFaultResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoFault( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "ex", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.system.Exception ex + ) throws ITestServiceEchoFaultExceptionFaultFaultMessage, ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage, ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage, ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage; + + @WebResult(name = "EchoWithDelayResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoWithDelay", output = "http://tempuri.org/ITestService/EchoWithDelayResponse", fault = {@FaultAction(className = ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/AuthenticationFailure"), @FaultAction(className = ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/RetryOperationError")}) + @RequestWrapper(localName = "EchoWithDelay", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithDelay") + @WebMethod(operationName = "EchoWithDelay", action = "http://tempuri.org/ITestService/EchoWithDelay") + @ResponseWrapper(localName = "EchoWithDelayResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoWithDelayResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithDelay( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "delay", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration delay + ) throws ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage, ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage; + + @WebResult(name = "GenerateLoadWithResponseDataResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/GenerateLoadWithResponseData", output = "http://tempuri.org/ITestService/GenerateLoadWithResponseDataResponse") + @RequestWrapper(localName = "GenerateLoadWithResponseData", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadWithResponseData") + @WebMethod(operationName = "GenerateLoadWithResponseData", action = "http://tempuri.org/ITestService/GenerateLoadWithResponseData") + @ResponseWrapper(localName = "GenerateLoadWithResponseDataResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadWithResponseDataResponse") + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoadWithResponseData( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "sleepTime", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration sleepTime, + @WebParam(name = "input_data", targetNamespace = "http://tempuri.org/") + byte[] inputData, + @WebParam(name = "output_data_size", targetNamespace = "http://tempuri.org/") + java.lang.Integer outputDataSize + ); + + @WebResult(name = "LastTimeResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/LastTime", output = "http://tempuri.org/ITestService/LastTimeResponse") + @RequestWrapper(localName = "LastTime", targetNamespace = "http://tempuri.org/", className = "org.tempuri.LastTime") + @WebMethod(operationName = "LastTime", action = "http://tempuri.org/ITestService/LastTime") + @ResponseWrapper(localName = "LastTimeResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.LastTimeResponse") + public javax.xml.datatype.XMLGregorianCalendar lastTime( + @WebParam(name = "millisec", targetNamespace = "http://tempuri.org/") + java.lang.Integer millisec + ); + + @WebResult(name = "GenerateLoadResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/GenerateLoad", output = "http://tempuri.org/ITestService/GenerateLoadResponse") + @RequestWrapper(localName = "GenerateLoad", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoad") + @WebMethod(operationName = "GenerateLoad", action = "http://tempuri.org/ITestService/GenerateLoad") + @ResponseWrapper(localName = "GenerateLoadResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadResponse") + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoad( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "millisec", targetNamespace = "http://tempuri.org/") + java.lang.Long millisec, + @WebParam(name = "input_data", targetNamespace = "http://tempuri.org/") + byte[] inputData, + @WebParam(name = "common_data_path", targetNamespace = "http://tempuri.org/") + java.lang.String commonDataPath + ); + + @WebResult(name = "ConsumeCPUResult", targetNamespace = "http://tempuri.org/") + @Action(input = "ConsumeCPU", output = "ConsumeCPUResponse") + @RequestWrapper(localName = "ConsumeCPU", targetNamespace = "http://tempuri.org/", className = "org.tempuri.ConsumeCPU") + @WebMethod(operationName = "ConsumeCPU", action = "ConsumeCPU") + @ResponseWrapper(localName = "ConsumeCPUResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.ConsumeCPUResponse") + public java.lang.String consumeCPU( + @WebParam(name = "time", targetNamespace = "http://tempuri.org/") + javax.xml.datatype.Duration time + ); + + @WebResult(name = "EchoAppSettingsResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoAppSettings", output = "http://tempuri.org/ITestService/EchoAppSettingsResponse") + @RequestWrapper(localName = "EchoAppSettings", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoAppSettings") + @WebMethod(operationName = "EchoAppSettings", action = "http://tempuri.org/ITestService/EchoAppSettings") + @ResponseWrapper(localName = "EchoAppSettingsResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoAppSettingsResponse") + public com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring echoAppSettings( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID + ); + + @WebResult(name = "EchoObject4Result", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoObject4", output = "http://tempuri.org/ITestService/EchoObject4Response") + @RequestWrapper(localName = "EchoObject4", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject4") + @WebMethod(operationName = "EchoObject4", action = "http://tempuri.org/ITestService/EchoObject4") + @ResponseWrapper(localName = "EchoObject4Response", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoObject4Response") + public org.datacontract.schemas._2004._07.services.ClassObj echoObject4( + @WebParam(name = "obj", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.services.ClassObj obj + ); + + @WebResult(name = "EchoResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/Echo", output = "http://tempuri.org/ITestService/EchoResponse", fault = {@FaultAction(className = ITestServiceEchoAuthenticationFailureFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/AuthenticationFailure"), @FaultAction(className = ITestServiceEchoRetryOperationErrorFaultFaultMessage.class, value = "http://hpc.microsoft.com/session/RetryOperationError")}) + @RequestWrapper(localName = "Echo", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Echo") + @WebMethod(operationName = "Echo", action = "http://tempuri.org/ITestService/Echo") + @ResponseWrapper(localName = "EchoResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echo( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID + ) throws ITestServiceEchoAuthenticationFailureFaultFaultMessage, ITestServiceEchoRetryOperationErrorFaultFaultMessage; + + @WebResult(name = "EchoExceptionResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/ITestService/EchoException", output = "http://tempuri.org/ITestService/EchoExceptionResponse") + @RequestWrapper(localName = "EchoException", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoException") + @WebMethod(operationName = "EchoException", action = "http://tempuri.org/ITestService/EchoException") + @ResponseWrapper(localName = "EchoExceptionResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoExceptionResponse") + public org.datacontract.schemas._2004._07.services.ComputerInfo echoException( + @WebParam(name = "refID", targetNamespace = "http://tempuri.org/") + java.lang.Integer refID, + @WebParam(name = "ex", targetNamespace = "http://tempuri.org/") + org.datacontract.schemas._2004._07.system.Exception ex + ); +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java new file mode 100644 index 0000000..008a340 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.121+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.AuthenticationFailure authenticationFailure; + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage() { + super(); + } + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.session.AuthenticationFailure getFaultInfo() { + return this.authenticationFailure; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java new file mode 100644 index 0000000..4f07a1c --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.084+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException; + + public ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException) { + super(message); + this.argumentNullException = argumentNullException; + } + + public ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException, Throwable cause) { + super(message, cause); + this.argumentNullException = argumentNullException; + } + + public org.datacontract.schemas._2004._07.system.ArgumentNullException getFaultInfo() { + return this.argumentNullException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java new file mode 100644 index 0000000..ecf0a61 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.099+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException; + + public ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException) { + super(message); + this.divideByZeroException = divideByZeroException; + } + + public ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException, Throwable cause) { + super(message, cause); + this.divideByZeroException = divideByZeroException; + } + + public org.datacontract.schemas._2004._07.system.DivideByZeroException getFaultInfo() { + return this.divideByZeroException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java new file mode 100644 index 0000000..21cfe47 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.075+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultExceptionFaultFaultMessage extends java.lang.Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.Exception exception; + + public ITestServiceEchoFaultExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.Exception exception) { + super(message); + this.exception = exception; + } + + public ITestServiceEchoFaultExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.Exception exception, Throwable cause) { + super(message, cause); + this.exception = exception; + } + + public org.datacontract.schemas._2004._07.system.Exception getFaultInfo() { + return this.exception; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java new file mode 100644 index 0000000..7af4a54 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.091+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException; + + public ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException) { + super(message); + this.outOfMemoryException = outOfMemoryException; + } + + public ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException, Throwable cause) { + super(message, cause); + this.outOfMemoryException = outOfMemoryException; + } + + public org.datacontract.schemas._2004._07.system.OutOfMemoryException getFaultInfo() { + return this.outOfMemoryException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java new file mode 100644 index 0000000..5021b48 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.030+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException; + + public ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException) { + super(message); + this.argumentNullException = argumentNullException; + } + + public ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.ArgumentNullException argumentNullException, Throwable cause) { + super(message, cause); + this.argumentNullException = argumentNullException; + } + + public org.datacontract.schemas._2004._07.system.ArgumentNullException getFaultInfo() { + return this.argumentNullException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java new file mode 100644 index 0000000..1fc6bbe --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.047+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException; + + public ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException) { + super(message); + this.divideByZeroException = divideByZeroException; + } + + public ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.DivideByZeroException divideByZeroException, Throwable cause) { + super(message, cause); + this.divideByZeroException = divideByZeroException; + } + + public org.datacontract.schemas._2004._07.system.DivideByZeroException getFaultInfo() { + return this.divideByZeroException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java new file mode 100644 index 0000000..45adf17 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.021+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameExceptionFaultFaultMessage extends java.lang.Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.Exception exception; + + public ITestServiceEchoFaultWithNameExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultWithNameExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultWithNameExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultWithNameExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.Exception exception) { + super(message); + this.exception = exception; + } + + public ITestServiceEchoFaultWithNameExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.Exception exception, Throwable cause) { + super(message, cause); + this.exception = exception; + } + + public org.datacontract.schemas._2004._07.system.Exception getFaultInfo() { + return this.exception; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java new file mode 100644 index 0000000..c8adf2f --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.038+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException; + + public ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException) { + super(message); + this.outOfMemoryException = outOfMemoryException; + } + + public ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException, Throwable cause) { + super(message, cause); + this.outOfMemoryException = outOfMemoryException; + } + + public org.datacontract.schemas._2004._07.system.OutOfMemoryException getFaultInfo() { + return this.outOfMemoryException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java new file mode 100644 index 0000000..cc4fc9e --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.129+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.RetryOperationError retryOperationError; + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage() { + super(); + } + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.session.RetryOperationError getFaultInfo() { + return this.retryOperationError; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java new file mode 100644 index 0000000..ece9fd3 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.107+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.AuthenticationFailure authenticationFailure; + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage() { + super(); + } + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.session.AuthenticationFailure getFaultInfo() { + return this.authenticationFailure; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java new file mode 100644 index 0000000..4eb819d --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.114+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.RetryOperationError retryOperationError; + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage() { + super(); + } + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.session.RetryOperationError getFaultInfo() { + return this.retryOperationError; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java new file mode 100644 index 0000000..6b99fd3 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.057+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.AuthenticationFailure authenticationFailure; + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage() { + super(); + } + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.session.AuthenticationFailure getFaultInfo() { + return this.authenticationFailure; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java new file mode 100644 index 0000000..c8081e1 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.065+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private com.microsoft.hpc.session.RetryOperationError retryOperationError; + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage() { + super(); + } + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.session.RetryOperationError getFaultInfo() { + return this.retryOperationError; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java new file mode 100644 index 0000000..01beb04 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.012+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "CommonDataError", targetNamespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper") +public class ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.aitestlib.CommonDataError commonDataError; + + public ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage() { + super(); + } + + public ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage(String message, org.datacontract.schemas._2004._07.aitestlib.CommonDataError commonDataError) { + super(message); + this.commonDataError = commonDataError; + } + + public ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage(String message, org.datacontract.schemas._2004._07.aitestlib.CommonDataError commonDataError, Throwable cause) { + super(message, cause); + this.commonDataError = commonDataError; + } + + public org.datacontract.schemas._2004._07.aitestlib.CommonDataError getFaultInfo() { + return this.commonDataError; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceImpl.java b/test/TestService/org/tempuri/ITestServiceImpl.java new file mode 100644 index 0000000..5a541f2 --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceImpl.java @@ -0,0 +1,1509 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility class for EchoSvc +// +// Jiabin Hu +//----------------------------------------------------------------------- + +package org.tempuri; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.management.ManagementFactory; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.UUID; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.Duration; +import javax.annotation.Resource; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.jaxws.context.WrappedMessageContext; +import org.apache.cxf.message.Message; +import org.datacontract.schemas._2004._07.services.ClassObj; +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.datacontract.schemas._2004._07.services.StatisticInfo; +import org.datacontract.schemas._2004._07.services.Sub; +import org.datacontract.schemas._2004._07.services.TestStruct; +import org.datacontract.schemas._2004._07.system.ArgumentException; +import org.datacontract.schemas._2004._07.system.ArgumentNullException; +import org.datacontract.schemas._2004._07.system.DivideByZeroException; +import org.datacontract.schemas._2004._07.system.OutOfMemoryException; +import org.w3c.dom.Element; + +import com.microsoft.hpc.scheduler.session.Constant; +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.servicecontext.Environment; +import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext; +import com.microsoft.hpc.scheduler.session.servicecontext.ExitEventListener; +import com.microsoft.hpc.scheduler.session.servicecontext.SOAEventArg; +import com.microsoft.hpc.scheduler.session.servicecontext.Sender; +import com.microsoft.hpc.scheduler.session.servicecontext.etw.ETWTraceEvent; +import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum; + + +import com.microsoft.hpc.session.RetryOperationError; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring; + +/** + * This class was generated by Apache CXF 2.3.3 2011-03-14T11:28:39.302+08:00 + * Generated source version: 2.3.3 + * + */ + +@javax.jws.WebService( + serviceName = "ITestService", + portName = "DefaultBinding_ITestService", + targetNamespace = "http://tempuri.org/", + wsdlLocation = "file:tempuri.org.wsdl", + endpointInterface = "org.tempuri.ITestService") +public class ITestServiceImpl implements ITestService +{ + @Resource + WebServiceContext wsContext; + + private static final Logger LOG = Logger.getLogger(ITestServiceImpl.class + .getName()); + + private static final int Default = 0; + private static final int READ_AccessDenied = 1; + private static final int READ_AccessDenied_ReadBytes = 2; + private static final int No_Read_PerReq = 3; + private static final int Read_Raw_Bytes = 4; + private static final int No_Read_Raw_PerReq = 5; + + private static int NonTerminatingErrorRetryCount = 0; + private static Map failCount = new HashMap(); + private static int taskid = -1; + private static int jobid = -1; + private static String scheduler; + + private static org.datacontract.schemas._2004._07.services.ObjectFactory svcObjFact = new org.datacontract.schemas._2004._07.services.ObjectFactory(); + + private String logfile; + private Object log = new Object(); + private static int processId = -1; + + static + { + String dummy = System.getenv(EnvVarNames.CCP_TASKSYSTEMID); + taskid = -1; + if (!Utility.isNullOrEmpty(dummy)) + { + try + { + taskid = Integer.parseInt(dummy); + } + catch (NumberFormatException e) + { + // taskid stays at -1; + } + } + + dummy = System.getenv(EnvVarNames.CCP_JOBID); + jobid = -1; + if (!Utility.isNullOrEmpty(dummy)) + { + try + { + jobid = Integer.parseInt(dummy); + } + catch (NumberFormatException e) + { + // jobid stays at -1; + } + } + + dummy = System.getenv(EnvVarNames.LONG_LOADING_TEST); + if (!Utility.isNullOrEmpty(dummy)) + { + try + { + Thread.sleep(30 * 1000); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + + scheduler = System.getenv(EnvVarNames.CCP_SCHEDULER); + try + { + String logPath = System.getenv(EnvVarNames.GRACEFUL_EXIT); + if (!Utility.isNullOrEmpty(logPath)) + { + File baseDir = new File(logPath); + File logDir = new File(baseDir, "CCP_AITest_Trace_" + jobid); + File logFile = new File(logDir, taskid + ".txt"); + + if (!System.getenv("CCP_OnAzure").equals("1")) + { + try + { + logDir.mkdirs(); + } + catch (Exception e) + { + e.printStackTrace(); + } + PrintWriter writer = new PrintWriter(new FileWriter(logFile, true)); + writer.println(Utility.getCurrentTime() + ": Svchost starts."); + writer.close(); + } + System.out.println(Utility.getCurrentTime() + ": Svchost starts."); + + ServiceContext.exitingEvents.addMyEventListener(new DefaultOnExitHandler(logFile)); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + String pid = ManagementFactory.getRuntimeMXBean().getName(); + int index = pid.indexOf("@"); + processId = Integer.parseInt(pid.substring(0, index)); + } + + public ITestServiceImpl() + { + String dummy = System.getenv(EnvVarNames.LONG_LOADING_TEST); + if (!Utility.isNullOrEmpty(dummy)) + { + try + { + Thread.sleep(30 * 1000); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + + } + + private synchronized void writeLog(String logDir, int refID, String msg, Object... args) + { + if (!Utility.isNullOrEmpty(logDir)) + { + try + { + new File(logDir).mkdirs(); + } + catch (Exception e) + { + System.out.println(e); + } + File logFileClass = new File(logDir, String.valueOf(refID) + ".txt"); + logfile = logFileClass.toString(); + + try + { + PrintWriter writer = new PrintWriter(new FileWriter(logFileClass, true)); + writer.format(msg, args); + writer.println(); + writer.close(); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } + } + + private void writeLog(int refID, String msg, Object... args) + { + String logDir = "\\\\" + scheduler + "\\CcpSpoolDir\\CCP_AITest_Trace_" + jobid; + writeLog(logDir, refID, msg, args); + } + + /* + * (non-Javadoc) + * + * @see + * org.tempuri.ITestService#echoObject2(org.datacontract.schemas._2004._07 + * .services.ClassObj obj )* + */ + public org.datacontract.schemas._2004._07.services.ClassObj echoObject2( + org.datacontract.schemas._2004._07.services.ClassObj obj) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoObject2"); + + return obj; + + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoDouble(java.lang.Double inp )* + */ + public java.lang.Double echoDouble(java.lang.Double inp) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoDouble"); + + return inp; + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoWithParam(java.lang.Integer refID + * ,)java.lang.Double d ,)java.lang.Float f ,)java.lang.Long i64 + * ,)java.lang.Integer i321 ,)java.lang.Integer i322 + * ,)org.datacontract.schemas._2004._07.services.TestEnum e + * ,)java.lang.String s )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithParam( + java.lang.Integer refID, java.lang.Double d, java.lang.Float f, java.lang.Long i64, + java.lang.Integer i321, java.lang.Integer i322, + org.datacontract.schemas._2004._07.services.TestEnum e, java.lang.String s) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoWithParam"); + try + { + TestStruct ts = new TestStruct(); + ts.setD(d); + ts.setF(f); + ts.setI64(i64); + ts.setI321(i321); + ts.setI322(i322); + ts.setE(e); + ts.setS(svcObjFact.createTestStructS(s)); + + Sub sub = new Sub(); + sub.setSubE(e); + sub.setSubF(f); + sub.setSubI(i321); + sub.setSubS(svcObjFact.createSubSubS(s)); + + ComputerInfo info = new ComputerInfo(); + + info.setRefID(refID); + String computername = InetAddress.getLocalHost().getHostName(); + info.setName(svcObjFact.createComputerInfoName(computername)); + info.setJobID(jobid); + info.setTaskID(taskid); + info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); + info.setCallIn(Utility.getXMLCurrentTime()); + + info.setTs(ts); + org.datacontract.schemas._2004._07.services.ObjectFactory fact = new org.datacontract.schemas._2004._07.services.ObjectFactory(); + info.setSub(fact.createComputerInfoSub(sub)); + + return info; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoObject(java.lang.String type + * ,)java.lang.Object o )* + */ + public java.lang.Object echoObject(java.lang.String type, java.lang.Object o) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoObject"); + + return o; + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoStruct(java.lang.Integer refID + * ,)org.datacontract.schemas._2004._07.services.TestStruct s )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoStruct( + java.lang.Integer refID, org.datacontract.schemas._2004._07.services.TestStruct s) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoStruct"); + try + { + ComputerInfo info = new ComputerInfo(); + + info.setRefID(refID); + String computername = InetAddress.getLocalHost().getHostName(); + info.setName(svcObjFact.createComputerInfoName(computername)); + info.setJobID(jobid); + info.setTaskID(taskid); + info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); + info.setCallIn(Utility.getXMLCurrentTime()); + + info.setTs(s); + return info; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.tempuri.ITestService#echoClass(org.datacontract.schemas._2004._07 + * .services.ClassFoo cls )* + */ + public org.datacontract.schemas._2004._07.services.ClassFoo echoClass( + org.datacontract.schemas._2004._07.services.ClassFoo cls) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoClass"); + + return cls; + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#serviceSideAsyncEcho(java.lang.Integer + * refID )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo serviceSideAsyncEcho( + java.lang.Integer refID) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation serviceSideAsyncEcho"); + + return new org.datacontract.schemas._2004._07.services.ComputerInfo(); + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#serializationTest(byte[] stream )* + */ + public java.lang.Boolean serializationTest(byte[] stream) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation serializationTest"); + try + { + java.lang.Boolean _return = null; + return _return; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* (non-Javadoc) + * @see org.tempuri.ITestService#trace(java.lang.Integer refID ,)com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring traceMsgs ,)javax.xml.datatype.Duration sleepBeforeTrace ,)javax.xml.datatype.Duration sleepAfterTrace ,)java.lang.Integer testActionId )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo trace(java.lang.Integer refID,com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring traceMsgs,javax.xml.datatype.Duration sleepBeforeTrace,javax.xml.datatype.Duration sleepAfterTrace,java.lang.Integer testActionId) throws ITestServiceTraceRetryOperationErrorFaultFaultMessage , ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage { + LOG.info("Executing operation trace"); + ETWTraceEvent etw = new ETWTraceEvent(wsContext); + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "[HpcServiceHost]: Request is received."); + Date callIn = new Date(); + + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "CallIn:" + callIn.toString()); + ComputerInfo info = buildComputerInfo(refID); + + try { + info.setCallIn(Utility.convertXMLGregorianCalendar(callIn)); + } catch (DatatypeConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceFaultException) { + etw.TraceEvent(JavaTraceLevelConverterEnum.Error, refID, "ThrowFaultException"); + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "[HpcServiceHost]: Response is sent back. IsFault = True"); + OutOfMemoryException err = new OutOfMemoryException(); + throw new ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage("Testing fault.", err); + + } else if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.RetryOperationError) { + etw.TraceEvent(JavaTraceLevelConverterEnum.Error, refID, "ThrowRetryOperationError"); + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "[HpcServiceHost]: Response is sent back. IsFault = True"); + RetryOperationError err = new RetryOperationError(); + throw new ITestServiceTraceRetryOperationErrorFaultFaultMessage("Testting RetryOperationError.", err); + } else if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceProcessExit) { + etw.TraceEvent(JavaTraceLevelConverterEnum.Error, refID, "ProcessExit"); + etw.Flush(); + Utility.sleep(20 * 1000); + Runtime.getRuntime().exit(refID); +// System.exit(refID); + } else if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.NoUserTrace) { + try { + info.setCallOut(Utility.convertXMLGregorianCalendar(new Date())); + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "CallOut:" + info.getCallOut().toString()); + return info; + } catch (DatatypeConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + try { + Thread.sleep(sleepBeforeTrace.getTimeInMillis(new Date())); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + int count = 1; + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceLargeAmount) { + count = 10000 / traceMsgs.getString().size(); + } + for(int i = 0; i < count; i++) { + for(String traceMsg : traceMsgs.getString()) { + String[] splitters = traceMsg.split("\\|", 5); + int iTracingType = Integer.parseInt(splitters[0]); + int iEventType = Integer.parseInt(splitters[1]); + int eventId = Integer.parseInt(splitters[2]); + int sleepTime = Integer.parseInt(splitters[3]); + String msg = splitters[4]; + TracingType tracingType = TracingType.fromInteger(iTracingType); + JavaTraceLevelConverterEnum eventType = JavaTraceLevelConverterEnum.convertFromInteger(iEventType); + if(tracingType == TracingType.TraceEvent) { + etw.TraceEvent(eventType, eventId, msg); + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceRequestProcessing) { + etw.Flush(); + } + } else if(tracingType == TracingType.TraceInformation) { + etw.TraceInformation(msg); + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceRequestProcessing) { + etw.Flush(); + } + } else if(tracingType == TracingType.TraceData) { + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceBigSize) { + StringBuffer data = new StringBuffer(); + for (int j = 0; j < 63 * 512; j++) { + data.append('0'); + } + etw.TraceData(eventType, eventId, data); + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceRequestProcessing) { + etw.Flush(); + } + for (int j = 0; j < 2 * 512; j++) { + data.append('1'); + } + etw.TraceData(eventType, eventId, data); + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceRequestProcessing) { + etw.Flush(); + } + } else { + TraceDataObj data = new TraceDataObj(msg); + etw.TraceData(eventType, eventId, data); + if(TracingTestActionId.fromInteger(testActionId) == TracingTestActionId.TraceRequestProcessing) { + etw.Flush(); + } + } + } else if(tracingType == TracingType.TraceTransfer) { + etw.TraceTransfer(eventId, msg, UUID.randomUUID()); + } + Utility.sleep(sleepTime); + } + + } + Utility.sleep(sleepAfterTrace.getTimeInMillis(new Date())); + try { + info.setCallOut(Utility.convertXMLGregorianCalendar(new Date())); + } catch (DatatypeConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "CallOut:" + info.getCallOut().toString()); + etw.TraceEvent(JavaTraceLevelConverterEnum.Verbose, refID, "[HpcServiceHost]: Response is sent back. IsFault = False"); + return info; + } + + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#runInprocSoaJob(* + */ + public java.lang.String runInprocSoaJob() + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation runInprocSoaJob"); + try + { + java.lang.String _return = ""; + return _return; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoObject3(java.lang.String type + * ,)java.lang.Object o )* + */ + public java.lang.Object echoObject3(java.lang.String type, java.lang.Object o) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoObject3"); + + return type; + } + + + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#ping(* + */ + public java.lang.Boolean ping() + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation ping"); + try + { + PrintWriter writer = null; + if (!Utility.isNullOrEmpty(logfile)) + { + writer = new PrintWriter(new FileWriter(new File(logfile), true)); + } + + if (writer != null) + { + writer.println("Incoming ping! Pong!"); + } + + return true; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#generateLoadWithInputFile(java.lang.Integer + * refID ,)java.lang.Long millisec ,)java.lang.String inputDataPath + * ,)java.lang.String commonDataPath )* + */ + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoadWithInputFile( + java.lang.Integer refID, java.lang.Long millisec, java.lang.String inputDataPath, + java.lang.String commonDataPath) + { + ServiceContext.Logger + .traceEvent(Level.ALL, "Executing operation generateLoadWithInputFile"); + try + { + return new org.datacontract.schemas._2004._07.services.StatisticInfo(); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.tempuri.ITestService#echoWithDelayOnSelectedNode(java.lang.Integer + * refID ,)java.lang.String selectedNode ,)javax.xml.datatype.Duration + * delayOnSelectedNode ,)javax.xml.datatype.Duration delayOnOtherNodes )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithDelayOnSelectedNode( + java.lang.Integer refID, java.lang.String selectedNode, + javax.xml.datatype.Duration delayOnSelectedNode, + javax.xml.datatype.Duration delayOnOtherNodes) + { + ServiceContext.Logger.traceEvent(Level.ALL, + "Executing operation echoWithDelayOnSelectedNode"); + try + { + String machine; + try + { + machine = InetAddress.getLocalHost().getHostName(); + } + catch (Exception e) + { + machine = ""; + } + + if (machine.compareToIgnoreCase(selectedNode) == 0) + { + return echoWithDelay(refID, delayOnSelectedNode); + } + else + { + return echoWithDelay(refID, delayOnOtherNodes); + } + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#kill(* + */ + public void kill() + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation kill"); + try + { + System.exit(0); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoFaultWithName(java.lang.Integer refID + * ,)java.lang.String exceptionName )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoFaultWithName( + java.lang.Integer refID, java.lang.String exceptionName) + throws ITestServiceEchoFaultWithNameExceptionFaultFaultMessage, + ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage, + ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage, + ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoFaultWithName"); + + String lowercaseName = exceptionName.toLowerCase(); + if (lowercaseName.equals("threadabortexception")) + { + // Unable to migrate. + System.exit(1); + } + else if (lowercaseName.equals("outofmemoryexception")) + { + OutOfMemoryException err = new OutOfMemoryException(); + throw new ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage( + "Testing fault.", err); + } + else if (lowercaseName.equals("dividebyzeroexception")) + { + DivideByZeroException err = new DivideByZeroException(); + throw new ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage( + "Testing fault.", err); + } + else if (lowercaseName.equals("argumentexception")) + { + // TODO: expose it in contract. + } + else if (lowercaseName.equals("argumentnullexception")) + { + ArgumentNullException err = new ArgumentNullException(); + throw new ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage( + "Testing fault.", err); + } + else + { + org.datacontract.schemas._2004._07.system.Exception err = new org.datacontract.schemas._2004._07.system.Exception(); + throw new ITestServiceEchoFaultWithNameExceptionFaultFaultMessage("Testing fault.", err); + } + + // should never be executed + return new ComputerInfo(); + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoWithFail(java.lang.Integer refID + * ,)java.lang.Integer failTime )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithFail( + java.lang.Integer refID, java.lang.Integer failTime) + throws ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage, + ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoWithFail"); + + try + { + if (failTime == 0) + { + return echo(refID); + } + String envPrefix = System.getenv(EnvVarNames.TEST_ECHO_FAIL); + int i = 1; + String envName = envPrefix + "-" + refID.toString(); + File envFile = new File(envName); + String storeVal = null; + try + { + Scanner reader = new Scanner(new BufferedReader(new FileReader(envFile))); + storeVal = String.valueOf(reader.nextInt()); + } + catch (Exception e) + { + storeVal = "0"; + } + System.out.format("Get the env %s value: %s%n", envName, storeVal); + i = Integer.parseInt(storeVal) + 1; + + PrintWriter writer = new PrintWriter(new FileWriter(envFile, false)); + writer.print(i); + writer.close(); + + if (i <= failTime) + { + System.out.println("Exiting..."); + System.exit(i); + } + return echo(refID); + } + catch (ITestServiceEchoAuthenticationFailureFaultFaultMessage e) + { + throw new ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage( + e.getMessage(), e.getFaultInfo()); + } + catch (ITestServiceEchoRetryOperationErrorFaultFaultMessage e) + { + throw new ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(e.getMessage(), + e.getFaultInfo()); + } + catch (Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoWithOnExit(java.lang.Integer refID + * ,)javax.xml.datatype.Duration runTime ,)javax.xml.datatype.Duration + * exitDelay ,)java.lang.String logPath )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithOnExit( + java.lang.Integer refID, javax.xml.datatype.Duration runTime, + javax.xml.datatype.Duration exitDelay, java.lang.String logPath) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoWithOnExit"); + + try + { + System.out.println("Start call " + refID.toString()); + ComputerInfo info = echo(refID); + String taskInfo = String.format("%s.%s.%s", System.getenv(EnvVarNames.CCP_JOBID), + System.getenv(EnvVarNames.CCP_TASKID), + System.getenv(EnvVarNames.CCP_TASKINSTANCEID)); + boolean isOnAzure = System.getenv(EnvVarNames.CCP_ONAZURE) != null + && System.getenv(EnvVarNames.CCP_ONAZURE).equals("1"); + if (!isOnAzure && !Utility.isNullOrEmpty(logPath)) + { + writeLog(logPath + "\\CCP_AITest_Trace_" + String.valueOf(jobid), refID, + "[Request] %s%%%s%%Svchost called.", Utility.getCurrentTime(), taskInfo); + } + System.out.format("[Request] %s%%%s%%Svchost called.%n", Utility.getCurrentTime(), + taskInfo); + EchoWithOnExitHandler onExit = new EchoWithOnExitHandler( + exitDelay.getTimeInMillis(new Date()), logPath, refID, info); + ServiceContext.exitingEvents.addMyEventListener(onExit); + Thread.sleep(runTime.getTimeInMillis(new Date())); + if (!info.isOnExitCalled()) + { + ServiceContext.exitingEvents.removedMyEventListener(onExit); + } + return info; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoFault(java.lang.Integer refID + * ,)org.datacontract.schemas._2004._07.system.Exception ex )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoFault( + java.lang.Integer refID, org.datacontract.schemas._2004._07.system.Exception ex) + throws ITestServiceEchoFaultExceptionFaultFaultMessage, + ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage, + ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage, + ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoFault"); + + if (ex != null) + { + if (ex instanceof OutOfMemoryException) + { + OutOfMemoryException err = new OutOfMemoryException(); + throw new ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage( + "Testing fault.", err); + } + else if (ex instanceof DivideByZeroException) + { + DivideByZeroException err = new DivideByZeroException(); + throw new ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage( + "Testing fault.", err); + } + else if (ex instanceof ArgumentException) + { + // TODO: Expose it in contract. + } + else if (ex instanceof ArgumentNullException) + { + ArgumentNullException err = new ArgumentNullException(); + throw new ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage( + "Testing fault.", err); + } + else + { + org.datacontract.schemas._2004._07.system.Exception err = new org.datacontract.schemas._2004._07.system.Exception(); + throw new ITestServiceEchoFaultExceptionFaultFaultMessage("Testing fault.", err); + } + } + + ComputerInfo info; + try + { + info = echo(refID); + } + catch (Exception e) + { + info = new ComputerInfo(); + } + return info; + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoWithDelay(java.lang.Integer refID + * ,)javax.xml.datatype.Duration delay )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoWithDelay( + java.lang.Integer refID, javax.xml.datatype.Duration delay) + throws ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage, + ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoWithDelay"); + + try + { + System.out.println("Start call " + refID.toString()); + Thread.sleep((long) delay.getTimeInMillis(new Date())); + return echo(refID); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.tempuri.ITestService#generateLoadWithResponseData(java.lang.Integer + * refID ,)javax.xml.datatype.Duration sleepTime ,)byte[] inputData + * ,)java.lang.Integer outputDataSize )* + */ + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoadWithResponseData( + java.lang.Integer refID, javax.xml.datatype.Duration sleepTime, byte[] inputData, + java.lang.Integer outputDataSize) + { + ServiceContext.Logger.traceEvent(Level.ALL, + "Executing operation generateLoadWithResponseData"); + + try + { + StatisticInfo info = new StatisticInfo(); + info.setRefID(refID); + info.setStartTime(Utility.getXMLCurrentTime()); + if (inputData != null) + { + for (byte b : inputData) + { + System.out.print(b); + } + } + Thread.sleep(sleepTime.getTimeInMillis(new Date())); + + String instanceid = System.getenv(EnvVarNames.CCP_TASKINSTANCEID); + String taskid = System.getenv(EnvVarNames.CCP_TASKID); + if (Utility.isNullOrEmpty(instanceid)) + instanceid = "0"; + if (Utility.isNullOrEmpty(taskid)) + taskid = "0"; + + if (instanceid.equals("0")) + info.setInstanceId(svcObjFact.createStatisticInfoInstanceId(taskid)); + else + info.setInstanceId(svcObjFact.createStatisticInfoInstanceId(taskid + "." + + instanceid)); + info.setEndTime(Utility.getXMLCurrentTime()); + + return info; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#lastTime(java.lang.Integer millisec )* + */ + public javax.xml.datatype.XMLGregorianCalendar lastTime(java.lang.Integer millisec) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation lastTime"); + + try + { + Thread.sleep((long) millisec); + return Utility.getXMLCurrentTime(); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#generateLoad(java.lang.Integer refID + * ,)java.lang.Long millisec ,)byte[] inputData ,)java.lang.String + * commonDataPath )* + */ + public org.datacontract.schemas._2004._07.services.StatisticInfo generateLoad( + java.lang.Integer refID, java.lang.Long millisec, byte[] inputData, + java.lang.String commonDataPath) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation generateLoad"); + try + { + StatisticInfo info = new StatisticInfo(); + info.setRefID(refID); + info.setStartTime(Utility.getXMLCurrentTime()); + GregorianCalendar endTime = new GregorianCalendar(); + endTime.add(GregorianCalendar.MILLISECOND, millisec.intValue()); + + if (!Utility.isNullOrEmpty(commonDataPath)) + { + // Unmigratable. + } + + if (inputData != null) + { + for (byte b : inputData) + { + System.out.print(b); + } + } + + while (endTime.after(new GregorianCalendar())) + { + } + + String instanceid = System.getenv(EnvVarNames.CCP_TASKINSTANCEID); + String taskid = System.getenv(EnvVarNames.CCP_TASKID); + if (Utility.isNullOrEmpty(instanceid)) + instanceid = "0"; + if (Utility.isNullOrEmpty(taskid)) + taskid = "0"; + + if (instanceid.equals("0")) + info.setInstanceId(svcObjFact.createStatisticInfoInstanceId(taskid)); + else + info.setInstanceId(svcObjFact.createStatisticInfoInstanceId(taskid + "." + + instanceid)); + info.setEndTime(Utility.getXMLCurrentTime()); + + return info; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#consumeCPU(javax.xml.datatype.Duration time + * )* + */ + public java.lang.String consumeCPU(javax.xml.datatype.Duration time) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation consumeCPU"); + try + { + Pi PI = new Pi(); + PI.echo(); + return Pi.calculatePi(time.getTimeInMillis(new Date())); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoAppSettings(java.lang.Integer refID )* + */ + public com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring echoAppSettings( + java.lang.Integer refID) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoAppSettings"); + try + { + com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring _return = new com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring(); + return _return; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.tempuri.ITestService#echoObject4(org.datacontract.schemas._2004._07 + * .services.ClassObj obj )* + */ + public org.datacontract.schemas._2004._07.services.ClassObj echoObject4( + org.datacontract.schemas._2004._07.services.ClassObj obj) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoObject4"); + try + { + ClassObj _return = new ClassObj(); + + _return.setO(obj.getO()); + _return.setType(obj.getType()); + + return _return; + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echo(java.lang.Integer refID )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echo(java.lang.Integer refID) + throws ITestServiceEchoAuthenticationFailureFaultFaultMessage, + ITestServiceEchoRetryOperationErrorFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echo"); + + TestStruct ts = new TestStruct(); + ts.setD(2d); + ts.setF(3f); + ts.setI64(4l); + ts.setI321(1); + ts.setI322(2); + ts.setS(svcObjFact.createTestStructS("")); + + ComputerInfo info = new ComputerInfo(); + info.setRefID(refID); + String machineName; + try + { + machineName = InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + machineName = ""; + } + info.setName(svcObjFact.createComputerInfoName(machineName)); + info.setJobID(jobid); + info.setTaskID(taskid); + info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); + + try + { + info.setCallIn(Utility.getXMLCurrentTime()); + } + catch (DatatypeConfigurationException e1) + { + e1.printStackTrace(); + System.exit(1); + } + + info.setTs(ts); + + String username = System.getProperty("user.name"); + info.setRunAsUser(svcObjFact.createComputerInfoRunAsUser(username)); + + info.setOnExitCalled(false); + + Map envMap = System.getenv(); + List envList = new ArrayList(); + for (String envName : envMap.keySet()) + { + KeyValueOfstringstring entry = new KeyValueOfstringstring(); + entry.setKey(envName); + entry.setValue(envMap.get(envName)); + envList.add(entry); + if (envName.compareToIgnoreCase(EnvVarNames.NON_TERMINATING_ERROR_RETRY_COUNT) == 0) + { + if (NonTerminatingErrorRetryCount < Integer.parseInt(entry.getValue())) + { + NonTerminatingErrorRetryCount++; + System.out.format("Throw NonTerminatingErrorRetryCount times: %d%n", + NonTerminatingErrorRetryCount); + + throw Utility.BuildRetryOperationError("test", + String.valueOf(NonTerminatingErrorRetryCount)); + } + } + } + + String WriteFileTest = System.getenv(EnvVarNames.WRITE_FAIL_TEST); + if (!Utility.isNullOrEmpty(WriteFileTest)) + { + try + { + for (String file : WriteFileTest.split(";")) + { + System.out.format("Begin to write file %s%n", file); + FileWriter writer = new FileWriter(new File(file), true); + writer.close(); + } + for (String file : WriteFileTest.split(";")) + { + System.out.format("Begin to delete file %s%n", file); + File f = new File(file); + f.delete(); + } + } + catch (Exception e) + { + e.printStackTrace(); + throw Utility.BuildRetryOperationError(e.toString()); + } + } + System.out.format("Called %d%n", refID); + + return info; + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#echoException(java.lang.Integer refID + * ,)org.datacontract.schemas._2004._07.system.Exception ex )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo echoException( + java.lang.Integer refID, org.datacontract.schemas._2004._07.system.Exception ex) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation echoException"); + + try + { + org.datacontract.schemas._2004._07.services.ComputerInfo _return = new org.datacontract.schemas._2004._07.services.ComputerInfo(); + return _return; + } + catch (java.lang.Exception exc) + { + exc.printStackTrace(); + throw new RuntimeException(exc); + } + } + + class EchoWithOnExitHandler implements ExitEventListener + { + private long exitDelay; + private String logPath; + private int refID; + private ComputerInfo info; + + EchoWithOnExitHandler(long delay, String logPath, int refID, ComputerInfo info) + { + this.exitDelay = delay; + this.logPath = logPath; + this.refID = refID; + this.info = info; + } + + @Override + public void OnExiting(Sender sender, SOAEventArg soaEventArg) + { + try + { + Thread.sleep(exitDelay); + String onAzureEnv = System.getenv("CCP_OnAzure"); + if (!Utility.isNullOrEmpty(onAzureEnv) && !onAzureEnv.equals("1") + && Utility.isNullOrEmpty(logPath)) + { + String taskInfo = String.format("%s.%s.%s", + System.getenv(EnvVarNames.CCP_JOBID), + System.getenv(EnvVarNames.CCP_TASKID), + System.getenv(EnvVarNames.CCP_TASKINSTANCEID)); + writeLog(logPath + "\\CCP_AITest_Trace_" + String.valueOf(jobid), refID, + "[Request] %s%%%s%%Svchost called.", Utility.getCurrentTime(), taskInfo); + } + System.out.format("[Exit] %s: GracefulExitEvent called.%n", + Utility.getCurrentTime()); + info.setOnExitCalled(true); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + static class DefaultOnExitHandler implements ExitEventListener + { + private File logFile; + + DefaultOnExitHandler(File logFile) + { + this.logFile = logFile; + } + + public void OnExiting(Sender sender, SOAEventArg soaEventArg) + { + String onAzureEnv = System.getenv("CCP_OnAzure"); + if (!Utility.isNullOrEmpty(onAzureEnv) && !onAzureEnv.equals("1")) + { + PrintWriter writer = null; + try + { + writer = new PrintWriter(new FileWriter(logFile, true)); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + String envs = String.format("%s.%s.%s", System.getenv(EnvVarNames.CCP_JOBID), + System.getenv(EnvVarNames.CCP_TASKID), + System.getenv(EnvVarNames.CCP_TASKINSTANCEID)); + writer.format("[Exit] %s%%%s%%GracefulExitEvent called.%n", + Utility.getCurrentTime(), envs); + writer.close(); + } + System.out.format("[Exit] %s: GracefulExitEvent called.%n", Utility.getCurrentTime()); + return; + } + } + + /* + * (non-Javadoc) + * + * @see org.tempuri.ITestService#getCommonData(java.lang.Integer refID + * ,)javax.xml.datatype.Duration sleepBeforeGet + * ,)javax.xml.datatype.Duration sleepAfterGet ,)java.lang.String + * dataClientId ,)java.lang.String expectedMd5Hash ,)java.lang.Integer + * testActionId )* + */ + public org.datacontract.schemas._2004._07.services.ComputerInfo getCommonData( + java.lang.Integer refID, javax.xml.datatype.Duration sleepBeforeGet, + javax.xml.datatype.Duration sleepAfterGet, java.lang.String dataClientId, + java.lang.String expectedMd5Hash, java.lang.Integer testActionId) + throws ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation getCommonData"); + try + { + switch(testActionId) + { + case Read_Raw_Bytes: + long sleepTime = (long) sleepBeforeGet.getTimeInMillis(new Date()); + Thread.sleep(sleepTime); + + System.out.format("%s: %d: Try to read raw common data for DataClient: %s\n", Utility.getCurrentTime(), refID, dataClientId); + try + { + DataClient dataClient = ServiceContext.getDataClient(dataClientId); + byte[] data = dataClient.readRawBytesAll(); + + // Verify + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] md5Bytes = md.digest(data); + String commonDataMd5Hash = ""; + for (byte b : md5Bytes) + { + commonDataMd5Hash += String.format("%02X", b); + } + if (!commonDataMd5Hash.equalsIgnoreCase(expectedMd5Hash)) + { + String output = String.format("Corrupted common data in content. Expected md5: %s, actual md5: %s", expectedMd5Hash, commonDataMd5Hash); + System.out.println(output); + throw new Exception(output); + } + + System.out.format("%s: %d: Common data for DataClient: %s validated", Utility.getCurrentTime(), refID, dataClientId); + dataClient.close(); + } + + catch (Exception e) + { + boolean fileAccessable = false; + try + { + String path = System.getenv("HPC_RUNTIMESHARE"); + if (!Utility.isNullOrEmpty(path)) + { + path += "\\Data"; + path += "\\" + String.valueOf(hashString(dataClientId)); + } + System.out.println(path); + fileAccessable = (new File(path)).exists(); + } + catch (Exception e_alt) + { + // swallow + } + String errmsg = String.format("%s: %d: Unexpected exception thrown when reading data: %s\n", Utility.getCurrentTime(), refID, e.toString()); + throw new Exception(String.format("ErrMsg: %s\nOutput: %s\nFileAccessable: %s", errmsg, e.getMessage(), String.valueOf(fileAccessable))); + } + return echoWithDelay(refID, sleepAfterGet); + case READ_AccessDenied: + case READ_AccessDenied_ReadBytes: + case No_Read_PerReq: + case No_Read_Raw_PerReq: + case Default: + default: + // unimplemented due to API difference + return null; + } + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + // throw new + // ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage("ITestService_GetCommonData_CommonDataErrorFault_FaultMessage..."); + } + + private static int hashString(String str) + { + final int MaxSubDirectoryCount = 1024; + int hashValue = 0; + for (int i = 0; i < str.length(); i++) + { + hashValue = hashValue * 37 + str.charAt(i); + } + + hashValue = Math.abs(hashValue); + + return hashValue % MaxSubDirectoryCount; + } + + @Override + public String checkACLOnAzure() + { + // TODO Auto-generated method stub + return null; + } + + private ComputerInfo buildComputerInfo(int refID) + { + TestStruct ts = new TestStruct(); + ts.setD((double) 2); + ts.setF((float)3); + ts.setI64((long) 4); + ts.setI321(1); + ts.setI322(2); + ts.setS(svcObjFact.createTestStructS("")); + + ComputerInfo info = new ComputerInfo(); + info.setRefID(refID); + String machineName; + try + { + machineName = InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + machineName = ""; + } + info.setName(svcObjFact.createComputerInfoName(machineName)); + info.setJobID(jobid); + info.setTaskID(taskid); + info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); + info.setProcessId(this.processId); + try + { + info.setCallIn(Utility.getXMLCurrentTime()); + } + catch (DatatypeConfigurationException e1) + { + e1.printStackTrace(); + System.exit(1); + } + info.setTs(ts); + return info; + } + + + private class TraceDataObj { + private String s; + public TraceDataObj(String value) { + s = value; + } + + public String toString() { + return s; + } + } + +} diff --git a/test/TestService/org/tempuri/ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage.java new file mode 100644 index 0000000..5accdae --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.003+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101149L; + + private org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException; + + public ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage() { + super(); + } + + public ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException) { + super(message); + this.outOfMemoryException = outOfMemoryException; + } + + public ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage(String message, org.datacontract.schemas._2004._07.system.OutOfMemoryException outOfMemoryException, Throwable cause) { + super(message, cause); + this.outOfMemoryException = outOfMemoryException; + } + + public org.datacontract.schemas._2004._07.system.OutOfMemoryException getFaultInfo() { + return this.outOfMemoryException; + } +} diff --git a/test/TestService/org/tempuri/ITestServiceTraceRetryOperationErrorFaultFaultMessage.java b/test/TestService/org/tempuri/ITestServiceTraceRetryOperationErrorFaultFaultMessage.java new file mode 100644 index 0000000..e3678ef --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceTraceRetryOperationErrorFaultFaultMessage.java @@ -0,0 +1,45 @@ + +package org.tempuri; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:48.974+08:00 + * Generated source version: 2.4.0 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceTraceRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20120918101148L; + + private com.microsoft.hpc.session.RetryOperationError retryOperationError; + + public ITestServiceTraceRetryOperationErrorFaultFaultMessage() { + super(); + } + + public ITestServiceTraceRetryOperationErrorFaultFaultMessage(String message) { + super(message); + } + + public ITestServiceTraceRetryOperationErrorFaultFaultMessage(String message, Throwable cause) { + super(message, cause); + } + + public ITestServiceTraceRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceTraceRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.session.RetryOperationError getFaultInfo() { + return this.retryOperationError; + } +} diff --git a/test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java b/test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java new file mode 100644 index 0000000..be19f05 --- /dev/null +++ b/test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java @@ -0,0 +1,30 @@ + +package org.tempuri; + +import javax.xml.ws.Endpoint; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.217+08:00 + * Generated source version: 2.4.0 + * + */ + +public class ITestService_DefaultBindingITestService_Server{ + + protected ITestService_DefaultBindingITestService_Server() throws Exception { + System.out.println("Starting Server"); + Object implementor = new ITestServiceImpl(); + String address = "https://localhost/Broker"; + Endpoint.publish(address, implementor); + } + + public static void main(String args[]) throws Exception { + new ITestService_DefaultBindingITestService_Server(); + System.out.println("Server ready..."); + + Thread.sleep(5 * 60 * 1000); + System.out.println("Server exiting"); + System.exit(0); + } +} diff --git a/test/TestService/org/tempuri/ITestService_Service.java b/test/TestService/org/tempuri/ITestService_Service.java new file mode 100644 index 0000000..878df8c --- /dev/null +++ b/test/TestService/org/tempuri/ITestService_Service.java @@ -0,0 +1,100 @@ + +/* + * + */ + +package org.tempuri; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.Service; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-18T10:11:49.221+08:00 + * Generated source version: 2.4.0 + * + */ + + +@WebServiceClient(name = "ITestService", + wsdlLocation = "file:tempuri.org.wsdl", + targetNamespace = "http://tempuri.org/") +public class ITestService_Service extends Service { + + public final static URL WSDL_LOCATION; + + public final static QName SERVICE = new QName("http://tempuri.org/", "ITestService"); + public final static QName DefaultBindingITestService = new QName("http://tempuri.org/", "DefaultBinding_ITestService"); + static { + URL url = null; + try { + url = new URL("file:tempuri.org.wsdl"); + } catch (MalformedURLException e) { + java.util.logging.Logger.getLogger(ITestService_Service.class.getName()) + .log(java.util.logging.Level.INFO, + "Can not initialize the default wsdl from {0}", "file:tempuri.org.wsdl"); + } + WSDL_LOCATION = url; + } + + public ITestService_Service(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public ITestService_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public ITestService_Service() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public ITestService_Service(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public ITestService_Service(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public ITestService_Service(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService() { + return super.getPort(DefaultBindingITestService, ITestService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService(WebServiceFeature... features) { + return super.getPort(DefaultBindingITestService, ITestService.class, features); + } + +} diff --git a/test/TestService/org/tempuri/JavaAITestSvcLib.java b/test/TestService/org/tempuri/JavaAITestSvcLib.java new file mode 100644 index 0000000..355f4ad --- /dev/null +++ b/test/TestService/org/tempuri/JavaAITestSvcLib.java @@ -0,0 +1,100 @@ + +/* + * + */ + +package org.tempuri; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.Service; + +/** + * This class was generated by Apache CXF 2.4.0 + * 2012-09-17T18:19:06.589+08:00 + * Generated source version: 2.4.0 + * + */ + + +@WebServiceClient(name = "JavaAITestSvcLib", + wsdlLocation = "file:tempuri.org.wsdl", + targetNamespace = "http://tempuri.org/") +public class JavaAITestSvcLib extends Service { + + public final static URL WSDL_LOCATION; + + public final static QName SERVICE = new QName("http://tempuri.org/", "JavaAITestSvcLib"); + public final static QName DefaultBindingITestService = new QName("http://tempuri.org/", "DefaultBinding_ITestService"); + static { + URL url = null; + try { + url = new URL("file:tempuri.org.wsdl"); + } catch (MalformedURLException e) { + java.util.logging.Logger.getLogger(JavaAITestSvcLib.class.getName()) + .log(java.util.logging.Level.INFO, + "Can not initialize the default wsdl from {0}", "file:tempuri.org.wsdl"); + } + WSDL_LOCATION = url; + } + + public JavaAITestSvcLib(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public JavaAITestSvcLib(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public JavaAITestSvcLib() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public JavaAITestSvcLib(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public JavaAITestSvcLib(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public JavaAITestSvcLib(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService() { + return super.getPort(DefaultBindingITestService, ITestService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns ITestService + */ + @WebEndpoint(name = "DefaultBinding_ITestService") + public ITestService getDefaultBindingITestService(WebServiceFeature... features) { + return super.getPort(DefaultBindingITestService, ITestService.class, features); + } + +} diff --git a/test/TestService/org/tempuri/Kill.java b/test/TestService/org/tempuri/Kill.java new file mode 100644 index 0000000..37bfad4 --- /dev/null +++ b/test/TestService/org/tempuri/Kill.java @@ -0,0 +1,34 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "Kill") +public class Kill { + + +} diff --git a/test/TestService/org/tempuri/KillResponse.java b/test/TestService/org/tempuri/KillResponse.java new file mode 100644 index 0000000..19fb485 --- /dev/null +++ b/test/TestService/org/tempuri/KillResponse.java @@ -0,0 +1,34 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "KillResponse") +public class KillResponse { + + +} diff --git a/test/TestService/org/tempuri/LastTime.java b/test/TestService/org/tempuri/LastTime.java new file mode 100644 index 0000000..5a298cf --- /dev/null +++ b/test/TestService/org/tempuri/LastTime.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="millisec" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "millisec" +}) +@XmlRootElement(name = "LastTime") +public class LastTime { + + @XmlElement(name = "millisec", namespace = "http://tempuri.org/") + protected Integer millisec; + + /** + * Gets the value of the millisec property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getMillisec() { + return millisec; + } + + /** + * Sets the value of the millisec property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setMillisec(Integer value) { + this.millisec = value; + } + +} diff --git a/test/TestService/org/tempuri/LastTimeResponse.java b/test/TestService/org/tempuri/LastTimeResponse.java new file mode 100644 index 0000000..e255a64 --- /dev/null +++ b/test/TestService/org/tempuri/LastTimeResponse.java @@ -0,0 +1,67 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.XMLGregorianCalendar; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="LastTimeResult" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "lastTimeResult" +}) +@XmlRootElement(name = "LastTimeResponse") +public class LastTimeResponse { + + @XmlElement(name = "LastTimeResult", namespace = "http://tempuri.org/") + @XmlSchemaType(name = "dateTime") + protected XMLGregorianCalendar lastTimeResult; + + /** + * Gets the value of the lastTimeResult property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getLastTimeResult() { + return lastTimeResult; + } + + /** + * Sets the value of the lastTimeResult property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setLastTimeResult(XMLGregorianCalendar value) { + this.lastTimeResult = value; + } + +} diff --git a/test/TestService/org/tempuri/ObjectFactory.java b/test/TestService/org/tempuri/ObjectFactory.java new file mode 100644 index 0000000..0a88519 --- /dev/null +++ b/test/TestService/org/tempuri/ObjectFactory.java @@ -0,0 +1,986 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; +import org.datacontract.schemas._2004._07.services.ClassFoo; +import org.datacontract.schemas._2004._07.services.ClassObj; +import org.datacontract.schemas._2004._07.services.ComputerInfo; +import org.datacontract.schemas._2004._07.services.StatisticInfo; +import org.datacontract.schemas._2004._07.system.Exception; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.tempuri package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _EchoWithDelayOnSelectedNodeSelectedNode_QNAME = new QName("http://tempuri.org/", "selectedNode"); + private final static QName _EchoObject2ResponseEchoObject2Result_QNAME = new QName("http://tempuri.org/", "EchoObject2Result"); + private final static QName _GenerateLoadResponseGenerateLoadResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadResult"); + private final static QName _EchoObjectType_QNAME = new QName("http://tempuri.org/", "type"); + private final static QName _EchoObjectO_QNAME = new QName("http://tempuri.org/", "o"); + private final static QName _EchoFaultWithNameExceptionName_QNAME = new QName("http://tempuri.org/", "exceptionName"); + private final static QName _EchoResponseEchoResult_QNAME = new QName("http://tempuri.org/", "EchoResult"); + private final static QName _TraceResponseTraceResult_QNAME = new QName("http://tempuri.org/", "TraceResult"); + private final static QName _GetCommonDataResponseGetCommonDataResult_QNAME = new QName("http://tempuri.org/", "GetCommonDataResult"); + private final static QName _EchoObjectResponseEchoObjectResult_QNAME = new QName("http://tempuri.org/", "EchoObjectResult"); + private final static QName _EchoObject4ResponseEchoObject4Result_QNAME = new QName("http://tempuri.org/", "EchoObject4Result"); + private final static QName _EchoWithParamS_QNAME = new QName("http://tempuri.org/", "s"); + private final static QName _GenerateLoadWithInputFileResponseGenerateLoadWithInputFileResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithInputFileResult"); + private final static QName _EchoObject3ResponseEchoObject3Result_QNAME = new QName("http://tempuri.org/", "EchoObject3Result"); + private final static QName _EchoWithDelayOnSelectedNodeResponseEchoWithDelayOnSelectedNodeResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayOnSelectedNodeResult"); + private final static QName _SerializationTestStream_QNAME = new QName("http://tempuri.org/", "stream"); + private final static QName _RunInprocSoaJobResponseRunInprocSoaJobResult_QNAME = new QName("http://tempuri.org/", "RunInprocSoaJobResult"); + private final static QName _EchoStructResponseEchoStructResult_QNAME = new QName("http://tempuri.org/", "EchoStructResult"); + private final static QName _EchoObject4Obj_QNAME = new QName("http://tempuri.org/", "obj"); + private final static QName _ServiceSideAsyncEchoResponseServiceSideAsyncEchoResult_QNAME = new QName("http://tempuri.org/", "ServiceSideAsyncEchoResult"); + private final static QName _EchoFaultResponseEchoFaultResult_QNAME = new QName("http://tempuri.org/", "EchoFaultResult"); + private final static QName _EchoWithOnExitLogPath_QNAME = new QName("http://tempuri.org/", "logPath"); + private final static QName _ConsumeCPUResponseConsumeCPUResult_QNAME = new QName("http://tempuri.org/", "ConsumeCPUResult"); + private final static QName _EchoWithOnExitResponseEchoWithOnExitResult_QNAME = new QName("http://tempuri.org/", "EchoWithOnExitResult"); + private final static QName _CheckACLOnAzureResponseCheckACLOnAzureResult_QNAME = new QName("http://tempuri.org/", "CheckACLOnAzureResult"); + private final static QName _EchoWithDelayResponseEchoWithDelayResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayResult"); + private final static QName _EchoClassResponseEchoClassResult_QNAME = new QName("http://tempuri.org/", "EchoClassResult"); + private final static QName _GetCommonDataExpectedMd5Hash_QNAME = new QName("http://tempuri.org/", "expectedMd5Hash"); + private final static QName _GetCommonDataDataClientId_QNAME = new QName("http://tempuri.org/", "dataClientId"); + private final static QName _EchoFaultEx_QNAME = new QName("http://tempuri.org/", "ex"); + private final static QName _GenerateLoadWithResponseDataResponseGenerateLoadWithResponseDataResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithResponseDataResult"); + private final static QName _EchoAppSettingsResponseEchoAppSettingsResult_QNAME = new QName("http://tempuri.org/", "EchoAppSettingsResult"); + private final static QName _EchoClassCls_QNAME = new QName("http://tempuri.org/", "cls"); + private final static QName _GenerateLoadWithInputFileCommonDataPath_QNAME = new QName("http://tempuri.org/", "common_data_path"); + private final static QName _GenerateLoadWithInputFileInputDataPath_QNAME = new QName("http://tempuri.org/", "input_data_path"); + private final static QName _GenerateLoadWithResponseDataInputData_QNAME = new QName("http://tempuri.org/", "input_data"); + private final static QName _EchoWithFailResponseEchoWithFailResult_QNAME = new QName("http://tempuri.org/", "EchoWithFailResult"); + private final static QName _EchoExceptionResponseEchoExceptionResult_QNAME = new QName("http://tempuri.org/", "EchoExceptionResult"); + private final static QName _EchoWithParamResponseEchoWithParamResult_QNAME = new QName("http://tempuri.org/", "EchoWithParamResult"); + private final static QName _EchoFaultWithNameResponseEchoFaultWithNameResult_QNAME = new QName("http://tempuri.org/", "EchoFaultWithNameResult"); + private final static QName _TraceTraceMsgs_QNAME = new QName("http://tempuri.org/", "traceMsgs"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.tempuri + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link EchoFaultWithNameResponse } + * + */ + public EchoFaultWithNameResponse createEchoFaultWithNameResponse() { + return new EchoFaultWithNameResponse(); + } + + /** + * Create an instance of {@link EchoAppSettings } + * + */ + public EchoAppSettings createEchoAppSettings() { + return new EchoAppSettings(); + } + + /** + * Create an instance of {@link EchoWithParamResponse } + * + */ + public EchoWithParamResponse createEchoWithParamResponse() { + return new EchoWithParamResponse(); + } + + /** + * Create an instance of {@link EchoAppSettingsResponse } + * + */ + public EchoAppSettingsResponse createEchoAppSettingsResponse() { + return new EchoAppSettingsResponse(); + } + + /** + * Create an instance of {@link GenerateLoadResponse } + * + */ + public GenerateLoadResponse createGenerateLoadResponse() { + return new GenerateLoadResponse(); + } + + /** + * Create an instance of {@link RunInprocSoaJobResponse } + * + */ + public RunInprocSoaJobResponse createRunInprocSoaJobResponse() { + return new RunInprocSoaJobResponse(); + } + + /** + * Create an instance of {@link EchoResponse } + * + */ + public EchoResponse createEchoResponse() { + return new EchoResponse(); + } + + /** + * Create an instance of {@link EchoClass } + * + */ + public EchoClass createEchoClass() { + return new EchoClass(); + } + + /** + * Create an instance of {@link EchoWithDelay } + * + */ + public EchoWithDelay createEchoWithDelay() { + return new EchoWithDelay(); + } + + /** + * Create an instance of {@link EchoObjectResponse } + * + */ + public EchoObjectResponse createEchoObjectResponse() { + return new EchoObjectResponse(); + } + + /** + * Create an instance of {@link EchoWithParam } + * + */ + public EchoWithParam createEchoWithParam() { + return new EchoWithParam(); + } + + /** + * Create an instance of {@link ConsumeCPU } + * + */ + public ConsumeCPU createConsumeCPU() { + return new ConsumeCPU(); + } + + /** + * Create an instance of {@link GenerateLoadWithInputFile } + * + */ + public GenerateLoadWithInputFile createGenerateLoadWithInputFile() { + return new GenerateLoadWithInputFile(); + } + + /** + * Create an instance of {@link ServiceSideAsyncEchoResponse } + * + */ + public ServiceSideAsyncEchoResponse createServiceSideAsyncEchoResponse() { + return new ServiceSideAsyncEchoResponse(); + } + + /** + * Create an instance of {@link GetCommonDataResponse } + * + */ + public GetCommonDataResponse createGetCommonDataResponse() { + return new GetCommonDataResponse(); + } + + /** + * Create an instance of {@link EchoObject4Response } + * + */ + public EchoObject4Response createEchoObject4Response() { + return new EchoObject4Response(); + } + + /** + * Create an instance of {@link EchoFaultWithName } + * + */ + public EchoFaultWithName createEchoFaultWithName() { + return new EchoFaultWithName(); + } + + /** + * Create an instance of {@link KillResponse } + * + */ + public KillResponse createKillResponse() { + return new KillResponse(); + } + + /** + * Create an instance of {@link GenerateLoadWithResponseDataResponse } + * + */ + public GenerateLoadWithResponseDataResponse createGenerateLoadWithResponseDataResponse() { + return new GenerateLoadWithResponseDataResponse(); + } + + /** + * Create an instance of {@link EchoException } + * + */ + public EchoException createEchoException() { + return new EchoException(); + } + + /** + * Create an instance of {@link ConsumeCPUResponse } + * + */ + public ConsumeCPUResponse createConsumeCPUResponse() { + return new ConsumeCPUResponse(); + } + + /** + * Create an instance of {@link Echo } + * + */ + public Echo createEcho() { + return new Echo(); + } + + /** + * Create an instance of {@link SerializationTest } + * + */ + public SerializationTest createSerializationTest() { + return new SerializationTest(); + } + + /** + * Create an instance of {@link EchoWithDelayResponse } + * + */ + public EchoWithDelayResponse createEchoWithDelayResponse() { + return new EchoWithDelayResponse(); + } + + /** + * Create an instance of {@link Kill } + * + */ + public Kill createKill() { + return new Kill(); + } + + /** + * Create an instance of {@link GenerateLoad } + * + */ + public GenerateLoad createGenerateLoad() { + return new GenerateLoad(); + } + + /** + * Create an instance of {@link EchoDoubleResponse } + * + */ + public EchoDoubleResponse createEchoDoubleResponse() { + return new EchoDoubleResponse(); + } + + /** + * Create an instance of {@link TraceResponse } + * + */ + public TraceResponse createTraceResponse() { + return new TraceResponse(); + } + + /** + * Create an instance of {@link EchoObject2 } + * + */ + public EchoObject2 createEchoObject2() { + return new EchoObject2(); + } + + /** + * Create an instance of {@link EchoObject3 } + * + */ + public EchoObject3 createEchoObject3() { + return new EchoObject3(); + } + + /** + * Create an instance of {@link EchoWithFail } + * + */ + public EchoWithFail createEchoWithFail() { + return new EchoWithFail(); + } + + /** + * Create an instance of {@link EchoClassResponse } + * + */ + public EchoClassResponse createEchoClassResponse() { + return new EchoClassResponse(); + } + + /** + * Create an instance of {@link EchoFaultResponse } + * + */ + public EchoFaultResponse createEchoFaultResponse() { + return new EchoFaultResponse(); + } + + /** + * Create an instance of {@link EchoObject4 } + * + */ + public EchoObject4 createEchoObject4() { + return new EchoObject4(); + } + + /** + * Create an instance of {@link ServiceSideAsyncEcho } + * + */ + public ServiceSideAsyncEcho createServiceSideAsyncEcho() { + return new ServiceSideAsyncEcho(); + } + + /** + * Create an instance of {@link GenerateLoadWithInputFileResponse } + * + */ + public GenerateLoadWithInputFileResponse createGenerateLoadWithInputFileResponse() { + return new GenerateLoadWithInputFileResponse(); + } + + /** + * Create an instance of {@link EchoObject3Response } + * + */ + public EchoObject3Response createEchoObject3Response() { + return new EchoObject3Response(); + } + + /** + * Create an instance of {@link EchoDouble } + * + */ + public EchoDouble createEchoDouble() { + return new EchoDouble(); + } + + /** + * Create an instance of {@link Ping } + * + */ + public Ping createPing() { + return new Ping(); + } + + /** + * Create an instance of {@link PingResponse } + * + */ + public PingResponse createPingResponse() { + return new PingResponse(); + } + + /** + * Create an instance of {@link GetCommonData } + * + */ + public GetCommonData createGetCommonData() { + return new GetCommonData(); + } + + /** + * Create an instance of {@link EchoFault } + * + */ + public EchoFault createEchoFault() { + return new EchoFault(); + } + + /** + * Create an instance of {@link Trace } + * + */ + public Trace createTrace() { + return new Trace(); + } + + /** + * Create an instance of {@link SerializationTestResponse } + * + */ + public SerializationTestResponse createSerializationTestResponse() { + return new SerializationTestResponse(); + } + + /** + * Create an instance of {@link LastTime } + * + */ + public LastTime createLastTime() { + return new LastTime(); + } + + /** + * Create an instance of {@link EchoWithDelayOnSelectedNode } + * + */ + public EchoWithDelayOnSelectedNode createEchoWithDelayOnSelectedNode() { + return new EchoWithDelayOnSelectedNode(); + } + + /** + * Create an instance of {@link EchoStructResponse } + * + */ + public EchoStructResponse createEchoStructResponse() { + return new EchoStructResponse(); + } + + /** + * Create an instance of {@link LastTimeResponse } + * + */ + public LastTimeResponse createLastTimeResponse() { + return new LastTimeResponse(); + } + + /** + * Create an instance of {@link EchoWithOnExitResponse } + * + */ + public EchoWithOnExitResponse createEchoWithOnExitResponse() { + return new EchoWithOnExitResponse(); + } + + /** + * Create an instance of {@link CheckACLOnAzureResponse } + * + */ + public CheckACLOnAzureResponse createCheckACLOnAzureResponse() { + return new CheckACLOnAzureResponse(); + } + + /** + * Create an instance of {@link GenerateLoadWithResponseData } + * + */ + public GenerateLoadWithResponseData createGenerateLoadWithResponseData() { + return new GenerateLoadWithResponseData(); + } + + /** + * Create an instance of {@link EchoWithDelayOnSelectedNodeResponse } + * + */ + public EchoWithDelayOnSelectedNodeResponse createEchoWithDelayOnSelectedNodeResponse() { + return new EchoWithDelayOnSelectedNodeResponse(); + } + + /** + * Create an instance of {@link RunInprocSoaJob } + * + */ + public RunInprocSoaJob createRunInprocSoaJob() { + return new RunInprocSoaJob(); + } + + /** + * Create an instance of {@link CheckACLOnAzure } + * + */ + public CheckACLOnAzure createCheckACLOnAzure() { + return new CheckACLOnAzure(); + } + + /** + * Create an instance of {@link EchoWithOnExit } + * + */ + public EchoWithOnExit createEchoWithOnExit() { + return new EchoWithOnExit(); + } + + /** + * Create an instance of {@link EchoObject2Response } + * + */ + public EchoObject2Response createEchoObject2Response() { + return new EchoObject2Response(); + } + + /** + * Create an instance of {@link EchoWithFailResponse } + * + */ + public EchoWithFailResponse createEchoWithFailResponse() { + return new EchoWithFailResponse(); + } + + /** + * Create an instance of {@link EchoStruct } + * + */ + public EchoStruct createEchoStruct() { + return new EchoStruct(); + } + + /** + * Create an instance of {@link EchoExceptionResponse } + * + */ + public EchoExceptionResponse createEchoExceptionResponse() { + return new EchoExceptionResponse(); + } + + /** + * Create an instance of {@link EchoObject } + * + */ + public EchoObject createEchoObject() { + return new EchoObject(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "selectedNode", scope = EchoWithDelayOnSelectedNode.class) + public JAXBElement createEchoWithDelayOnSelectedNodeSelectedNode(String value) { + return new JAXBElement(_EchoWithDelayOnSelectedNodeSelectedNode_QNAME, String.class, EchoWithDelayOnSelectedNode.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassObj }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoObject2Result", scope = EchoObject2Response.class) + public JAXBElement createEchoObject2ResponseEchoObject2Result(ClassObj value) { + return new JAXBElement(_EchoObject2ResponseEchoObject2Result_QNAME, ClassObj.class, EchoObject2Response.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "GenerateLoadResult", scope = GenerateLoadResponse.class) + public JAXBElement createGenerateLoadResponseGenerateLoadResult(StatisticInfo value) { + return new JAXBElement(_GenerateLoadResponseGenerateLoadResult_QNAME, StatisticInfo.class, GenerateLoadResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "type", scope = EchoObject.class) + public JAXBElement createEchoObjectType(String value) { + return new JAXBElement(_EchoObjectType_QNAME, String.class, EchoObject.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "o", scope = EchoObject.class) + public JAXBElement createEchoObjectO(Object value) { + return new JAXBElement(_EchoObjectO_QNAME, Object.class, EchoObject.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "exceptionName", scope = EchoFaultWithName.class) + public JAXBElement createEchoFaultWithNameExceptionName(String value) { + return new JAXBElement(_EchoFaultWithNameExceptionName_QNAME, String.class, EchoFaultWithName.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoResult", scope = EchoResponse.class) + public JAXBElement createEchoResponseEchoResult(ComputerInfo value) { + return new JAXBElement(_EchoResponseEchoResult_QNAME, ComputerInfo.class, EchoResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "TraceResult", scope = TraceResponse.class) + public JAXBElement createTraceResponseTraceResult(ComputerInfo value) { + return new JAXBElement(_TraceResponseTraceResult_QNAME, ComputerInfo.class, TraceResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "GetCommonDataResult", scope = GetCommonDataResponse.class) + public JAXBElement createGetCommonDataResponseGetCommonDataResult(ComputerInfo value) { + return new JAXBElement(_GetCommonDataResponseGetCommonDataResult_QNAME, ComputerInfo.class, GetCommonDataResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoObjectResult", scope = EchoObjectResponse.class) + public JAXBElement createEchoObjectResponseEchoObjectResult(Object value) { + return new JAXBElement(_EchoObjectResponseEchoObjectResult_QNAME, Object.class, EchoObjectResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassObj }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoObject4Result", scope = EchoObject4Response.class) + public JAXBElement createEchoObject4ResponseEchoObject4Result(ClassObj value) { + return new JAXBElement(_EchoObject4ResponseEchoObject4Result_QNAME, ClassObj.class, EchoObject4Response.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "s", scope = EchoWithParam.class) + public JAXBElement createEchoWithParamS(String value) { + return new JAXBElement(_EchoWithParamS_QNAME, String.class, EchoWithParam.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "GenerateLoadWithInputFileResult", scope = GenerateLoadWithInputFileResponse.class) + public JAXBElement createGenerateLoadWithInputFileResponseGenerateLoadWithInputFileResult(StatisticInfo value) { + return new JAXBElement(_GenerateLoadWithInputFileResponseGenerateLoadWithInputFileResult_QNAME, StatisticInfo.class, GenerateLoadWithInputFileResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoObject3Result", scope = EchoObject3Response.class) + public JAXBElement createEchoObject3ResponseEchoObject3Result(Object value) { + return new JAXBElement(_EchoObject3ResponseEchoObject3Result_QNAME, Object.class, EchoObject3Response.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoWithDelayOnSelectedNodeResult", scope = EchoWithDelayOnSelectedNodeResponse.class) + public JAXBElement createEchoWithDelayOnSelectedNodeResponseEchoWithDelayOnSelectedNodeResult(ComputerInfo value) { + return new JAXBElement(_EchoWithDelayOnSelectedNodeResponseEchoWithDelayOnSelectedNodeResult_QNAME, ComputerInfo.class, EchoWithDelayOnSelectedNodeResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "stream", scope = SerializationTest.class) + public JAXBElement createSerializationTestStream(byte[] value) { + return new JAXBElement(_SerializationTestStream_QNAME, byte[].class, SerializationTest.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "RunInprocSoaJobResult", scope = RunInprocSoaJobResponse.class) + public JAXBElement createRunInprocSoaJobResponseRunInprocSoaJobResult(String value) { + return new JAXBElement(_RunInprocSoaJobResponseRunInprocSoaJobResult_QNAME, String.class, RunInprocSoaJobResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoStructResult", scope = EchoStructResponse.class) + public JAXBElement createEchoStructResponseEchoStructResult(ComputerInfo value) { + return new JAXBElement(_EchoStructResponseEchoStructResult_QNAME, ComputerInfo.class, EchoStructResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassObj }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "obj", scope = EchoObject4 .class) + public JAXBElement createEchoObject4Obj(ClassObj value) { + return new JAXBElement(_EchoObject4Obj_QNAME, ClassObj.class, EchoObject4 .class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "ServiceSideAsyncEchoResult", scope = ServiceSideAsyncEchoResponse.class) + public JAXBElement createServiceSideAsyncEchoResponseServiceSideAsyncEchoResult(ComputerInfo value) { + return new JAXBElement(_ServiceSideAsyncEchoResponseServiceSideAsyncEchoResult_QNAME, ComputerInfo.class, ServiceSideAsyncEchoResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoFaultResult", scope = EchoFaultResponse.class) + public JAXBElement createEchoFaultResponseEchoFaultResult(ComputerInfo value) { + return new JAXBElement(_EchoFaultResponseEchoFaultResult_QNAME, ComputerInfo.class, EchoFaultResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "logPath", scope = EchoWithOnExit.class) + public JAXBElement createEchoWithOnExitLogPath(String value) { + return new JAXBElement(_EchoWithOnExitLogPath_QNAME, String.class, EchoWithOnExit.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "ConsumeCPUResult", scope = ConsumeCPUResponse.class) + public JAXBElement createConsumeCPUResponseConsumeCPUResult(String value) { + return new JAXBElement(_ConsumeCPUResponseConsumeCPUResult_QNAME, String.class, ConsumeCPUResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoWithOnExitResult", scope = EchoWithOnExitResponse.class) + public JAXBElement createEchoWithOnExitResponseEchoWithOnExitResult(ComputerInfo value) { + return new JAXBElement(_EchoWithOnExitResponseEchoWithOnExitResult_QNAME, ComputerInfo.class, EchoWithOnExitResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "CheckACLOnAzureResult", scope = CheckACLOnAzureResponse.class) + public JAXBElement createCheckACLOnAzureResponseCheckACLOnAzureResult(String value) { + return new JAXBElement(_CheckACLOnAzureResponseCheckACLOnAzureResult_QNAME, String.class, CheckACLOnAzureResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "type", scope = EchoObject3 .class) + public JAXBElement createEchoObject3Type(String value) { + return new JAXBElement(_EchoObjectType_QNAME, String.class, EchoObject3 .class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "o", scope = EchoObject3 .class) + public JAXBElement createEchoObject3O(Object value) { + return new JAXBElement(_EchoObjectO_QNAME, Object.class, EchoObject3 .class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoWithDelayResult", scope = EchoWithDelayResponse.class) + public JAXBElement createEchoWithDelayResponseEchoWithDelayResult(ComputerInfo value) { + return new JAXBElement(_EchoWithDelayResponseEchoWithDelayResult_QNAME, ComputerInfo.class, EchoWithDelayResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassFoo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoClassResult", scope = EchoClassResponse.class) + public JAXBElement createEchoClassResponseEchoClassResult(ClassFoo value) { + return new JAXBElement(_EchoClassResponseEchoClassResult_QNAME, ClassFoo.class, EchoClassResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "expectedMd5Hash", scope = GetCommonData.class) + public JAXBElement createGetCommonDataExpectedMd5Hash(String value) { + return new JAXBElement(_GetCommonDataExpectedMd5Hash_QNAME, String.class, GetCommonData.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "dataClientId", scope = GetCommonData.class) + public JAXBElement createGetCommonDataDataClientId(String value) { + return new JAXBElement(_GetCommonDataDataClientId_QNAME, String.class, GetCommonData.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Exception }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "ex", scope = EchoFault.class) + public JAXBElement createEchoFaultEx(Exception value) { + return new JAXBElement(_EchoFaultEx_QNAME, Exception.class, EchoFault.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Exception }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "ex", scope = EchoException.class) + public JAXBElement createEchoExceptionEx(Exception value) { + return new JAXBElement(_EchoFaultEx_QNAME, Exception.class, EchoException.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link StatisticInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "GenerateLoadWithResponseDataResult", scope = GenerateLoadWithResponseDataResponse.class) + public JAXBElement createGenerateLoadWithResponseDataResponseGenerateLoadWithResponseDataResult(StatisticInfo value) { + return new JAXBElement(_GenerateLoadWithResponseDataResponseGenerateLoadWithResponseDataResult_QNAME, StatisticInfo.class, GenerateLoadWithResponseDataResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassObj }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "obj", scope = EchoObject2 .class) + public JAXBElement createEchoObject2Obj(ClassObj value) { + return new JAXBElement(_EchoObject4Obj_QNAME, ClassObj.class, EchoObject2 .class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoAppSettingsResult", scope = EchoAppSettingsResponse.class) + public JAXBElement createEchoAppSettingsResponseEchoAppSettingsResult(ArrayOfKeyValueOfstringstring value) { + return new JAXBElement(_EchoAppSettingsResponseEchoAppSettingsResult_QNAME, ArrayOfKeyValueOfstringstring.class, EchoAppSettingsResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ClassFoo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "cls", scope = EchoClass.class) + public JAXBElement createEchoClassCls(ClassFoo value) { + return new JAXBElement(_EchoClassCls_QNAME, ClassFoo.class, EchoClass.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "common_data_path", scope = GenerateLoadWithInputFile.class) + public JAXBElement createGenerateLoadWithInputFileCommonDataPath(String value) { + return new JAXBElement(_GenerateLoadWithInputFileCommonDataPath_QNAME, String.class, GenerateLoadWithInputFile.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "input_data_path", scope = GenerateLoadWithInputFile.class) + public JAXBElement createGenerateLoadWithInputFileInputDataPath(String value) { + return new JAXBElement(_GenerateLoadWithInputFileInputDataPath_QNAME, String.class, GenerateLoadWithInputFile.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "input_data", scope = GenerateLoadWithResponseData.class) + public JAXBElement createGenerateLoadWithResponseDataInputData(byte[] value) { + return new JAXBElement(_GenerateLoadWithResponseDataInputData_QNAME, byte[].class, GenerateLoadWithResponseData.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoWithFailResult", scope = EchoWithFailResponse.class) + public JAXBElement createEchoWithFailResponseEchoWithFailResult(ComputerInfo value) { + return new JAXBElement(_EchoWithFailResponseEchoWithFailResult_QNAME, ComputerInfo.class, EchoWithFailResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoExceptionResult", scope = EchoExceptionResponse.class) + public JAXBElement createEchoExceptionResponseEchoExceptionResult(ComputerInfo value) { + return new JAXBElement(_EchoExceptionResponseEchoExceptionResult_QNAME, ComputerInfo.class, EchoExceptionResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoWithParamResult", scope = EchoWithParamResponse.class) + public JAXBElement createEchoWithParamResponseEchoWithParamResult(ComputerInfo value) { + return new JAXBElement(_EchoWithParamResponseEchoWithParamResult_QNAME, ComputerInfo.class, EchoWithParamResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoFaultWithNameResult", scope = EchoFaultWithNameResponse.class) + public JAXBElement createEchoFaultWithNameResponseEchoFaultWithNameResult(ComputerInfo value) { + return new JAXBElement(_EchoFaultWithNameResponseEchoFaultWithNameResult_QNAME, ComputerInfo.class, EchoFaultWithNameResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "common_data_path", scope = GenerateLoad.class) + public JAXBElement createGenerateLoadCommonDataPath(String value) { + return new JAXBElement(_GenerateLoadWithInputFileCommonDataPath_QNAME, String.class, GenerateLoad.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "input_data", scope = GenerateLoad.class) + public JAXBElement createGenerateLoadInputData(byte[] value) { + return new JAXBElement(_GenerateLoadWithResponseDataInputData_QNAME, byte[].class, GenerateLoad.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "traceMsgs", scope = Trace.class) + public JAXBElement createTraceTraceMsgs(ArrayOfstring value) { + return new JAXBElement(_TraceTraceMsgs_QNAME, ArrayOfstring.class, Trace.class, value); + } + +} diff --git a/test/TestService/org/tempuri/Pi.java b/test/TestService/org/tempuri/Pi.java new file mode 100644 index 0000000..78b0bba --- /dev/null +++ b/test/TestService/org/tempuri/Pi.java @@ -0,0 +1,256 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility class for EchoSvc +// +// Jiabin Hu +//----------------------------------------------------------------------- + +package org.tempuri; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +public class Pi +{ + public static int mul_mod(int a, int b, int m) + { + return (int)(((long) a * (long) b) % m); + } + + /* return the inverse of x mod y */ + private static int inv_mod(int x, int y) + { + int q, u, v, a, c, t; + + u = x; + v = y; + c = 1; + a = 0; + + do + { + q = v / u; + + t = c; + c = a - q * c; + a = t; + + t = u; + u = v - q * u; + v = t; + } while (u != 0); + + a = a % y; + + if (a < 0) + { + a = y + a; + } + + return a; + } + + /* return (a^b) mod m */ + private static int pow_mod(int a, int b, int m) + { + int r, aa; + + r = 1; + aa = a; + + while (true) + { + if ((b & 1) != 0) + { + r = mul_mod(r, aa, m); + } + + b = b >> 1; + + if (b == 0) + { + break; + } + + aa = mul_mod(aa, aa, m); + } + + return r; + } + + /* return true if n is prime */ + private static boolean is_prime(int n) + { + + if (n < 2) // negative numbers, 0, and 1 are not prime + { + return false; + } + + if (n == 2) // 2 is prime + { + return true; + } + + if ((n % 2) == 0) + { + return false; + } + + int r = (int)Math.sqrt(n); + + for (int i = 3; i <= r; i += 2) + { + if ((n % i) == 0) + { + return false; + } + } + + return true; + } + + /* return the prime number immediatly after n */ + private static int next_prime(int n) + { + do + { + n++; + } while (!is_prime(n)); + + return n; + } + + private static int calculatePiDigits(int n) + { + int av, vmax, num, den, s, t; + + int N = (int)((n + 20) * Math.log(10) / Math.log(2)); + + double sum = 0; + + for (int a = 3; a <= (2 * N); a = next_prime(a)) + { + vmax = (int)(Math.log(2 * N) / Math.log(a)); + + av = 1; + + for (int i = 0; i < vmax; i++) + { + av = av * a; + } + + s = 0; + num = 1; + den = 1; + int v = 0; + int kq = 1; + int kq2 = 1; + + for (int k = 1; k <= N; k++) + { + + t = k; + + if (kq >= a) + { + do + { + t = t / a; + v--; + } while ((t % a) == 0); + + kq = 0; + } + kq++; + num = mul_mod(num, t, av); + + t = 2 * k - 1; + + if (kq2 >= a) + { + if (kq2 == a) + { + do + { + t = t / a; + v++; + } while ((t % a) == 0); + } + kq2 -= a; + } + den = mul_mod(den, t, av); + kq2 += 2; + + if (v > 0) + { + t = inv_mod(den, av); + t = mul_mod(t, num, av); + t = mul_mod(t, k, av); + + for (int i = v; i < vmax; i++) + { + t = mul_mod(t, a, av); + } + + s += t; + + if (s >= av) + { + s -= av; + } + } + + } + + t = pow_mod(10, n - 1, av); + s = mul_mod(s, t, av); + sum = (sum + (double)s / (double)av) % 1.0; + } + + return (int)(sum * 1e9); + } + + public static String calculatePi(int digits) + { + String result = ""; + + if (digits > 0) + { + for (int i = 0; i < digits; i += 9) + { + result += String.valueOf(calculatePiDigits(i + 1)); + } + } + + return result; + } + + public int echo() + { + return 1; + } + + public static String calculatePi(long timeInMs) + { + String result = ""; + + GregorianCalendar end = new GregorianCalendar(); + end.add(GregorianCalendar.MILLISECOND, (int) timeInMs); + for (int i = 0; end.after(new GregorianCalendar()); i += 9) // step as 9 + { + result += String.valueOf(calculatePiDigits(i + 1)); + } + + return result; + } + + public static int Echo() + { + return 1; + } +} diff --git a/test/TestService/org/tempuri/Ping.java b/test/TestService/org/tempuri/Ping.java new file mode 100644 index 0000000..154c26f --- /dev/null +++ b/test/TestService/org/tempuri/Ping.java @@ -0,0 +1,34 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "Ping") +public class Ping { + + +} diff --git a/test/TestService/org/tempuri/PingResponse.java b/test/TestService/org/tempuri/PingResponse.java new file mode 100644 index 0000000..d42d30d --- /dev/null +++ b/test/TestService/org/tempuri/PingResponse.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="PingResult" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "pingResult" +}) +@XmlRootElement(name = "PingResponse") +public class PingResponse { + + @XmlElement(name = "PingResult", namespace = "http://tempuri.org/") + protected Boolean pingResult; + + /** + * Gets the value of the pingResult property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isPingResult() { + return pingResult; + } + + /** + * Sets the value of the pingResult property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setPingResult(Boolean value) { + this.pingResult = value; + } + +} diff --git a/test/TestService/org/tempuri/RunInprocSoaJob.java b/test/TestService/org/tempuri/RunInprocSoaJob.java new file mode 100644 index 0000000..49dc4bb --- /dev/null +++ b/test/TestService/org/tempuri/RunInprocSoaJob.java @@ -0,0 +1,34 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "RunInprocSoaJob") +public class RunInprocSoaJob { + + +} diff --git a/test/TestService/org/tempuri/RunInprocSoaJobResponse.java b/test/TestService/org/tempuri/RunInprocSoaJobResponse.java new file mode 100644 index 0000000..0d2ee17 --- /dev/null +++ b/test/TestService/org/tempuri/RunInprocSoaJobResponse.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="RunInprocSoaJobResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "runInprocSoaJobResult" +}) +@XmlRootElement(name = "RunInprocSoaJobResponse") +public class RunInprocSoaJobResponse { + + @XmlElementRef(name = "RunInprocSoaJobResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement runInprocSoaJobResult; + + /** + * Gets the value of the runInprocSoaJobResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getRunInprocSoaJobResult() { + return runInprocSoaJobResult; + } + + /** + * Sets the value of the runInprocSoaJobResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setRunInprocSoaJobResult(JAXBElement value) { + this.runInprocSoaJobResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/SerializationTest.java b/test/TestService/org/tempuri/SerializationTest.java new file mode 100644 index 0000000..396734b --- /dev/null +++ b/test/TestService/org/tempuri/SerializationTest.java @@ -0,0 +1,65 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="stream" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stream" +}) +@XmlRootElement(name = "SerializationTest") +public class SerializationTest { + + @XmlElementRef(name = "stream", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement stream; + + /** + * Gets the value of the stream property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getStream() { + return stream; + } + + /** + * Sets the value of the stream property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setStream(JAXBElement value) { + this.stream = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/SerializationTestResponse.java b/test/TestService/org/tempuri/SerializationTestResponse.java new file mode 100644 index 0000000..b0963c1 --- /dev/null +++ b/test/TestService/org/tempuri/SerializationTestResponse.java @@ -0,0 +1,64 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="SerializationTestResult" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serializationTestResult" +}) +@XmlRootElement(name = "SerializationTestResponse") +public class SerializationTestResponse { + + @XmlElement(name = "SerializationTestResult") + protected Boolean serializationTestResult; + + /** + * Gets the value of the serializationTestResult property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSerializationTestResult() { + return serializationTestResult; + } + + /** + * Sets the value of the serializationTestResult property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setSerializationTestResult(Boolean value) { + this.serializationTestResult = value; + } + +} diff --git a/test/TestService/org/tempuri/ServiceSideAsyncEcho.java b/test/TestService/org/tempuri/ServiceSideAsyncEcho.java new file mode 100644 index 0000000..8bf3892 --- /dev/null +++ b/test/TestService/org/tempuri/ServiceSideAsyncEcho.java @@ -0,0 +1,62 @@ + +package org.tempuri; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID" +}) +@XmlRootElement(name = "ServiceSideAsyncEcho") +public class ServiceSideAsyncEcho { + + protected Integer refID; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + +} diff --git a/test/TestService/org/tempuri/ServiceSideAsyncEchoResponse.java b/test/TestService/org/tempuri/ServiceSideAsyncEchoResponse.java new file mode 100644 index 0000000..3a1878e --- /dev/null +++ b/test/TestService/org/tempuri/ServiceSideAsyncEchoResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ServiceSideAsyncEchoResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceSideAsyncEchoResult" +}) +@XmlRootElement(name = "ServiceSideAsyncEchoResponse") +public class ServiceSideAsyncEchoResponse { + + @XmlElementRef(name = "ServiceSideAsyncEchoResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement serviceSideAsyncEchoResult; + + /** + * Gets the value of the serviceSideAsyncEchoResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getServiceSideAsyncEchoResult() { + return serviceSideAsyncEchoResult; + } + + /** + * Sets the value of the serviceSideAsyncEchoResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setServiceSideAsyncEchoResult(JAXBElement value) { + this.serviceSideAsyncEchoResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/Trace.java b/test/TestService/org/tempuri/Trace.java new file mode 100644 index 0000000..a29c73f --- /dev/null +++ b/test/TestService/org/tempuri/Trace.java @@ -0,0 +1,179 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.Duration; +import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="refID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="traceMsgs" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring" minOccurs="0"/>
+ *         <element name="sleepBeforeTrace" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="sleepAfterTrace" type="{http://schemas.microsoft.com/2003/10/Serialization/}duration" minOccurs="0"/>
+ *         <element name="testActionId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "refID", + "traceMsgs", + "sleepBeforeTrace", + "sleepAfterTrace", + "testActionId" +}) +@XmlRootElement(name = "Trace") +public class Trace { + @XmlElement(name = "refID", namespace = "http://tempuri.org/") + protected Integer refID; + @XmlElementRef(name = "traceMsgs", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement traceMsgs; + @XmlElement(name = "sleepBeforeTrace", namespace = "http://tempuri.org/") + protected Duration sleepBeforeTrace; + @XmlElement(name = "sleepAfterTrace", namespace = "http://tempuri.org/") + protected Duration sleepAfterTrace; + @XmlElement(name = "testActionId", namespace = "http://tempuri.org/") + protected Integer testActionId; + + /** + * Gets the value of the refID property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRefID() { + return refID; + } + + /** + * Sets the value of the refID property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRefID(Integer value) { + this.refID = value; + } + + /** + * Gets the value of the traceMsgs property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public JAXBElement getTraceMsgs() { + return traceMsgs; + } + + /** + * Sets the value of the traceMsgs property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >} + * + */ + public void setTraceMsgs(JAXBElement value) { + this.traceMsgs = ((JAXBElement ) value); + } + + /** + * Gets the value of the sleepBeforeTrace property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getSleepBeforeTrace() { + return sleepBeforeTrace; + } + + /** + * Sets the value of the sleepBeforeTrace property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setSleepBeforeTrace(Duration value) { + this.sleepBeforeTrace = value; + } + + /** + * Gets the value of the sleepAfterTrace property. + * + * @return + * possible object is + * {@link Duration } + * + */ + public Duration getSleepAfterTrace() { + return sleepAfterTrace; + } + + /** + * Sets the value of the sleepAfterTrace property. + * + * @param value + * allowed object is + * {@link Duration } + * + */ + public void setSleepAfterTrace(Duration value) { + this.sleepAfterTrace = value; + } + + /** + * Gets the value of the testActionId property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getTestActionId() { + return testActionId; + } + + /** + * Sets the value of the testActionId property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setTestActionId(Integer value) { + this.testActionId = value; + } + +} diff --git a/test/TestService/org/tempuri/TraceResponse.java b/test/TestService/org/tempuri/TraceResponse.java new file mode 100644 index 0000000..9e26ef1 --- /dev/null +++ b/test/TestService/org/tempuri/TraceResponse.java @@ -0,0 +1,66 @@ + +package org.tempuri; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.datacontract.schemas._2004._07.services.ComputerInfo; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="TraceResult" type="{http://schemas.datacontract.org/2004/07/services}ComputerInfo" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "traceResult" +}) +@XmlRootElement(name = "TraceResponse") +public class TraceResponse { + + @XmlElementRef(name = "TraceResult", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement traceResult; + + /** + * Gets the value of the traceResult property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public JAXBElement getTraceResult() { + return traceResult; + } + + /** + * Sets the value of the traceResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link ComputerInfo }{@code >} + * + */ + public void setTraceResult(JAXBElement value) { + this.traceResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/TracingTestActionId.java b/test/TestService/org/tempuri/TracingTestActionId.java new file mode 100644 index 0000000..d55c3d9 --- /dev/null +++ b/test/TestService/org/tempuri/TracingTestActionId.java @@ -0,0 +1,45 @@ +package org.tempuri; + +public enum TracingTestActionId { + Default, + TraceWithDelay, + TraceLargeAmount, + TraceBigSize, + TraceFaultException, + TraceProcessExit, + TraceRequestProcessing, + NoUserTrace, + BrokerNodeOffline, + TestTraceResponseTwice, + RetryOperationError; + + public static TracingTestActionId fromInteger(int value) + { + switch(value) + { + case 0: + return Default; + case 1: + return TraceWithDelay; + case 2: + return TraceLargeAmount; + case 3: + return TraceBigSize; + case 4: + return TraceFaultException; + case 5: + return TraceProcessExit; + case 6: + return TraceRequestProcessing; + case 7: + return NoUserTrace; + case 8: + return BrokerNodeOffline; + case 9: + return TestTraceResponseTwice; + case 10: + return RetryOperationError; + } + return null; + } +} \ No newline at end of file diff --git a/test/TestService/org/tempuri/TracingType.java b/test/TestService/org/tempuri/TracingType.java new file mode 100644 index 0000000..9ec8641 --- /dev/null +++ b/test/TestService/org/tempuri/TracingType.java @@ -0,0 +1,22 @@ +package org.tempuri; + +public enum TracingType { + TraceEvent, + TraceInformation, + TraceData, + TraceTransfer; + + public static TracingType fromInteger(int value) { + switch(value) { + case 0: + return TraceEvent; + case 1: + return TraceInformation; + case 2: + return TraceData; + case 3: + return TraceTransfer; + } + return null; + } +} \ No newline at end of file diff --git a/test/TestService/org/tempuri/Utility.java b/test/TestService/org/tempuri/Utility.java new file mode 100644 index 0000000..40bb2af --- /dev/null +++ b/test/TestService/org/tempuri/Utility.java @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Utility class for EchoSvc +// +// Jiabin Hu +//----------------------------------------------------------------------- + +package org.tempuri; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Date; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; + +import com.microsoft.hpc.session.RetryOperationError; + +class Utility { + public static boolean isNullOrEmpty(String str) { + return str == null || str.isEmpty(); + } + + public static String getCurrentTime() { + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + return sdf.format(cal.getTime()); + } + + public static ITestServiceEchoRetryOperationErrorFaultFaultMessage BuildRetryOperationError(String reason) + { + com.microsoft.hpc.aitestsvclib.session.ObjectFactory fact = + new com.microsoft.hpc.aitestsvclib.session.ObjectFactory(); + RetryOperationError err = new RetryOperationError(); + err.setReason(fact.createRetryOperationErrorReason(reason)); + ITestServiceEchoRetryOperationErrorFaultFaultMessage msg + = new ITestServiceEchoRetryOperationErrorFaultFaultMessage("", err); + return msg; + } + + public static ITestServiceEchoRetryOperationErrorFaultFaultMessage BuildRetryOperationError(String reason, String message) + { + com.microsoft.hpc.aitestsvclib.session.ObjectFactory fact = + new com.microsoft.hpc.aitestsvclib.session.ObjectFactory(); + RetryOperationError err = new RetryOperationError(); + err.setReason(fact.createRetryOperationErrorReason(reason)); + ITestServiceEchoRetryOperationErrorFaultFaultMessage msg + = new ITestServiceEchoRetryOperationErrorFaultFaultMessage( + message, err); + return msg; + } + + public static XMLGregorianCalendar getXMLCurrentTime() throws DatatypeConfigurationException + { + GregorianCalendar gcal = new GregorianCalendar(); + XMLGregorianCalendar xcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); + return xcal; + } + + public static XMLGregorianCalendar convertXMLGregorianCalendar(Date date) throws DatatypeConfigurationException + { + GregorianCalendar c = new GregorianCalendar(); + c.setTime(date); + XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + return cal; + } + + public static void sleep(long duration) + { + try { + Thread.sleep(duration); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/test/TestService/org/tempuri/package-info.java b/test/TestService/org/tempuri/package-info.java new file mode 100644 index 0000000..7b7388f --- /dev/null +++ b/test/TestService/org/tempuri/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://tempuri.org/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.tempuri; diff --git a/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd b/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd new file mode 100644 index 0000000..0f6f60b --- /dev/null +++ b/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd @@ -0,0 +1,27 @@ + + + + + + true + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/schemas.microsoft.com.2003.10.Serialization.xsd b/test/TestService/schemas.microsoft.com.2003.10.Serialization.xsd new file mode 100644 index 0000000..b4d5ff0 --- /dev/null +++ b/test/TestService/schemas.microsoft.com.2003.10.Serialization.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/services.xsd b/test/TestService/services.xsd new file mode 100644 index 0000000..d6166a9 --- /dev/null +++ b/test/TestService/services.xsd @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 256 + + + + + + + 16 + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/tempuri.org.wsdl b/test/TestService/tempuri.org.wsdl new file mode 100644 index 0000000..7e6e8ca --- /dev/null +++ b/test/TestService/tempuri.org.wsdl @@ -0,0 +1,714 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestService/tempuri.org.xsd b/test/TestService/tempuri.org.xsd new file mode 100644 index 0000000..a520b69 --- /dev/null +++ b/test/TestService/tempuri.org.xsd @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/AITestLib.Helper.xsd b/test/TestServiceClient/AITestLib.Helper.xsd new file mode 100644 index 0000000..a285fe4 --- /dev/null +++ b/test/TestServiceClient/AITestLib.Helper.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/System.xsd b/test/TestServiceClient/System.xsd new file mode 100644 index 0000000..0f80570 --- /dev/null +++ b/test/TestServiceClient/System.xsd @@ -0,0 +1,1085 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + 8 + + + + + + + 9 + + + + + + + 12 + + + + + + + 13 + + + + + + + 19 + + + + + + + 27 + + + + + + + 32 + + + + + + + 33 + + + + + + + 34 + + + + + + + 35 + + + + + + + 36 + + + + + + + 37 + + + + + + + 38 + + + + + + + 39 + + + + + + + 40 + + + + + + + 41 + + + + + + + 42 + + + + + + + 43 + + + + + + + 44 + + + + + + + 45 + + + + + + + 46 + + + + + + + 47 + + + + + + + 48 + + + + + + + 49 + + + + + + + 50 + + + + + + + 51 + + + + + + + 52 + + + + + + + 53 + + + + + + + 54 + + + + + + + 55 + + + + + + + 56 + + + + + + + 57 + + + + + + + 65 + + + + + + + 66 + + + + + + + 67 + + + + + + + 68 + + + + + + + 69 + + + + + + + 70 + + + + + + + 71 + + + + + + + 72 + + + + + + + 73 + + + + + + + 74 + + + + + + + 75 + + + + + + + 76 + + + + + + + 77 + + + + + + + 78 + + + + + + + 79 + + + + + + + 80 + + + + + + + 81 + + + + + + + 82 + + + + + + + 83 + + + + + + + 84 + + + + + + + 85 + + + + + + + 86 + + + + + + + 87 + + + + + + + 88 + + + + + + + 89 + + + + + + + 90 + + + + + + + 91 + + + + + + + 92 + + + + + + + 93 + + + + + + + 95 + + + + + + + 96 + + + + + + + 97 + + + + + + + 98 + + + + + + + 99 + + + + + + + 100 + + + + + + + 101 + + + + + + + 102 + + + + + + + 103 + + + + + + + 104 + + + + + + + 105 + + + + + + + 106 + + + + + + + 107 + + + + + + + 108 + + + + + + + 109 + + + + + + + 110 + + + + + + + 111 + + + + + + + 112 + + + + + + + 113 + + + + + + + 114 + + + + + + + 115 + + + + + + + 116 + + + + + + + 117 + + + + + + + 118 + + + + + + + 119 + + + + + + + 120 + + + + + + + 121 + + + + + + + 122 + + + + + + + 123 + + + + + + + 124 + + + + + + + 125 + + + + + + + 126 + + + + + + + 127 + + + + + + + 128 + + + + + + + 129 + + + + + + + 130 + + + + + + + 131 + + + + + + + 132 + + + + + + + 133 + + + + + + + 134 + + + + + + + 135 + + + + + + + 166 + + + + + + + 167 + + + + + + + 168 + + + + + + + 169 + + + + + + + 170 + + + + + + + 171 + + + + + + + 172 + + + + + + + 173 + + + + + + + 174 + + + + + + + 175 + + + + + + + 176 + + + + + + + 177 + + + + + + + 178 + + + + + + + 179 + + + + + + + 180 + + + + + + + 181 + + + + + + + 182 + + + + + + + 183 + + + + + + + 186 + + + + + + + 187 + + + + + + + 188 + + + + + + + 189 + + + + + + + 190 + + + + + + + 191 + + + + + + + 192 + + + + + + + 219 + + + + + + + 220 + + + + + + + 221 + + + + + + + 222 + + + + + + + 223 + + + + + + + 226 + + + + + + + 229 + + + + + + + 231 + + + + + + + 246 + + + + + + + 247 + + + + + + + 248 + + + + + + + 249 + + + + + + + 250 + + + + + + + 251 + + + + + + + 252 + + + + + + + 253 + + + + + + + 254 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/hpc.microsoft.com.session.xsd b/test/TestServiceClient/hpc.microsoft.com.session.xsd new file mode 100644 index 0000000..8ec251a --- /dev/null +++ b/test/TestServiceClient/hpc.microsoft.com.session.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/makejar.cmd b/test/TestServiceClient/makejar.cmd new file mode 100644 index 0000000..4c28de1 --- /dev/null +++ b/test/TestServiceClient/makejar.cmd @@ -0,0 +1,18 @@ +@echo off +setlocal + +set JAVA_HOME=%ProgramFiles%\Java\jdk1.6.0_23 +set JAVAC="%JAVA_HOME%\bin\javac.exe" +set JAR="%JAVA_HOME%\bin\jar.exe" +set CXF_HOME=c:\java\apache-cxf-2.4.0 +set CLASSPATH=.;..\Microsoft-HpcSession-3.0.jar;%CXF_HOME%\lib\cxf-manifest.jar + +call %CXF_HOME%\bin\wsdl2java tempuri.org.wsdl + +dir src.list > nul 2>&1 && del src.list +FOR /F %%i IN ('dir /b/s *.java') DO echo %%i >> src.list +%javac% -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" @src.list + + +%jar% cf JavaTestServiceClient.jar org *.wsdl *.xsd + diff --git a/test/TestServiceClient/makejar.sh b/test/TestServiceClient/makejar.sh new file mode 100644 index 0000000..5415b5e --- /dev/null +++ b/test/TestServiceClient/makejar.sh @@ -0,0 +1,16 @@ +#!bin/sh +export CXF_HOME=/usr/java/apache-cxf-2.4.0 +export JAVA_HOME=/usr/java/jdk1.6.0_23 +export CLASSPATH=.:Microsoft-HpcSession-3.0.jar:$CXF_HOME/lib/cxf-manifest.jar + +$CXF_HOME/bin/wsdl2java tempuri.org.wsdl + +echo Compiling +find . -name *.java -print | xargs $JAVA_HOME/bin/javac -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" + +echo Packing + +$JAVA_HOME/bin/jar cf JavaTestServiceClient.jar org *.wsdl *.xsd + +echo Done + diff --git a/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd b/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd new file mode 100644 index 0000000..2b13a22 --- /dev/null +++ b/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd @@ -0,0 +1,21 @@ + + + + + + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd b/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd new file mode 100644 index 0000000..b4d5ff0 --- /dev/null +++ b/test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/services.xsd b/test/TestServiceClient/services.xsd new file mode 100644 index 0000000..9d6ec18 --- /dev/null +++ b/test/TestServiceClient/services.xsd @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 256 + + + + + + + 16 + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestServiceClient/tempuri.org.wsdl b/test/TestServiceClient/tempuri.org.wsdl new file mode 100644 index 0000000..097fd64 --- /dev/null +++ b/test/TestServiceClient/tempuri.org.wsdl @@ -0,0 +1,681 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestServiceClient/tempuri.org.xsd b/test/TestServiceClient/tempuri.org.xsd new file mode 100644 index 0000000..ce2a636 --- /dev/null +++ b/test/TestServiceClient/tempuri.org.xsd @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/GetCert.java b/tools/GetCert.java new file mode 100644 index 0000000..8d8c600 --- /dev/null +++ b/tools/GetCert.java @@ -0,0 +1,168 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Get the SSL certificates from the server and store them in local keystore +// +//------------------------------------------------------------------------------ +/* +JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER + +Copyright (c) Microsoft Corporation. All rights reserved. + +This license governs use of the accompanying software. If you use the +software, you accept this license. If you do not accept the license, do not +use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. +A "contribution. is the original software, or any additions or changes to +the software. +A "contributor. is any person that distributes its contribution under this +license. +"Licensed patents. are a contributor.s patent claims that read directly on +its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the +license conditions and limitations in section 3, each contributor grants you +a non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute +its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose +of its contribution in the software or derivative works of the contribution +in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that +you claim are infringed by the software, your patent license from such +contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in +the software. +(D) If you distribute any portion of the software in source code form, +you may do so only under this license by including a complete copy of this +license with your distribution. If you distribute any portion of the software +in compiled or object code form, you may only do so under a license that +complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may +have additional consumer rights under your local laws which this license +cannot change. To the extent permitted under your local laws, the contributors +exclude the implied warranties of merchantability, fitness for a particular +purpose and non-infringement. +(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend +only to the software or derivative works that you create that operate with +Windows HPC Server. +*/ + +import java.io.*; +import java.security.*; +import java.security.cert.*; +import java.security.cert.Certificate; +import javax.net.ssl.*; +import static java.lang.System.out; + +public class GetCert { + + public static void printCert(Certificate cert) + { + out.println("Certificate:"+cert.toString()); + if (cert instanceof X509Certificate) { + X509Certificate certX509=(X509Certificate)cert; + out.println("Version:"+certX509.getVersion()); + out.println("Serial:"+certX509.getSerialNumber()); + out.println("Issuer:"+certX509.getIssuerDN()); + out.println("ValidBy:"+certX509.getNotBefore()); + out.println("SigAlg:"+certX509.getSigAlgName()); + } + return; + } + + public static void main(String[] args) + throws Exception { + String hostname; + int portnumber = 443; + char[] password; + if (args.length==0 || args.length>2 ) + { + out.println("Usage: java GetCert [password]"); + return; + } + hostname = args[0]; + String pass = (args.length == 1) ? "changeit" : args[1]; + password = pass.toCharArray(); + + SSLContext context = SSLContext.getInstance("TLS"); + TrustManager tm =new X509TrustManager (){ + public void checkClientTrusted(X509Certificate[] chain, + String authType) throws CertificateException { + return; + } + public void checkServerTrusted(X509Certificate[] chain, + String authType) throws CertificateException { + return; + } + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + context.init(null, new TrustManager[] {tm}, null); + SSLSocketFactory factory = context.getSocketFactory(); + SSLSocket socket = (SSLSocket)factory.createSocket(hostname, portnumber); + socket.setSoTimeout(15000); + Certificate[] serverCerts=null; + try { + socket.startHandshake(); + serverCerts = socket.getSession().getPeerCertificates(); + socket.close(); + out.println("Server certificates successfully retrieved."); + } catch (SSLException e) { + out.println("Obtain server certificates failed."); + e.printStackTrace(); + return; + } + + out.println("Open keystore to check and install the certs..."); + + File file = new File("cacerts_new"); + if (file.isFile() == false) { + File dir = new File(System.getProperty("java.home") + File.separatorChar + "lib" + File.separatorChar + "security"); + file = new File(dir, "cacerts"); + } + InputStream in = new FileInputStream(file); + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + ks.load(in, password); + in.close(); + + for (int k = 0; k < serverCerts.length; k++) { + Certificate cert = serverCerts[k]; + System.out.print("-----BEGIN CERTIFICATE-----\n"); + printCert(cert); + System.out.print("\n-----END CERTIFICATE-----\n"); + + if (ks.getCertificateAlias(cert)==null) { + String alias = hostname + "-" + (k + 1); + ks.setCertificateEntry(alias, cert); + out.println("Added the certificate with alias: "+alias); + } else { + out.println("This certificate is already in store."); + } + } + + OutputStream out = new FileOutputStream("cacerts_new"); + ks.store(out, password); + out.close(); + + return; + + } + +} diff --git a/tools/createcert.cmd b/tools/createcert.cmd index 9c90362..3f58aeb 100644 --- a/tools/createcert.cmd +++ b/tools/createcert.cmd @@ -1,8 +1,8 @@ -@REM To create a self-signed certificate. -@REM 1) Run this script on the computer where you want to create cert. -@REM 2) Make sure you have makecert.exe (part of windows SDK). -@REM 3) Edit the certificate begin and expiration dates if necessary. - - -makecert.exe -r -pe -n "CN=%COMPUTERNAME%" -b 09/01/2017 -e 09/01/2011 -eku 1.3.6.1.5.5.7.3.1 -ss my -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -sr LocalMachine - +@REM To create a self-signed certificate. +@REM 1) Run this script on the computer where you want to create cert. +@REM 2) Make sure you have makecert.exe (part of windows SDK). +@REM 3) Edit the certificate begin and expiration dates if necessary. + + +makecert.exe -r -pe -n "CN=%COMPUTERNAME%" -b 09/01/2011 -e 09/01/2017 -eku 1.3.6.1.5.5.7.3.1 -ss my -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -sr LocalMachine +