From 6a9cc1d41b53bcd28073d52419f0a044bc36c99a Mon Sep 17 00:00:00 2001 From: Microsoft HPC Date: Wed, 28 Dec 2011 17:56:36 +0800 Subject: [PATCH 01/23] Add test cases. --- sample/helloworld/RunTest.sh | 12 +- .../BrokerInitializationResult.java | 28 + .../hpc/brokerlauncher/ObjectFactory.java | 11 + .../hpc/sessionlauncher/ObjectFactory.java | 21 + .../hpc/sessionlauncher/SessionInfo.java | 56 + src/hpc.microsoft.com.brokercontroller.wsdl | 173 ++ src/hpc.microsoft.com.brokercontroller.xsd | 109 + src/hpc.microsoft.com.dataservice.wsdl | 119 + src/hpc.microsoft.com.dataservice.xsd | 66 + src/makejar.cmd | 24 +- src/makejar.sh | 6 +- src/manifestclient | 2 +- src/manifesthost | 2 +- src/manifesthost_linux | 2 +- test/README | 84 + test/TestCase/TestData.xml | 55 + test/TestCase/buildtests.cmd | 13 + test/TestCase/buildtests.sh | 10 + test/TestCase/fullpass/Full.java | 35 + test/TestCase/functiontest/BVT.java | 1442 ++++++++++ .../functiontest/BrokerClientTest.java | 2440 +++++++++++++++++ .../functiontest/BrokerResponseTest.java | 182 ++ .../functiontest/CommonDataBytes.java | 26 + .../functiontest/CommonDataHelper.java | 277 ++ .../functiontest/CommonDataTestActionId.java | 35 + .../functiontest/CommonDataTestDurable.java | 295 ++ .../CommonDataTestInteractive.java | 295 ++ test/TestCase/functiontest/Config.java | 100 + .../functiontest/DataClientHelper.java | 97 + .../TestCase/functiontest/DataClientTest.java | 1381 ++++++++++ .../functiontest/DurableSessionTest.java | 1284 +++++++++ .../functiontest/GenericServiceTest.java | 230 ++ test/TestCase/functiontest/Logger.java | 233 ++ .../functiontest/SessionAttachInfoTest.java | 172 ++ .../functiontest/SessionBaseTest.java | 452 +++ test/TestCase/functiontest/SessionPool.java | 593 ++++ .../functiontest/SessionStartInfoTest.java | 502 ++++ test/TestCase/functiontest/SessionTest.java | 497 ++++ test/TestCase/functiontest/Util.java | 81 + test/TestCase/runtests_BVT.cmd | 10 + test/TestCase/runtests_BVT.sh | 5 + test/TestCase/runtests_Full.cmd | 10 + test/TestCase/runtests_Full.sh | 5 + test/TestData.xml | 55 + test/TestService/AITestLib.Helper.xsd | 10 + test/TestService/JavaTestService.config | 175 ++ test/TestService/System.xsd | 1085 ++++++++ .../session/AuthenticationFailure.java | 63 + .../aitestsvclib/session/ObjectFactory.java | 91 + .../session/RetryOperationError.java | 117 + .../aitestsvclib/session/package-info.java | 2 + .../_10/serialization/ObjectFactory.java | 249 ++ .../arrays/ArrayOfKeyValueOfstringstring.java | 163 ++ .../serialization/arrays/ObjectFactory.java | 61 + .../serialization/arrays/package-info.java | 2 + .../TestService/hpc.microsoft.com.session.xsd | 17 + test/TestService/makejar.cmd | 20 + test/TestService/makejar.sh | 14 + .../_2004/_07/aitestlib/CommonDataError.java | 92 + .../_2004/_07/aitestlib/ObjectFactory.java | 63 + .../_2004/_07/aitestlib/package-info.java | 2 + .../schemas/_2004/_07/services/ClassFoo.java | 144 + .../schemas/_2004/_07/services/ClassObj.java | 95 + .../schemas/_2004/_07/services/ClassStr.java | 65 + .../_2004/_07/services/ComputerInfo.java | 354 +++ .../_2004/_07/services/ComputerInfoSub.java | 148 + .../_2004/_07/services/ObjectFactory.java | 301 ++ .../_2004/_07/services/StatisticInfo.java | 180 ++ .../schemas/_2004/_07/services/Sub.java | 148 + .../schemas/_2004/_07/services/TestEnum.java | 57 + .../_2004/_07/services/TestStruct.java | 232 ++ .../_2004/_07/services/package-info.java | 2 + .../_2004/_07/system/ArgumentException.java | 36 + .../_07/system/ArgumentNullException.java | 32 + .../_2004/_07/system/ArithmeticException.java | 36 + .../schemas/_2004/_07/system/ConsoleKey.java | 451 +++ .../_2004/_07/system/ConsoleKeyInfo.java | 119 + .../_07/system/DivideByZeroException.java | 32 + .../schemas/_2004/_07/system/Exception.java | 103 + .../_2004/_07/system/ObjectFactory.java | 200 ++ .../_07/system/OutOfMemoryException.java | 32 + .../_2004/_07/system/SystemException.java | 38 + .../_2004/_07/system/package-info.java | 2 + .../TestService/org/tempuri/AITestSvcLib.java | 99 + test/TestService/org/tempuri/ConsumeCPU.java | 65 + .../org/tempuri/ConsumeCPUResponse.java | 65 + test/TestService/org/tempuri/Echo.java | 64 + .../org/tempuri/EchoAppSettings.java | 62 + .../org/tempuri/EchoAppSettingsResponse.java | 66 + test/TestService/org/tempuri/EchoClass.java | 66 + .../org/tempuri/EchoClassResponse.java | 66 + test/TestService/org/tempuri/EchoDouble.java | 64 + .../org/tempuri/EchoDoubleResponse.java | 64 + .../org/tempuri/EchoException.java | 93 + .../org/tempuri/EchoExceptionResponse.java | 66 + test/TestService/org/tempuri/EchoFault.java | 95 + .../org/tempuri/EchoFaultResponse.java | 66 + .../org/tempuri/EchoFaultWithName.java | 94 + .../tempuri/EchoFaultWithNameResponse.java | 66 + test/TestService/org/tempuri/EchoObject.java | 93 + test/TestService/org/tempuri/EchoObject2.java | 66 + .../org/tempuri/EchoObject2Response.java | 66 + test/TestService/org/tempuri/EchoObject3.java | 93 + .../org/tempuri/EchoObject3Response.java | 65 + test/TestService/org/tempuri/EchoObject4.java | 66 + .../org/tempuri/EchoObject4Response.java | 66 + .../org/tempuri/EchoObjectResponse.java | 65 + .../TestService/org/tempuri/EchoResponse.java | 66 + test/TestService/org/tempuri/EchoStruct.java | 93 + .../org/tempuri/EchoStructResponse.java | 66 + .../org/tempuri/EchoWithDelay.java | 93 + .../tempuri/EchoWithDelayOnSelectedNode.java | 151 + .../EchoWithDelayOnSelectedNodeResponse.java | 66 + .../org/tempuri/EchoWithDelayResponse.java | 66 + .../TestService/org/tempuri/EchoWithFail.java | 92 + .../org/tempuri/EchoWithFailResponse.java | 66 + .../org/tempuri/EchoWithOnExit.java | 151 + .../org/tempuri/EchoWithOnExitResponse.java | 66 + .../org/tempuri/EchoWithParam.java | 263 ++ .../org/tempuri/EchoWithParamResponse.java | 66 + test/TestService/org/tempuri/EnvVarNames.java | 26 + .../TestService/org/tempuri/GenerateLoad.java | 150 + .../org/tempuri/GenerateLoadResponse.java | 66 + .../tempuri/GenerateLoadWithInputFile.java | 147 + .../GenerateLoadWithInputFileResponse.java | 66 + .../tempuri/GenerateLoadWithResponseData.java | 151 + .../GenerateLoadWithResponseDataResponse.java | 66 + .../org/tempuri/GetCommonData.java | 207 ++ .../org/tempuri/GetCommonDataResponse.java | 66 + .../TestService/org/tempuri/ITestService.java | 380 +++ ...uthenticationFailureFaultFaultMessage.java | 45 + ...rgumentNullExceptionFaultFaultMessage.java | 45 + ...ivideByZeroExceptionFaultFaultMessage.java | 45 + ...ceEchoFaultExceptionFaultFaultMessage.java | 45 + ...OutOfMemoryExceptionFaultFaultMessage.java | 45 + ...rgumentNullExceptionFaultFaultMessage.java | 45 + ...ivideByZeroExceptionFaultFaultMessage.java | 45 + ...ultWithNameExceptionFaultFaultMessage.java | 45 + ...OutOfMemoryExceptionFaultFaultMessage.java | 45 + ...oRetryOperationErrorFaultFaultMessage.java | 45 + ...uthenticationFailureFaultFaultMessage.java | 45 + ...yRetryOperationErrorFaultFaultMessage.java | 45 + ...uthenticationFailureFaultFaultMessage.java | 45 + ...lRetryOperationErrorFaultFaultMessage.java | 45 + ...nDataCommonDataErrorFaultFaultMessage.java | 45 + .../org/tempuri/ITestServiceImpl.java | 1372 +++++++++ ...ice_DefaultBindingITestService_Server.java | 30 + .../org/tempuri/ITestService_Service.java | 99 + test/TestService/org/tempuri/Kill.java | 34 + .../TestService/org/tempuri/KillResponse.java | 34 + test/TestService/org/tempuri/LastTime.java | 64 + .../org/tempuri/LastTimeResponse.java | 67 + .../org/tempuri/ObjectFactory.java | 960 +++++++ test/TestService/org/tempuri/Pi.java | 256 ++ test/TestService/org/tempuri/Ping.java | 34 + .../TestService/org/tempuri/PingResponse.java | 64 + .../org/tempuri/RunInprocSoaJob.java | 34 + .../org/tempuri/RunInprocSoaJobResponse.java | 65 + .../org/tempuri/SerializationTest.java | 65 + .../tempuri/SerializationTestResponse.java | 64 + .../org/tempuri/ServiceSideAsyncEcho.java | 62 + .../tempuri/ServiceSideAsyncEchoResponse.java | 66 + test/TestService/org/tempuri/Trace.java | 65 + .../org/tempuri/TraceResponse.java | 65 + test/TestService/org/tempuri/Utility.java | 68 + .../TestService/org/tempuri/package-info.java | 2 + ...osoft.com.2003.10.Serialization.Arrays.xsd | 21 + ...as.microsoft.com.2003.10.Serialization.xsd | 42 + test/TestService/services.xsd | 104 + test/TestService/tempuri.org.wsdl | 681 +++++ test/TestService/tempuri.org.xsd | 440 +++ test/TestServiceClient/AITestLib.Helper.xsd | 10 + test/TestServiceClient/System.xsd | 1085 ++++++++ .../hpc.microsoft.com.session.xsd | 17 + test/TestServiceClient/makejar.cmd | 18 + test/TestServiceClient/makejar.sh | 16 + ...osoft.com.2003.10.Serialization.Arrays.xsd | 21 + ...as.microsoft.com.2003.10.Serialization.xsd | 42 + test/TestServiceClient/services.xsd | 104 + test/TestServiceClient/tempuri.org.wsdl | 681 +++++ test/TestServiceClient/tempuri.org.xsd | 440 +++ test/build.xml | 286 ++ test/buildtests.cmd | 13 + test/buildtests.sh | 13 + test/fullpass/Full.java | 35 + test/functiontest/BVT.java | 1442 ++++++++++ test/functiontest/BrokerClientTest.java | 2440 +++++++++++++++++ test/functiontest/BrokerResponseTest.java | 182 ++ test/functiontest/CommonDataBytes.java | 26 + test/functiontest/CommonDataHelper.java | 277 ++ test/functiontest/CommonDataTestActionId.java | 35 + test/functiontest/CommonDataTestDurable.java | 295 ++ .../CommonDataTestInteractive.java | 295 ++ test/functiontest/Config.java | 100 + test/functiontest/DataClientHelper.java | 97 + test/functiontest/DataClientTest.java | 1381 ++++++++++ test/functiontest/DurableSessionTest.java | 1284 +++++++++ test/functiontest/GenericServiceTest.java | 230 ++ test/functiontest/Logger.java | 233 ++ test/functiontest/SessionAttachInfoTest.java | 172 ++ test/functiontest/SessionBaseTest.java | 452 +++ test/functiontest/SessionPool.java | 593 ++++ test/functiontest/SessionStartInfoTest.java | 502 ++++ test/functiontest/SessionTest.java | 497 ++++ test/functiontest/Util.java | 81 + test/org/tempuri/CcpEchoSvc.java | 77 + test/org/tempuri/Echo.java | 65 + test/org/tempuri/EchoResponse.java | 65 + test/org/tempuri/GenerateLoad.java | 120 + test/org/tempuri/GenerateLoadResponse.java | 65 + test/org/tempuri/IEchoSvc.java | 45 + test/org/tempuri/ObjectFactory.java | 117 + test/org/tempuri/StatisticInfo.java | 121 + test/org/tempuri/package-info.java | 3 + test/readme.txt | 71 + test/stresstest/Stress.java | 335 +++ test/unittest/DataClientTest.java | 268 ++ test/unittest/SessionInfoTest.java | 90 + test/unittest/SessionPoolTest.java | 180 ++ test/unittest/SessionTest.java | 645 +++++ 220 files changed, 42109 insertions(+), 17 deletions(-) create mode 100644 src/hpc.microsoft.com.brokercontroller.wsdl create mode 100644 src/hpc.microsoft.com.brokercontroller.xsd create mode 100644 src/hpc.microsoft.com.dataservice.wsdl create mode 100644 src/hpc.microsoft.com.dataservice.xsd create mode 100644 test/README create mode 100644 test/TestCase/TestData.xml create mode 100644 test/TestCase/buildtests.cmd create mode 100644 test/TestCase/buildtests.sh create mode 100644 test/TestCase/fullpass/Full.java create mode 100644 test/TestCase/functiontest/BVT.java create mode 100644 test/TestCase/functiontest/BrokerClientTest.java create mode 100644 test/TestCase/functiontest/BrokerResponseTest.java create mode 100644 test/TestCase/functiontest/CommonDataBytes.java create mode 100644 test/TestCase/functiontest/CommonDataHelper.java create mode 100644 test/TestCase/functiontest/CommonDataTestActionId.java create mode 100644 test/TestCase/functiontest/CommonDataTestDurable.java create mode 100644 test/TestCase/functiontest/CommonDataTestInteractive.java create mode 100644 test/TestCase/functiontest/Config.java create mode 100644 test/TestCase/functiontest/DataClientHelper.java create mode 100644 test/TestCase/functiontest/DataClientTest.java create mode 100644 test/TestCase/functiontest/DurableSessionTest.java create mode 100644 test/TestCase/functiontest/GenericServiceTest.java create mode 100644 test/TestCase/functiontest/Logger.java create mode 100644 test/TestCase/functiontest/SessionAttachInfoTest.java create mode 100644 test/TestCase/functiontest/SessionBaseTest.java create mode 100644 test/TestCase/functiontest/SessionPool.java create mode 100644 test/TestCase/functiontest/SessionStartInfoTest.java create mode 100644 test/TestCase/functiontest/SessionTest.java create mode 100644 test/TestCase/functiontest/Util.java create mode 100644 test/TestCase/runtests_BVT.cmd create mode 100644 test/TestCase/runtests_BVT.sh create mode 100644 test/TestCase/runtests_Full.cmd create mode 100644 test/TestCase/runtests_Full.sh create mode 100644 test/TestData.xml create mode 100644 test/TestService/AITestLib.Helper.xsd create mode 100644 test/TestService/JavaTestService.config create mode 100644 test/TestService/System.xsd create mode 100644 test/TestService/com/microsoft/hpc/aitestsvclib/session/AuthenticationFailure.java create mode 100644 test/TestService/com/microsoft/hpc/aitestsvclib/session/ObjectFactory.java create mode 100644 test/TestService/com/microsoft/hpc/aitestsvclib/session/RetryOperationError.java create mode 100644 test/TestService/com/microsoft/hpc/aitestsvclib/session/package-info.java create mode 100644 test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java create mode 100644 test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java create mode 100644 test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java create mode 100644 test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java create mode 100644 test/TestService/hpc.microsoft.com.session.xsd create mode 100644 test/TestService/makejar.cmd create mode 100644 test/TestService/makejar.sh create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/CommonDataError.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/ObjectFactory.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/aitestlib/package-info.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ClassFoo.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ClassObj.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ClassStr.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfoSub.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/StatisticInfo.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/Sub.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/TestEnum.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/TestStruct.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/services/package-info.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ArgumentNullException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ArithmeticException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKey.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ConsoleKeyInfo.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/DivideByZeroException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/Exception.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/OutOfMemoryException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java create mode 100644 test/TestService/org/datacontract/schemas/_2004/_07/system/package-info.java create mode 100644 test/TestService/org/tempuri/AITestSvcLib.java create mode 100644 test/TestService/org/tempuri/ConsumeCPU.java create mode 100644 test/TestService/org/tempuri/ConsumeCPUResponse.java create mode 100644 test/TestService/org/tempuri/Echo.java create mode 100644 test/TestService/org/tempuri/EchoAppSettings.java create mode 100644 test/TestService/org/tempuri/EchoAppSettingsResponse.java create mode 100644 test/TestService/org/tempuri/EchoClass.java create mode 100644 test/TestService/org/tempuri/EchoClassResponse.java create mode 100644 test/TestService/org/tempuri/EchoDouble.java create mode 100644 test/TestService/org/tempuri/EchoDoubleResponse.java create mode 100644 test/TestService/org/tempuri/EchoException.java create mode 100644 test/TestService/org/tempuri/EchoExceptionResponse.java create mode 100644 test/TestService/org/tempuri/EchoFault.java create mode 100644 test/TestService/org/tempuri/EchoFaultResponse.java create mode 100644 test/TestService/org/tempuri/EchoFaultWithName.java create mode 100644 test/TestService/org/tempuri/EchoFaultWithNameResponse.java create mode 100644 test/TestService/org/tempuri/EchoObject.java create mode 100644 test/TestService/org/tempuri/EchoObject2.java create mode 100644 test/TestService/org/tempuri/EchoObject2Response.java create mode 100644 test/TestService/org/tempuri/EchoObject3.java create mode 100644 test/TestService/org/tempuri/EchoObject3Response.java create mode 100644 test/TestService/org/tempuri/EchoObject4.java create mode 100644 test/TestService/org/tempuri/EchoObject4Response.java create mode 100644 test/TestService/org/tempuri/EchoObjectResponse.java create mode 100644 test/TestService/org/tempuri/EchoResponse.java create mode 100644 test/TestService/org/tempuri/EchoStruct.java create mode 100644 test/TestService/org/tempuri/EchoStructResponse.java create mode 100644 test/TestService/org/tempuri/EchoWithDelay.java create mode 100644 test/TestService/org/tempuri/EchoWithDelayOnSelectedNode.java create mode 100644 test/TestService/org/tempuri/EchoWithDelayOnSelectedNodeResponse.java create mode 100644 test/TestService/org/tempuri/EchoWithDelayResponse.java create mode 100644 test/TestService/org/tempuri/EchoWithFail.java create mode 100644 test/TestService/org/tempuri/EchoWithFailResponse.java create mode 100644 test/TestService/org/tempuri/EchoWithOnExit.java create mode 100644 test/TestService/org/tempuri/EchoWithOnExitResponse.java create mode 100644 test/TestService/org/tempuri/EchoWithParam.java create mode 100644 test/TestService/org/tempuri/EchoWithParamResponse.java create mode 100644 test/TestService/org/tempuri/EnvVarNames.java create mode 100644 test/TestService/org/tempuri/GenerateLoad.java create mode 100644 test/TestService/org/tempuri/GenerateLoadResponse.java create mode 100644 test/TestService/org/tempuri/GenerateLoadWithInputFile.java create mode 100644 test/TestService/org/tempuri/GenerateLoadWithInputFileResponse.java create mode 100644 test/TestService/org/tempuri/GenerateLoadWithResponseData.java create mode 100644 test/TestService/org/tempuri/GenerateLoadWithResponseDataResponse.java create mode 100644 test/TestService/org/tempuri/GetCommonData.java create mode 100644 test/TestService/org/tempuri/GetCommonDataResponse.java create mode 100644 test/TestService/org/tempuri/ITestService.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceImpl.java create mode 100644 test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java create mode 100644 test/TestService/org/tempuri/ITestService_Service.java create mode 100644 test/TestService/org/tempuri/Kill.java create mode 100644 test/TestService/org/tempuri/KillResponse.java create mode 100644 test/TestService/org/tempuri/LastTime.java create mode 100644 test/TestService/org/tempuri/LastTimeResponse.java create mode 100644 test/TestService/org/tempuri/ObjectFactory.java create mode 100644 test/TestService/org/tempuri/Pi.java create mode 100644 test/TestService/org/tempuri/Ping.java create mode 100644 test/TestService/org/tempuri/PingResponse.java create mode 100644 test/TestService/org/tempuri/RunInprocSoaJob.java create mode 100644 test/TestService/org/tempuri/RunInprocSoaJobResponse.java create mode 100644 test/TestService/org/tempuri/SerializationTest.java create mode 100644 test/TestService/org/tempuri/SerializationTestResponse.java create mode 100644 test/TestService/org/tempuri/ServiceSideAsyncEcho.java create mode 100644 test/TestService/org/tempuri/ServiceSideAsyncEchoResponse.java create mode 100644 test/TestService/org/tempuri/Trace.java create mode 100644 test/TestService/org/tempuri/TraceResponse.java create mode 100644 test/TestService/org/tempuri/Utility.java create mode 100644 test/TestService/org/tempuri/package-info.java create mode 100644 test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd create mode 100644 test/TestService/schemas.microsoft.com.2003.10.Serialization.xsd create mode 100644 test/TestService/services.xsd create mode 100644 test/TestService/tempuri.org.wsdl create mode 100644 test/TestService/tempuri.org.xsd create mode 100644 test/TestServiceClient/AITestLib.Helper.xsd create mode 100644 test/TestServiceClient/System.xsd create mode 100644 test/TestServiceClient/hpc.microsoft.com.session.xsd create mode 100644 test/TestServiceClient/makejar.cmd create mode 100644 test/TestServiceClient/makejar.sh create mode 100644 test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd create mode 100644 test/TestServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd create mode 100644 test/TestServiceClient/services.xsd create mode 100644 test/TestServiceClient/tempuri.org.wsdl create mode 100644 test/TestServiceClient/tempuri.org.xsd create mode 100644 test/build.xml create mode 100644 test/buildtests.cmd create mode 100644 test/buildtests.sh create mode 100644 test/fullpass/Full.java create mode 100644 test/functiontest/BVT.java create mode 100644 test/functiontest/BrokerClientTest.java create mode 100644 test/functiontest/BrokerResponseTest.java create mode 100644 test/functiontest/CommonDataBytes.java create mode 100644 test/functiontest/CommonDataHelper.java create mode 100644 test/functiontest/CommonDataTestActionId.java create mode 100644 test/functiontest/CommonDataTestDurable.java create mode 100644 test/functiontest/CommonDataTestInteractive.java create mode 100644 test/functiontest/Config.java create mode 100644 test/functiontest/DataClientHelper.java create mode 100644 test/functiontest/DataClientTest.java create mode 100644 test/functiontest/DurableSessionTest.java create mode 100644 test/functiontest/GenericServiceTest.java create mode 100644 test/functiontest/Logger.java create mode 100644 test/functiontest/SessionAttachInfoTest.java create mode 100644 test/functiontest/SessionBaseTest.java create mode 100644 test/functiontest/SessionPool.java create mode 100644 test/functiontest/SessionStartInfoTest.java create mode 100644 test/functiontest/SessionTest.java create mode 100644 test/functiontest/Util.java create mode 100644 test/org/tempuri/CcpEchoSvc.java create mode 100644 test/org/tempuri/Echo.java create mode 100644 test/org/tempuri/EchoResponse.java create mode 100644 test/org/tempuri/GenerateLoad.java create mode 100644 test/org/tempuri/GenerateLoadResponse.java create mode 100644 test/org/tempuri/IEchoSvc.java create mode 100644 test/org/tempuri/ObjectFactory.java create mode 100644 test/org/tempuri/StatisticInfo.java create mode 100644 test/org/tempuri/package-info.java create mode 100644 test/readme.txt create mode 100644 test/stresstest/Stress.java create mode 100644 test/unittest/DataClientTest.java create mode 100644 test/unittest/SessionInfoTest.java create mode 100644 test/unittest/SessionPoolTest.java create mode 100644 test/unittest/SessionTest.java diff --git a/sample/helloworld/RunTest.sh b/sample/helloworld/RunTest.sh index ee9bfac..4cb3cdb 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=Pa55word&&7 +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..b7c3be5 100644 --- a/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java +++ b/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java @@ -21,6 +21,7 @@ * <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"/> @@ -38,6 +39,7 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "BrokerInitializationResult", namespace = "http://hpc.microsoft.com/BrokerLauncher", propOrder = { "brokerEpr", + "brokerUniqueId", "clientBrokerHeartbeatInterval", "clientBrokerHeartbeatRetryCount", "controllerEpr", @@ -49,6 +51,8 @@ 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") @@ -86,6 +90,30 @@ 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. * 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/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..d71bf2e 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 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 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/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..ee999f5 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 $CXF_HOME/lib/cxf-manifest.jar 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/TestCase/TestData.xml b/test/TestCase/TestData.xml new file mode 100644 index 0000000..88d0d28 --- /dev/null +++ b/test/TestCase/TestData.xml @@ -0,0 +1,55 @@ + + + + +shpc-0042 +fareast\wsdcta +Pa55word&&7 +JavaTestService +10 +3 +2 + fareast\wsdcta2 + Pa55word&&7 + 2 + + +12 +BVTValue1 + + + + +SoaGenericTestService + + + + JavaTestService + + JavaTestService + + \\shpc-0050\CommonData2 + 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 + + + + + \ No newline at end of file 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..0428677 --- /dev/null +++ b/test/TestCase/functiontest/BVT.java @@ -0,0 +1,1442 @@ +/** + * + */ +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()); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = Session.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); + // 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 (session != null) { + try { + session.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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + 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..9c32335 --- /dev/null +++ b/test/TestCase/functiontest/BrokerClientTest.java @@ -0,0 +1,2440 @@ +/** + * + */ +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); + + logger.Start("BrokerClientTest"); + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + if (dClient != null) + dClient.close(true); + + if (iClient != null) + iClient.close(true); + + logger.End("BrokerClientTest"); + } + + /** + * 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() { + 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 : %s", e.getMessage()); + } catch (Throwable e) { + logger.Error("UE : %s", e.getMessage()); + } + + 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 : %s", e.getMessage()); + } catch (Throwable e) { + logger.Error("UE : %s", e.getMessage()); + } + + } + + /** + * 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() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } + } + + } + + /** + * 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() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(null); + logger.Error("Excetion is expected. d null"); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(1); + logger.Error("Excetion is expected. i int"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(true); + logger.Error("Excetion is expected. i boolean "); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object)} + * . + */ + @Test + public final void testSendRequestObjectObject() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + try { + iClient.sendRequest(null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(null, "datat"); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(new Object(), 1); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(new Object(), "data"); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + // 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()); e.printStackTrace(); } + * + * try { iClient.sendRequest(request, request); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + * + * try { dClient.sendRequest(request, true); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + } + + /** + * 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() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); e.printStackTrace(); } + * + * try { dClient.sendRequest(request, "datat", ""); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + try { + iClient.sendRequest(request, 1, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + /* + * try { dClient.sendRequest(request, "datat", "&^(&^%$#{}?_?#@*"); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class)} + * . + */ + @Test + public final void testGetResponses() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (NullPointerException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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() { + + // 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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", + e.toString()); + e.printStackTrace(); + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * 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() { + + // boundary + // when the responsehandler is null + Echo request = Util.generateEchoRequest(); + + try { + iClient.setResponseHandler(EchoResponse.class, null); + logger.Error("EE is not thrown."); + } catch (NullPointerException e) { + logger.Info("NullPointerException is expected."); + e.printStackTrace(); + } + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(3000); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } // BUG this cannot throw InvalidOperationException + + // boundary + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} + * . + */ + @Test + public final void testEndRequestsInt_1() { + // functional + Echo request = Util.generateEchoRequest(); + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(0); + } catch (Throwable e) { + logger.Error("UE for 0 timeout %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + } + + @Test + public final void testEndRequestsInt_0() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(-1); + logger.Error("EE is not thrown. -1"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(Integer.MIN_VALUE); + logger.Error("EE is not thrown. min"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + e.printStackTrace(); + } + + /* + * 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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test + public final void testFlush() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test(timeout = 180000) + public final void testFlush_1() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } + } + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(); // BUG flush should throw SessionException or + // InvalidOperationException + dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test(timeout = 180000) + public final void testFlush_Bug1() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(); + //dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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 %s", + e.toString()); + + } + }); + + 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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush(int)}. + */ + @Test + public final void testFlushInt() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(3000); // BUG flush should throw SessionException or + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + try { + dClient.flush(-1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(0); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(); // BUG this cannot throw + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests_1() { + + // boundary + Echo request = Util.generateEchoRequest(); + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when end requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close()}. + */ + @Test + public final void testClose() { + // functional + // bug 11821 + + try { + dClient.close(); + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean)} + * . + */ + @Test + public final void testCloseBoolean() { + // functional + // bug 11821 + + try { + dClient.close(true); + } catch (IllegalStateException e) { + logger.Info("IllegalStateException is thrown. %s", e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + // functional + + try { + dClient.close(false, 5000); + dClient = null; + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt_1() { + // boundary + // bug 11821 + + try { + dClient.close(false, -1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } + + + + try { + dClient.close(true, 1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.close(true, 0); + + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, int)} + * . + */ + @Test + public final void testSendRequestObjectObjectInt() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1, 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, -5000); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo", + 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo", 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + } + + + /** + * Test method for GetRequestCount + */ + @Test + public final void testGetRequestCount() { + + 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 %s", ex.toString()); + + } + + } + + 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 %s",e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown %s",e.toString()); + e.printStackTrace(); + } + + + + + + } + + /** + * Test method for GetStatus + */ + @Test + public final void testGetStatus() { + + 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 %s", ex.toString()); + + } + + } + + 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 %s",e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown %s",e.toString()); + e.printStackTrace(); + } + + + + + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt_E1() { + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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()); + e.printStackTrace(); + l.countDown(); + } + + }, 15000); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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", + e.toString()); + e.printStackTrace(); + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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"); + e.printStackTrace(); + l.countDown(); + return; + } + } + logger.Error("Error in process request %s raised error", + e.toString()); + e.printStackTrace(); + l.countDown(); + return; + + } + + }, 5); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObject() { + + // functional + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt() { + // functional + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }, 5000); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt_E1() { + // boundary + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + 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..cd6bbd1 --- /dev/null +++ b/test/TestCase/functiontest/BrokerResponseTest.java @@ -0,0 +1,182 @@ +/** + * + */ +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 { + logger.Start("BrokerResponseTest"); + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("BrokerResponseTest"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getMessage()}. + */ + @Test + public final void testGetMessage() { + logger.Info(iResponse.getMessage().toString()); + logger.Info(iResponse.getMessage().getContentDescription()); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getResult()}. + */ + @Test + public final void testGetResult() { + 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.printStackTrace(); + } catch (SOAPException e) { + logger.Error("response getresult error"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SOAPException e) { + logger.Error("response getresult error"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getUserData()}. + */ + @Test + public final void testGetUserData() { + + logger.assertEqual("get user data", iResponse.getUserData(), "1"); + logger.assertEqual("get user data", dResponse.getUserData(), "2"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getSOAPMessage(java.lang.Object)} + * . + */ + @Test + public final void testGetSOAPMessage() { + + logger.Info(iResponse.getMessage().toString()); + // it is not public, do not test it here + } + + 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..977c4ec --- /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..648f0f1 --- /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..972b972 --- /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..5cbc308 --- /dev/null +++ b/test/TestCase/functiontest/CommonDataTestDurable.java @@ -0,0 +1,295 @@ +/** + * + */ +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("CommonDataTest"); + logger = new Logger(true, true, "DataClientTest"); + 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 { + logger.Start("CommonDataTest"); + } + + /** + * @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 + } + } + logger.End("CommonDataTest"); + } + + @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 { + 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); + } + } + + @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 { + 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); + + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + 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..9ec1ae7 --- /dev/null +++ b/test/TestCase/functiontest/CommonDataTestInteractive.java @@ -0,0 +1,295 @@ +/** + * + */ +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("CommonDataTest"); + logger = new Logger(true, true, "DataClientTest"); + 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 { + logger.Start("CommonDataTest"); + } + + /** + * @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 + } + } + logger.End("CommonDataTest"); + } + + @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 { + 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); + } + } + + @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 { + 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); + + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + 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..a444877 --- /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 = "fareast\\wsdcta"; + public String Password = "Pa55word##3"; + public String UserName2 = "fareast\\wsdcta2"; + public String Password2 = "Pa55word##3"; + + public String Scheduler = "wcs-1515118"; + public String ServiceName = "JavaTestService"; + 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..e8e5a49 --- /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..41a61b0 --- /dev/null +++ b/test/TestCase/functiontest/DataClientTest.java @@ -0,0 +1,1381 @@ +/** + * + */ +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("CommonDataTest"); + 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 { + logger.Start("DataClientTest"); + } + + /** + * @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(); + logger.End("DataClientTest"); + } + + @Test(timeout = 600000) + // headnode=NULL + public final void DataClient_API_Create_1() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // headnode=string.Empty + public final void DataClient_API_Create_2() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // headnode is not existed + public final void DataClient_API_Create_3() throws DataException { + 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()); + } + } + + // @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 { + 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()); + } + } + + @Test(timeout = 600000) + // dataClientId=string.Empty + public final void DataClient_API_Create_6() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // valid dataClientId", + public final void DataClient_API_Create_7() { + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Create - invalid dataClientId + public final void DataClient_API_Create_8() { + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Create - username=NULL + public final void DataClient_API_Create_9() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - username is empty + public final void DataClient_API_Create_10() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - password=NULL + public final void DataClient_API_Create_11() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - password is empty + public final void DataClient_API_Create_12() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - create two DataClient with the same name + public final void DataClient_API_Create_13() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - object is NULL + public final void DataClient_API_WriteRaw_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - call WriteAll twice + public final void DataClient_API_WriteRaw_2() throws DataException { + 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(); + } + + + @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 { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read before write + public final void DataClient_API_ReadRaw_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Multiple read + public final void DataClient_API_ReadRaw_2() throws IllegalStateException, + DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_4() throws DataException { + 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()); + + } + + } + + + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_6() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read raw from write raw could be + // serializable + public final void DataClient_API_ReadRaw_7() throws IOException, + DataException, ClassNotFoundException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_8() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_9() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Unauthorized write + public void DataClient_API_WriteRaw_10() throws DataException { + 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); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=NULL + public final void DataClient_API_Open_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=string.Empty + public final void DataClient_API_Open_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode is not existed + public final void DataClient_API_Open_3() throws DataException { + 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(); + } + + // 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 { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - dataClientId=string.Empty + public final void DataClient_API_Open_6() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - valid dataClientId + public final void DataClient_API_Open_7() throws DataException { + 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(); + + } + + @Test(timeout = 600000) + // DataClient.Open - invalid dataClientId + public void DataClient_API_Open_8() { + + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which does not exist + public final void DataClient_API_Open_9() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - multiple Open and Read + public final void DataClient_API_Open_10() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which has been closed + public final void DataClient_API_Open_11() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Open - Opened dataClient is read only + public final void DataClient_API_Open_12() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server unreachable + public final void DataClient_SOADataServer_1() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server is empty + public final void DataClient_SOADataServer_2() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - multiple data server path + public final void DataClient_SOADataServer_3() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path + public void DataClient_SOADataServer_4() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - local path + public final void DataClient_SOADataServer_5() throws IOException { + 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); + } + + + @Test(timeout = 600000) + // DataClient.Delete - Unauthorized delete + public final void DataClient_API_Delete_3() throws IOException, + DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Delete - Authorized delete + public final void DataClient_API_Delete_4() throws IOException, + DataException { + 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()); + } + } + + 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 { + // 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(); + + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress + public final void DataClient_API_WriteCompress_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress (by default)", + public final void DataClient_API_WriteCompress_3() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - no data written + public final void DataClient_API_FilePath_1() throws DataException { + DataClient dataClient = DataClientHelper.Create(); + String filePath = dataClient.getStorePath(); + logger.Info("The data file path is %s", filePath); + + DataClientHelper.Delete(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data deleted + public final void DataClient_API_FilePath_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data could be read by simple file solution + public final void DataClient_API_FilePath_3() throws IOException, + DataException, ClassNotFoundException { + 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(); + } + + @Test(timeout = 600000) + // DataSecurity - Unauthorized read (by default) + public final void DataClient_API_DataSecurity_2() throws DataException { + 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); + + } + + @Test(timeout = 600000) + // DataSecurity - Authorized read for another user + public final void DataClient_API_DataSecurity_4() throws DataException, + SocketTimeoutException, SessionException, + DatatypeConfigurationException { + 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); + } + + @Test(timeout = 600000) + // Concurrency write + public final void DataClient_Concurrency_1() throws InterruptedException, + BrokenBarrierException, DataException { + 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(); + } + + @Test(timeout = 600000) + // Concurrency read and close + public final void DataClient_Concurrency_2() throws InterruptedException, + BrokenBarrierException { + DataClient_Concurrency_2_Helper(CommonDataHelper.defaultDataClientId, + false, 100); + } + + 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 { + 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(); + } + + 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..6928307 --- /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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } + + // 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"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SocketTimeoutException was thrown"); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SessionException was thrown"); + } + + SessionStartInfo info2 = new SessionStartInfo(config.Scheduler, + config.ServiceName); + + try { + dSession = DurableSession.createSession(info2); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SocketTimeoutException was thrown"); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SessionException was thrown"); + } finally { + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info, 0); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("SessionException when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (NullPointerException e1) { + logger.Info("NullPointerException when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getClientVersion(); + logger.assertEqual("DurableSession clientVersion major", v.getMajor(), + 3); + logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), + 2); + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getServerVersion(); + logger.Info(v.toString()); + logger.assertEqual("DurableSession serverVersion major", v.getMajor(), + 3); + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 %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); + 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 %s", ex.toString()); + + } + + } + 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 %s", e1.toString()); + e1.printStackTrace(); + } + + 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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + session.close(); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // boundary + + dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(true, 1); + logger.Error("EE is not thrown"); + } catch (SessionException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Info("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(true, Integer.MIN_VALUE); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(false, Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } + + // 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.printStackTrace(); + } + + } + + // 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Info("SessionException is thrown"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + try { + versions = DurableSession.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException is thrown"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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..093a73e --- /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 %s", ex.toString()); + ex.printStackTrace(); + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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. %s", ee.toString()); + ee.printStackTrace(); + } + catch (Throwable ee) { + logger.Error("Error in process request %s", ee.toString()); + ee.printStackTrace(); + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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..0ac6c1e --- /dev/null +++ b/test/TestCase/functiontest/Logger.java @@ -0,0 +1,233 @@ +/** + * + */ +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) { + 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 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(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) { + + 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..cf31ebf --- /dev/null +++ b/test/TestCase/functiontest/SessionAttachInfoTest.java @@ -0,0 +1,172 @@ +/** + * + */ +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 { + logger.Start("SessionAttachInfoTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionAttachInfoTest"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int)} + * . + */ + @Test + public final void testSessionAttachInfoStringInt() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + DurableSession dSession_attached = null; + try { + dSession_attached = DurableSession.attachSession(attachInfo); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + // 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"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Invalid sessionAttachInfo when attaching a durable session"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + } + + 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..a36e620 --- /dev/null +++ b/test/TestCase/functiontest/SessionBaseTest.java @@ -0,0 +1,452 @@ +/** + * + */ +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 { + logger.Start("SessionBaseTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionBaseTest"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. + */ + @Test + public final void testGetId() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} + * . + */ + @Test + public final void testGetEndpointReference() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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(), "3.2"); + /* logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); + + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + sb = Session.createSession(info); + logger.assertEqual("client version", sb.getClientVersion() + .toString(), "3.2"); + /*logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ + logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(false); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(true, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(true, 0); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(false, -1000); + logger.Error("EE is not thrown"); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(true, 1); + logger.Error("EE is not thrown 1"); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Error("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(true, Integer.MAX_VALUE); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testGetServiceVersions() { + + 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.printStackTrace(); + } + + // 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.printStackTrace(); + } + + } + + // 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("UE is thrown"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + try { + versions = SessionBase.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("SessionException is thrown"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } + + } + + /** + * Test method for NoServiceVersion + */ + @Test + public final void testNoServiceVersion() { + logger.assertEqual("noServiceVersion", SessionBase.NoServiceVersion, new Version(0,0)); + + } + + 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..7e3c1a2 --- /dev/null +++ b/test/TestCase/functiontest/SessionPool.java @@ -0,0 +1,593 @@ +/** + * + */ +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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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 %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); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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 %s%n%s", e.toString(), + e.getStackTrace()); + } + + 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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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 %s", + ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + } + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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: %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + } + logger.Info("Client %s calling endRequests()...", m + "_" + + k); + try { + client.endRequests(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + 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 %s", + ex.toString()); + + } + + } + } catch (SessionException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + try { + client.close(true); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + 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 %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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..0ba1979 --- /dev/null +++ b/test/TestCase/functiontest/SessionStartInfoTest.java @@ -0,0 +1,502 @@ +/** + * + */ +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 { + logger.Start("SessionStartInfoTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionStartInfoTest"); + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + //should check the session created. + if (session !=null) { + try { + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + } + + + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringString() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString() { + 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.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_noVersion() { + 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.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_Er() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + 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..0c6af03 --- /dev/null +++ b/test/TestCase/functiontest/SessionTest.java @@ -0,0 +1,497 @@ +/** + * + */ +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("DurableSessionTest"); + logger = new Logger(true, true, "DurableSessionTest"); + + 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 { + logger.Start("SessionTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionTest"); + } + + /** + * 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.Info(iSession.getAutoCloseJob().toString()); // BUG what's this + // for? + + } + + + /** + * 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.Info(iSession.httpEndpointReference()); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfo() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } + + // boundary + try { + session = Session.createSession(null); + logger.Error("EException is not thrown."); + } catch (Throwable e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } + + // more boundary test case for invalid startInfo would be included in + // SessionStartInfo test + + } + + /** + * 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() { + + // 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() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, Integer.MAX_VALUE); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, 0); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info, -1); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, Integer.MIN_VALUE); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfo() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a session"); + e1.printStackTrace(); + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfoInt() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session_attached = Session.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + } + + 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..096884e --- /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/TestData.xml b/test/TestData.xml new file mode 100644 index 0000000..d282ade --- /dev/null +++ b/test/TestData.xml @@ -0,0 +1,55 @@ + + + + +shpc-0042 +fareast\wsdcta +Pa55word&&7 +AITestServiceLib +10 +3 +2 + fareast\wsdcta2 + Pa55word&&7 + 2 + + +12 +BVTValue1 + + + + +SoaGenericTestService + + + + aitestservicelib + + aitestservicelib + + \\shpc-0050\CommonData2 + 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 + + + + + \ No newline at end of file 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..0f80570 --- /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/schemas/_2003/_10/serialization/ObjectFactory.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java new file mode 100644 index 0000000..7309e3d --- /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 _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/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..47d554c --- /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", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays") + 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", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", required = true, nillable = true) + protected String key; + @XmlElement(name = "Value", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", 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/ObjectFactory.java b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java new file mode 100644 index 0000000..995e47d --- /dev/null +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java @@ -0,0 +1,61 @@ + +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 _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 ArrayOfKeyValueOfstringstring.KeyValueOfstringstring } + * + */ + public ArrayOfKeyValueOfstringstring.KeyValueOfstringstring createArrayOfKeyValueOfstringstringKeyValueOfstringstring() { + return new ArrayOfKeyValueOfstringstring.KeyValueOfstringstring(); + } + + /** + * 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..8ec251a --- /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..945e85f --- /dev/null +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java @@ -0,0 +1,354 @@ + +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="called" 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="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", + "called", + "envs", + "jobID", + "onExitCalled", + "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; + @XmlSchemaType(name = "dateTime") + @XmlElement(name="called", namespace="http://schemas.datacontract.org/2004/07/services") + protected XMLGregorianCalendar called; + @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 = "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 called property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getCalled() { + return called; + } + + /** + * Sets the value of the called property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setCalled(XMLGregorianCalendar value) { + this.called = 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 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..5fc21bd --- /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 _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 _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 _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 _ClassStrStr_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "str"); + private final static QName _ClassFooS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "s"); + private final static QName _SubSubS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "sub_s"); + + /** + * 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 = "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 = "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 = "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 = "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(_ClassFooS_QNAME, String.class, ClassFoo.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 = "s", scope = TestStruct.class) + public JAXBElement createTestStructS(String value) { + return new JAXBElement(_ClassFooS_QNAME, String.class, TestStruct.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..aadb44b --- /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 ArgumentException } + * + */ + public ArgumentException createArgumentException() { + return new ArgumentException(); + } + + /** + * Create an instance of {@link SystemException } + * + */ + public SystemException createSystemException() { + return new SystemException(); + } + + /** + * Create an instance of {@link Exception } + * + */ + public Exception createException() { + return new Exception(); + } + + /** + * 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 ArithmeticException } + * + */ + public ArithmeticException createArithmeticException() { + return new ArithmeticException(); + } + + /** + * Create an instance of {@link OutOfMemoryException } + * + */ + public OutOfMemoryException createOutOfMemoryException() { + return new OutOfMemoryException(); + } + + /** + * 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..47b1a83 --- /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, + ArithmeticException.class, + OutOfMemoryException.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/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..58f85e9 --- /dev/null +++ b/test/TestService/org/tempuri/ITestService.java @@ -0,0 +1,380 @@ +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 + * 2011-06-14T10:42:20.346+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.aitestsvclib.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") + @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 java.lang.String trace( + @WebParam(name = "msg", targetNamespace = "http://tempuri.org/") + java.lang.String msg + ); + + @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..b752521 --- /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.3.3 + * 2011-04-14T16:08:10.570+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.aitestsvclib.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..1779194 --- /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.3.3 + * 2011-04-14T16:08:10.431+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..d61c641 --- /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.3.3 + * 2011-04-14T16:08:10.495+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..55cfc8b --- /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.3.3 + * 2011-04-14T16:08:10.423+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultExceptionFaultFaultMessage extends java.lang.Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..e14ec38 --- /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.3.3 + * 2011-04-14T16:08:10.441+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..5048878 --- /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.3.3 + * 2011-04-14T16:08:10.363+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..b98c4bc --- /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.3.3 + * 2011-04-14T16:08:10.385+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..26d7323 --- /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.3.3 + * 2011-04-14T16:08:10.354+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameExceptionFaultFaultMessage extends java.lang.Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..e8f7f5b --- /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.3.3 + * 2011-04-14T16:08:10.374+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") +public class ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..5301ea2 --- /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.3.3 + * 2011-04-14T16:08:10.603+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.aitestsvclib.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..b293afc --- /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.3.3 + * 2011-04-14T16:08:10.504+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.aitestsvclib.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..e975014 --- /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.3.3 + * 2011-04-14T16:08:10.512+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.aitestsvclib.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..8016f6b --- /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.3.3 + * 2011-04-14T16:08:10.394+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { + super(message); + this.authenticationFailure = authenticationFailure; + } + + public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { + super(message, cause); + this.authenticationFailure = authenticationFailure; + } + + public com.microsoft.hpc.aitestsvclib.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..65dbda9 --- /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.3.3 + * 2011-04-14T16:08:10.405+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") +public class ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { + super(message); + this.retryOperationError = retryOperationError; + } + + public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { + super(message, cause); + this.retryOperationError = retryOperationError; + } + + public com.microsoft.hpc.aitestsvclib.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..8876eb2 --- /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.3.3 + * 2011-04-14T16:08:10.259+08:00 + * Generated source version: 2.3.3 + * + */ + +@WebFault(name = "CommonDataError", targetNamespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper") +public class ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage extends Exception { + public static final long serialVersionUID = 20110414160810L; + + 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..1e16e3b --- /dev/null +++ b/test/TestService/org/tempuri/ITestServiceImpl.java @@ -0,0 +1,1372 @@ +//----------------------------------------------------------------------- +// +// 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.net.InetAddress; +import java.net.UnknownHostException; +import java.security.MessageDigest; +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 javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.Duration; + +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 com.microsoft.hpc.scheduler.session.DataClient; +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.aitestsvclib.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 +{ + + 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(); + + 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(); + } + } + + 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.setCalled(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.setCalled(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); + } + } + + // In the Java version of AITestServiceLib, trace() takes a string of format + // "LEVEL:MSG" + // It records the trace message with the specified level, and then returns + // the expected trace file path. + // The path is later used by client to pull the trace file. + public java.lang.String trace(java.lang.String msg) + { + ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation trace"); + try + { + String level = msg.substring(0, msg.indexOf(':')); + msg = msg.substring(msg.indexOf(':') + 1); + + if (level.equals("ALL")) + ServiceContext.Logger.traceEvent(Level.ALL, msg); + else if (level.equals("CONFIG")) + ServiceContext.Logger.traceEvent(Level.CONFIG, msg); + else if (level.equals("FINE")) + ServiceContext.Logger.traceEvent(Level.FINE, msg); + else if (level.equals("FINER")) + ServiceContext.Logger.traceEvent(Level.FINER, msg); + else if (level.equals("FINEST")) + ServiceContext.Logger.traceEvent(Level.FINEST, msg); + else if (level.equals("INFO")) + ServiceContext.Logger.traceEvent(Level.INFO, msg); + else if (level.equals("OFF")) + ServiceContext.Logger.traceEvent(Level.OFF, msg); + else if (level.equals("SEVERE")) + ServiceContext.Logger.traceEvent(Level.SEVERE, msg); + else if (level.equals("WARNING")) + ServiceContext.Logger.traceEvent(Level.WARNING, msg); + else + return "Fail"; + String machineName; + try + { + machineName = InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + machineName = ""; + } + String fileName = String.format("%d_%s.%s_trace.svclog", jobid, + System.getenv(EnvVarNames.CCP_TASKID), + System.getenv(EnvVarNames.CCP_TASKINSTANCEID)); + String tracePath = String.format("%sSoaTrace\\", System.getenv("CCP_DATA")); + tracePath = tracePath.replace(':', '$'); + return String.format("\\\\%s\\%s%s", machineName, tracePath, fileName); + } + catch (java.lang.Exception ex) + { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } + + /* + * (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.setCalled(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 = info.getEnvs().getValue() + .getKeyValueOfstringstring(); + 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; + + // throw new + // ITestServiceEchoAuthenticationFailureFaultFaultMessage("ITestService_Echo_AuthenticationFailureFault_FaultMessage..."); + // throw new + // ITestServiceEchoRetryOperationErrorFaultFaultMessage("ITestService_Echo_RetryOperationErrorFault_FaultMessage..."); + } + + /* + * (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; + } +} 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..21cada1 --- /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.3.3 + * 2011-04-14T16:08:10.724+08:00 + * Generated source version: 2.3.3 + * + */ + +public class ITestService_DefaultBindingITestService_Server{ + + protected ITestService_DefaultBindingITestService_Server() throws Exception { + System.out.println("Starting Server"); + Object implementor = new ITestServiceImpl(); + String address = "http://localhost:9200/Broker"; + Endpoint.publish(address, implementor); + } + + public static void main(String args[]) throws Exception { + new ITestService_DefaultBindingITestService_Server(); + System.out.println("Server ready..."); + + Thread.sleep(50 * 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..36050b7 --- /dev/null +++ b/test/TestService/org/tempuri/ITestService_Service.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-04-14T16:08:10.733+08:00 + * Generated source version: 2.3.3 + * + */ + + +@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) { + System.err.println("Can not initialize the default wsdl from file:tempuri.org.wsdl"); + // e.printStackTrace(); + } + 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/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..6191748 --- /dev/null +++ b/test/TestService/org/tempuri/ObjectFactory.java @@ -0,0 +1,960 @@ + +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 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 _EchoObjectResponseEchoObjectResult_QNAME = new QName("http://tempuri.org/", "EchoObjectResult"); + private final static QName _EchoObject3ResponseEchoObject3Result_QNAME = new QName("http://tempuri.org/", "EchoObject3Result"); + private final static QName _EchoObject4Obj_QNAME = new QName("http://tempuri.org/", "obj"); + private final static QName _EchoFaultResponseEchoFaultResult_QNAME = new QName("http://tempuri.org/", "EchoFaultResult"); + private final static QName _EchoObject2ResponseEchoObject2Result_QNAME = new QName("http://tempuri.org/", "EchoObject2Result"); + private final static QName _EchoResponseEchoResult_QNAME = new QName("http://tempuri.org/", "EchoResult"); + private final static QName _EchoWithDelayResponseEchoWithDelayResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayResult"); + private final static QName _GenerateLoadWithInputFileResponseGenerateLoadWithInputFileResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithInputFileResult"); + private final static QName _EchoWithOnExitLogPath_QNAME = new QName("http://tempuri.org/", "logPath"); + private final static QName _EchoClassCls_QNAME = new QName("http://tempuri.org/", "cls"); + private final static QName _EchoWithOnExitResponseEchoWithOnExitResult_QNAME = new QName("http://tempuri.org/", "EchoWithOnExitResult"); + private final static QName _ConsumeCPUResponseConsumeCPUResult_QNAME = new QName("http://tempuri.org/", "ConsumeCPUResult"); + private final static QName _EchoFaultWithNameExceptionName_QNAME = new QName("http://tempuri.org/", "exceptionName"); + private final static QName _EchoFaultEx_QNAME = new QName("http://tempuri.org/", "ex"); + private final static QName _GenerateLoadCommonDataPath_QNAME = new QName("http://tempuri.org/", "common_data_path"); + private final static QName _GenerateLoadInputData_QNAME = new QName("http://tempuri.org/", "input_data"); + 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 _EchoWithDelayOnSelectedNodeSelectedNode_QNAME = new QName("http://tempuri.org/", "selectedNode"); + private final static QName _GetCommonDataResponseGetCommonDataResult_QNAME = new QName("http://tempuri.org/", "GetCommonDataResult"); + private final static QName _EchoClassResponseEchoClassResult_QNAME = new QName("http://tempuri.org/", "EchoClassResult"); + private final static QName _EchoObject3Type_QNAME = new QName("http://tempuri.org/", "type"); + private final static QName _EchoObject3O_QNAME = new QName("http://tempuri.org/", "o"); + private final static QName _EchoWithDelayOnSelectedNodeResponseEchoWithDelayOnSelectedNodeResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayOnSelectedNodeResult"); + private final static QName _TraceMsg_QNAME = new QName("http://tempuri.org/", "msg"); + private final static QName _EchoAppSettingsResponseEchoAppSettingsResult_QNAME = new QName("http://tempuri.org/", "EchoAppSettingsResult"); + private final static QName _CheckACLOnAzureResponseCheckACLOnAzureResult_QNAME = new QName("http://tempuri.org/", "CheckACLOnAzureResult"); + private final static QName _GenerateLoadResponseGenerateLoadResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadResult"); + private final static QName _EchoStructResponseEchoStructResult_QNAME = new QName("http://tempuri.org/", "EchoStructResult"); + private final static QName _ServiceSideAsyncEchoResponseServiceSideAsyncEchoResult_QNAME = new QName("http://tempuri.org/", "ServiceSideAsyncEchoResult"); + private final static QName _TraceResponseTraceResult_QNAME = new QName("http://tempuri.org/", "TraceResult"); + private final static QName _SerializationTestStream_QNAME = new QName("http://tempuri.org/", "stream"); + 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 _EchoExceptionResponseEchoExceptionResult_QNAME = new QName("http://tempuri.org/", "EchoExceptionResult"); + private final static QName _RunInprocSoaJobResponseRunInprocSoaJobResult_QNAME = new QName("http://tempuri.org/", "RunInprocSoaJobResult"); + 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 _GenerateLoadWithInputFileInputDataPath_QNAME = new QName("http://tempuri.org/", "input_data_path"); + private final static QName _EchoWithFailResponseEchoWithFailResult_QNAME = new QName("http://tempuri.org/", "EchoWithFailResult"); + private final static QName _GenerateLoadWithResponseDataResponseGenerateLoadWithResponseDataResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithResponseDataResult"); + + /** + * 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 EchoAppSettings } + * + */ + public EchoAppSettings createEchoAppSettings() { + return new EchoAppSettings(); + } + + /** + * Create an instance of {@link EchoFaultWithNameResponse } + * + */ + public EchoFaultWithNameResponse createEchoFaultWithNameResponse() { + return new EchoFaultWithNameResponse(); + } + + /** + * 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 GetCommonDataResponse } + * + */ + public GetCommonDataResponse createGetCommonDataResponse() { + return new GetCommonDataResponse(); + } + + /** + * Create an instance of {@link ServiceSideAsyncEchoResponse } + * + */ + public ServiceSideAsyncEchoResponse createServiceSideAsyncEchoResponse() { + return new ServiceSideAsyncEchoResponse(); + } + + /** + * 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 EchoDoubleResponse } + * + */ + public EchoDoubleResponse createEchoDoubleResponse() { + return new EchoDoubleResponse(); + } + + /** + * Create an instance of {@link GenerateLoad } + * + */ + public GenerateLoad createGenerateLoad() { + return new GenerateLoad(); + } + + /** + * 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 EchoWithDelayOnSelectedNodeResponse } + * + */ + public EchoWithDelayOnSelectedNodeResponse createEchoWithDelayOnSelectedNodeResponse() { + return new EchoWithDelayOnSelectedNodeResponse(); + } + + /** + * Create an instance of {@link GenerateLoadWithResponseData } + * + */ + public GenerateLoadWithResponseData createGenerateLoadWithResponseData() { + return new GenerateLoadWithResponseData(); + } + + /** + * Create an instance of {@link RunInprocSoaJob } + * + */ + public RunInprocSoaJob createRunInprocSoaJob() { + return new RunInprocSoaJob(); + } + + /** + * 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 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 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 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 = "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 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 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 = "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 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 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 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 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 = "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 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 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 String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "common_data_path", scope = GenerateLoad.class) + public JAXBElement createGenerateLoadCommonDataPath(String value) { + return new JAXBElement(_GenerateLoadCommonDataPath_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(_GenerateLoadInputData_QNAME, byte[].class, GenerateLoad.class, ((byte[]) 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 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 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 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 = "type", scope = EchoObject3 .class) + public JAXBElement createEchoObject3Type(String value) { + return new JAXBElement(_EchoObject3Type_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(_EchoObject3O_QNAME, Object.class, EchoObject3 .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 String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "msg", scope = Trace.class) + public JAXBElement createTraceMsg(String value) { + return new JAXBElement(_TraceMsg_QNAME, String.class, Trace.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 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 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 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 String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "TraceResult", scope = TraceResponse.class) + public JAXBElement createTraceResponseTraceResult(String value) { + return new JAXBElement(_TraceResponseTraceResult_QNAME, String.class, TraceResponse.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 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 byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "input_data", scope = GenerateLoadWithResponseData.class) + public JAXBElement createGenerateLoadWithResponseDataInputData(byte[] value) { + return new JAXBElement(_GenerateLoadInputData_QNAME, byte[].class, GenerateLoadWithResponseData.class, ((byte[]) 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 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 String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "type", scope = EchoObject.class) + public JAXBElement createEchoObjectType(String value) { + return new JAXBElement(_EchoObject3Type_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(_EchoObject3O_QNAME, Object.class, EchoObject.class, 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 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 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 = GenerateLoadWithInputFile.class) + public JAXBElement createGenerateLoadWithInputFileCommonDataPath(String value) { + return new JAXBElement(_GenerateLoadCommonDataPath_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 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 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); + } + +} 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..90df2d8 --- /dev/null +++ b/test/TestService/org/tempuri/Trace.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="msg" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "msg" +}) +@XmlRootElement(name = "Trace") +public class Trace { + + @XmlElementRef(name = "msg", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement msg; + + /** + * Gets the value of the msg property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getMsg() { + return msg; + } + + /** + * Sets the value of the msg property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setMsg(JAXBElement value) { + this.msg = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/TraceResponse.java b/test/TestService/org/tempuri/TraceResponse.java new file mode 100644 index 0000000..fb7aa5f --- /dev/null +++ b/test/TestService/org/tempuri/TraceResponse.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="TraceResult" type="{http://www.w3.org/2001/XMLSchema}string" 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 String }{@code >} + * + */ + public JAXBElement getTraceResult() { + return traceResult; + } + + /** + * Sets the value of the traceResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setTraceResult(JAXBElement value) { + this.traceResult = ((JAXBElement ) value); + } + +} diff --git a/test/TestService/org/tempuri/Utility.java b/test/TestService/org/tempuri/Utility.java new file mode 100644 index 0000000..a67d703 --- /dev/null +++ b/test/TestService/org/tempuri/Utility.java @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------- +// +// 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 javax.xml.bind.JAXBElement; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; + +import com.microsoft.hpc.aitestsvclib.session.RetryOperationError; + +class Utility { + private static com.microsoft.schemas._2003._10.serialization.ObjectFactory fact + = new com.microsoft.schemas._2003._10.serialization.ObjectFactory(); + + 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; + } +} 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..2b13a22 --- /dev/null +++ b/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd @@ -0,0 +1,21 @@ + + + + + + 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..9d6ec18 --- /dev/null +++ b/test/TestService/services.xsd @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..2b63cb8 --- /dev/null +++ b/test/TestService/tempuri.org.wsdl @@ -0,0 +1,681 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestService/tempuri.org.xsd b/test/TestService/tempuri.org.xsd new file mode 100644 index 0000000..ce2a636 --- /dev/null +++ b/test/TestService/tempuri.org.xsd @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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/test/build.xml b/test/build.xml new file mode 100644 index 0000000..9b49554 --- /dev/null +++ b/test/build.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/buildtests.cmd b/test/buildtests.cmd new file mode 100644 index 0000000..753da1c --- /dev/null +++ b/test/buildtests.cmd @@ -0,0 +1,13 @@ + @echo off + 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;AITestLibService.jar;..\..\SOA\src + + rd /s /q bin + md bin + echo Compiling + %javac% -sourcepath functiontest\*.java -d bin + %javac% fullpass\Full.java -d bin + echo Done + + \ No newline at end of file diff --git a/test/buildtests.sh b/test/buildtests.sh new file mode 100644 index 0000000..e68b696 --- /dev/null +++ b/test/buildtests.sh @@ -0,0 +1,13 @@ +#!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:./AITestLibService.jar:../../SOA/src + +rm -rf bin +mkdir bin + +echo Compiling +find ./functiontest -name *.java -print | xargs javac -d ./bin -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" + +find ./fullpass -name *.java -print | xargs javac -d ./bin -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" +echo Done + diff --git a/test/fullpass/Full.java b/test/fullpass/Full.java new file mode 100644 index 0000000..cff7d99 --- /dev/null +++ b/test/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/functiontest/BVT.java b/test/functiontest/BVT.java new file mode 100644 index 0000000..0428677 --- /dev/null +++ b/test/functiontest/BVT.java @@ -0,0 +1,1442 @@ +/** + * + */ +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()); + } + + SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, + sessionId, config.UserName, config.Password); + + try { + session = Session.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); + // 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 (session != null) { + try { + session.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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + 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/functiontest/BrokerClientTest.java b/test/functiontest/BrokerClientTest.java new file mode 100644 index 0000000..9c32335 --- /dev/null +++ b/test/functiontest/BrokerClientTest.java @@ -0,0 +1,2440 @@ +/** + * + */ +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); + + logger.Start("BrokerClientTest"); + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + if (dClient != null) + dClient.close(true); + + if (iClient != null) + iClient.close(true); + + logger.End("BrokerClientTest"); + } + + /** + * 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() { + 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 : %s", e.getMessage()); + } catch (Throwable e) { + logger.Error("UE : %s", e.getMessage()); + } + + 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 : %s", e.getMessage()); + } catch (Throwable e) { + logger.Error("UE : %s", e.getMessage()); + } + + } + + /** + * 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() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } + } + + } + + /** + * 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() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(null); + logger.Error("Excetion is expected. d null"); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(1); + logger.Error("Excetion is expected. i int"); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(true); + logger.Error("Excetion is expected. i boolean "); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object)} + * . + */ + @Test + public final void testSendRequestObjectObject() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + try { + iClient.sendRequest(null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(null, "datat"); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(new Object(), 1); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(new Object(), "data"); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + // 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()); e.printStackTrace(); } + * + * try { iClient.sendRequest(request, request); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + * + * try { dClient.sendRequest(request, true); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + } + + /** + * 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() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); e.printStackTrace(); } + * + * try { dClient.sendRequest(request, "datat", ""); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + try { + iClient.sendRequest(request, 1, null); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + /* + * try { dClient.sendRequest(request, "datat", "&^(&^%$#{}?_?#@*"); + * logger.Error("Excetion is expected."); } catch (SessionException e) { + * logger.Info("Expected exception when sending requests %s", + * e.toString()); e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class)} + * . + */ + @Test + public final void testGetResponses() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (NullPointerException e) { + logger.Info("Expected excpetion when getting responses %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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() { + + // 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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", + e.toString()); + e.printStackTrace(); + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * 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() { + + // boundary + // when the responsehandler is null + Echo request = Util.generateEchoRequest(); + + try { + iClient.setResponseHandler(EchoResponse.class, null); + logger.Error("EE is not thrown."); + } catch (NullPointerException e) { + logger.Info("NullPointerException is expected."); + e.printStackTrace(); + } + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(3000); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } // BUG this cannot throw InvalidOperationException + + // boundary + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} + * . + */ + @Test + public final void testEndRequestsInt_1() { + // functional + Echo request = Util.generateEchoRequest(); + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(0); + } catch (Throwable e) { + logger.Error("UE for 0 timeout %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + } + + @Test + public final void testEndRequestsInt_0() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(-1); + logger.Error("EE is not thrown. -1"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(Integer.MIN_VALUE); + logger.Error("EE is not thrown. min"); + } catch (Throwable e) { + logger.Info("Expected Exception %s", e.toString()); + e.printStackTrace(); + } + + /* + * 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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test + public final void testFlush() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test(timeout = 180000) + public final void testFlush_1() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } + } + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(); // BUG flush should throw SessionException or + // InvalidOperationException + dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. + */ + @Test(timeout = 180000) + public final void testFlush_Bug1() { + + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(); + //dClient.endRequests(); + } catch (Throwable e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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 %s", + e.toString()); + + } + }); + + 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()); + * e.printStackTrace(); } + */ + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush(int)}. + */ + @Test + public final void testFlushInt() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(3000); // BUG flush should throw SessionException or + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + + try { + dClient.flush(-1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(1); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.flush(0); + logger.Error("Expected exception is not thrown"); + + } catch (Throwable e) { + logger.Info("Excpetion when flushing requests %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests() { + + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.endRequests(); // BUG this cannot throw + // InvalidOperationException + } catch (Throwable e) { + logger.Error("Excpetion when end requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. + */ + @Test + public final void testEndRequests_1() { + + // boundary + Echo request = Util.generateEchoRequest(); + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when end requests %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close()}. + */ + @Test + public final void testClose() { + // functional + // bug 11821 + + try { + dClient.close(); + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean)} + * . + */ + @Test + public final void testCloseBoolean() { + // functional + // bug 11821 + + try { + dClient.close(true); + } catch (IllegalStateException e) { + logger.Info("IllegalStateException is thrown. %s", e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + // 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + // functional + + try { + dClient.close(false, 5000); + dClient = null; + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt_1() { + // boundary + // bug 11821 + + try { + dClient.close(false, -1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } + + + + try { + dClient.close(true, 1); + logger.Error("EException is not thrown"); + } catch (Throwable e) { + logger.Info("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.close(true, 0); + + } catch (Throwable e) { + logger.Error("Excpetion when close the client %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, int)} + * . + */ + @Test + public final void testSendRequestObjectObjectInt() { + Echo request = Util.generateEchoRequest(); + // function + try { + iClient.sendRequest(request, 1, 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, 1, -5000); + logger.Error("Excetion is expected."); + } catch (SessionException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + try { + iClient.sendRequest(request, null, 1); + logger.Error("Excetion is expected."); + } catch (NullPointerException e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Info("Expected exception when sending requests %s", + e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo", + 5000); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + dClient.sendRequest(request, "data", + "http://tempuri.org/IEchoSvc/Echo", 0); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + // boundary + } + + + /** + * Test method for GetRequestCount + */ + @Test + public final void testGetRequestCount() { + + 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 %s", ex.toString()); + + } + + } + + 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 %s",e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown %s",e.toString()); + e.printStackTrace(); + } + + + + + + } + + /** + * Test method for GetStatus + */ + @Test + public final void testGetStatus() { + + 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 %s", ex.toString()); + + } + + } + + 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 %s",e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("UE is thrown %s",e.toString()); + e.printStackTrace(); + } + + + + + + } + + /** + * 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 + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt() { + // functional + Echo request = Util.generateEchoRequest(); + + try { + dClient.sendRequest(request, "data"); + dClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} + * . + */ + @Test + public void testGetResponsesInt_E1() { + // functional + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Exception in getResponse %s", e.toString()); + e.printStackTrace(); + } + } catch (SessionException e) { + logger.Error("Excpetion when getting responses %s", e.toString()); + e.printStackTrace(); + } + + // 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + 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()); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when getting responses %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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()); + e.printStackTrace(); + l.countDown(); + } + + }, 15000); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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", + e.toString()); + e.printStackTrace(); + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * 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 + + 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 %s", + e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", + e.toString()); + e.printStackTrace(); + } + 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"); + e.printStackTrace(); + l.countDown(); + return; + } + } + logger.Error("Error in process request %s raised error", + e.toString()); + e.printStackTrace(); + l.countDown(); + return; + + } + + }, 5); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(2, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObject() { + + // functional + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt() { + // functional + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }, 5000); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} + * . + */ + @Test + public void testSetResponseHandlerResponseListenerOfObjectInt_E1() { + // boundary + + 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 %s", e.toString()); + e.printStackTrace(); + } catch (SOAPException e) { + logger.Error("Error in process request %s", e.toString()); + e.printStackTrace(); + } + 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", e.toString()); + e.printStackTrace(); + } + + }, 0); + + try { + iClient.sendRequest(request, "data"); + iClient.endRequests(); + } catch (SessionException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Excpetion when sending requests %s", e.toString()); + e.printStackTrace(); + } + + try { + l.await(10, TimeUnit.MINUTES); + } catch (InterruptedException e1) { + logger.Error("Excpetion when awaiting latch %s", e1.toString()); + e1.printStackTrace(); + } + + } + + 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/functiontest/BrokerResponseTest.java b/test/functiontest/BrokerResponseTest.java new file mode 100644 index 0000000..cd6bbd1 --- /dev/null +++ b/test/functiontest/BrokerResponseTest.java @@ -0,0 +1,182 @@ +/** + * + */ +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 { + logger.Start("BrokerResponseTest"); + + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("BrokerResponseTest"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getMessage()}. + */ + @Test + public final void testGetMessage() { + logger.Info(iResponse.getMessage().toString()); + logger.Info(iResponse.getMessage().getContentDescription()); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getResult()}. + */ + @Test + public final void testGetResult() { + 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.printStackTrace(); + } catch (SOAPException e) { + logger.Error("response getresult error"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SOAPException e) { + logger.Error("response getresult error"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getUserData()}. + */ + @Test + public final void testGetUserData() { + + logger.assertEqual("get user data", iResponse.getUserData(), "1"); + logger.assertEqual("get user data", dResponse.getUserData(), "2"); + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getSOAPMessage(java.lang.Object)} + * . + */ + @Test + public final void testGetSOAPMessage() { + + logger.Info(iResponse.getMessage().toString()); + // it is not public, do not test it here + } + + 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/functiontest/CommonDataBytes.java b/test/functiontest/CommonDataBytes.java new file mode 100644 index 0000000..977c4ec --- /dev/null +++ b/test/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/functiontest/CommonDataHelper.java b/test/functiontest/CommonDataHelper.java new file mode 100644 index 0000000..648f0f1 --- /dev/null +++ b/test/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/functiontest/CommonDataTestActionId.java b/test/functiontest/CommonDataTestActionId.java new file mode 100644 index 0000000..972b972 --- /dev/null +++ b/test/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/functiontest/CommonDataTestDurable.java b/test/functiontest/CommonDataTestDurable.java new file mode 100644 index 0000000..5cbc308 --- /dev/null +++ b/test/functiontest/CommonDataTestDurable.java @@ -0,0 +1,295 @@ +/** + * + */ +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("CommonDataTest"); + logger = new Logger(true, true, "DataClientTest"); + 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 { + logger.Start("CommonDataTest"); + } + + /** + * @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 + } + } + logger.End("CommonDataTest"); + } + + @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 { + 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); + } + } + + @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 { + 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); + + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + private static Config config; + private static Logger logger; + private static int[] dataSizeToCheck; +} diff --git a/test/functiontest/CommonDataTestInteractive.java b/test/functiontest/CommonDataTestInteractive.java new file mode 100644 index 0000000..9ec1ae7 --- /dev/null +++ b/test/functiontest/CommonDataTestInteractive.java @@ -0,0 +1,295 @@ +/** + * + */ +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("CommonDataTest"); + logger = new Logger(true, true, "DataClientTest"); + 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 { + logger.Start("CommonDataTest"); + } + + /** + * @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 + } + } + logger.End("CommonDataTest"); + } + + @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 { + 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); + } + } + + @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 { + 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); + + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + @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 { + 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); + } + } + + private static Config config; + private static Logger logger; + private static int[] dataSizeToCheck; +} diff --git a/test/functiontest/Config.java b/test/functiontest/Config.java new file mode 100644 index 0000000..249f308 --- /dev/null +++ b/test/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 = "fareast\\wsdcta"; + public String Password = "Pa55word##3"; + public String UserName2 = "fareast\\wsdcta2"; + public String Password2 = "Pa55word##3"; + + 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("bin/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/functiontest/DataClientHelper.java b/test/functiontest/DataClientHelper.java new file mode 100644 index 0000000..e8e5a49 --- /dev/null +++ b/test/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/functiontest/DataClientTest.java b/test/functiontest/DataClientTest.java new file mode 100644 index 0000000..41a61b0 --- /dev/null +++ b/test/functiontest/DataClientTest.java @@ -0,0 +1,1381 @@ +/** + * + */ +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("CommonDataTest"); + 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 { + logger.Start("DataClientTest"); + } + + /** + * @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(); + logger.End("DataClientTest"); + } + + @Test(timeout = 600000) + // headnode=NULL + public final void DataClient_API_Create_1() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // headnode=string.Empty + public final void DataClient_API_Create_2() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // headnode is not existed + public final void DataClient_API_Create_3() throws DataException { + 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()); + } + } + + // @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 { + 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()); + } + } + + @Test(timeout = 600000) + // dataClientId=string.Empty + public final void DataClient_API_Create_6() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // valid dataClientId", + public final void DataClient_API_Create_7() { + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Create - invalid dataClientId + public final void DataClient_API_Create_8() { + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Create - username=NULL + public final void DataClient_API_Create_9() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - username is empty + public final void DataClient_API_Create_10() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - password=NULL + public final void DataClient_API_Create_11() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - password is empty + public final void DataClient_API_Create_12() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Create - create two DataClient with the same name + public final void DataClient_API_Create_13() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - object is NULL + public final void DataClient_API_WriteRaw_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - call WriteAll twice + public final void DataClient_API_WriteRaw_2() throws DataException { + 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(); + } + + + @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 { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read before write + public final void DataClient_API_ReadRaw_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Multiple read + public final void DataClient_API_ReadRaw_2() throws IllegalStateException, + DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_4() throws DataException { + 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()); + + } + + } + + + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read after deleted + public final void DataClient_API_ReadRaw_6() throws DataException { + 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()); + } + + } + + @Test(timeout = 600000) + // DataClient.ReadRawBytesAll - Read raw from write raw could be + // serializable + public final void DataClient_API_ReadRaw_7() throws IOException, + DataException, ClassNotFoundException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_8() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Could not write empty byte + public void DataClient_API_WriteRaw_9() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll - Unauthorized write + public void DataClient_API_WriteRaw_10() throws DataException { + 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); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=NULL + public final void DataClient_API_Open_1() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode=string.Empty + public final void DataClient_API_Open_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - headnode is not existed + public final void DataClient_API_Open_3() throws DataException { + 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(); + } + + // 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 { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - dataClientId=string.Empty + public final void DataClient_API_Open_6() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - valid dataClientId + public final void DataClient_API_Open_7() throws DataException { + 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(); + + } + + @Test(timeout = 600000) + // DataClient.Open - invalid dataClientId + public void DataClient_API_Open_8() { + + 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()); + } + } + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which does not exist + public final void DataClient_API_Open_9() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - multiple Open and Read + public final void DataClient_API_Open_10() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.Open - Open dataClient which has been closed + public final void DataClient_API_Open_11() throws DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Open - Opened dataClient is read only + public final void DataClient_API_Open_12() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server unreachable + public final void DataClient_SOADataServer_1() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - data server is empty + public final void DataClient_SOADataServer_2() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - multiple data server path + public final void DataClient_SOADataServer_3() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path + public void DataClient_SOADataServer_4() throws IOException { + 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); + } + + @Test(timeout = 600000) + // CCP_SOADATASERVER - Invalid data server path - local path + public final void DataClient_SOADataServer_5() throws IOException { + 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); + } + + + @Test(timeout = 600000) + // DataClient.Delete - Unauthorized delete + public final void DataClient_API_Delete_3() throws IOException, + DataException { + 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()); + } + } + + @Test(timeout = 600000) + // DataClient.Delete - Authorized delete + public final void DataClient_API_Delete_4() throws IOException, + DataException { + 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()); + } + } + + 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 { + // 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(); + + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress + public final void DataClient_API_WriteCompress_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.WriteRawBytesAll not in compress (by default)", + public final void DataClient_API_WriteCompress_3() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - no data written + public final void DataClient_API_FilePath_1() throws DataException { + DataClient dataClient = DataClientHelper.Create(); + String filePath = dataClient.getStorePath(); + logger.Info("The data file path is %s", filePath); + + DataClientHelper.Delete(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data deleted + public final void DataClient_API_FilePath_2() throws DataException { + 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(); + } + + @Test(timeout = 600000) + // DataClient.GetFilePath - data could be read by simple file solution + public final void DataClient_API_FilePath_3() throws IOException, + DataException, ClassNotFoundException { + 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(); + } + + @Test(timeout = 600000) + // DataSecurity - Unauthorized read (by default) + public final void DataClient_API_DataSecurity_2() throws DataException { + 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); + + } + + @Test(timeout = 600000) + // DataSecurity - Authorized read for another user + public final void DataClient_API_DataSecurity_4() throws DataException, + SocketTimeoutException, SessionException, + DatatypeConfigurationException { + 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); + } + + @Test(timeout = 600000) + // Concurrency write + public final void DataClient_Concurrency_1() throws InterruptedException, + BrokenBarrierException, DataException { + 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(); + } + + @Test(timeout = 600000) + // Concurrency read and close + public final void DataClient_Concurrency_2() throws InterruptedException, + BrokenBarrierException { + DataClient_Concurrency_2_Helper(CommonDataHelper.defaultDataClientId, + false, 100); + } + + 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 { + 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(); + } + + 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/functiontest/DurableSessionTest.java b/test/functiontest/DurableSessionTest.java new file mode 100644 index 0000000..6928307 --- /dev/null +++ b/test/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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } + + // 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"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SocketTimeoutException was thrown"); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SessionException was thrown"); + } + + SessionStartInfo info2 = new SessionStartInfo(config.Scheduler, + config.ServiceName); + + try { + dSession = DurableSession.createSession(info2); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SocketTimeoutException was thrown"); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + logger.Error("SessionException was thrown"); + } finally { + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info, 0); + + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached = DurableSession.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("SessionException when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (NullPointerException e1) { + logger.Info("NullPointerException when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getClientVersion(); + logger.assertEqual("DurableSession clientVersion major", v.getMajor(), + 3); + logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), + 2); + + // boundary + try { + dSession.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + Version v = dSession.getServerVersion(); + logger.Info(v.toString()); + logger.assertEqual("DurableSession serverVersion major", v.getMajor(), + 3); + 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 + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + if (dSession == null) { + logger.Error("creating dSession failed"); + return; + } + + try { + dSession.close(); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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 %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); + 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 %s", ex.toString()); + + } + + } + 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 %s", e1.toString()); + e1.printStackTrace(); + } + + 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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + session.close(); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // boundary + + dSession = null; + try { + dSession = DurableSession.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(true, 1); + logger.Error("EE is not thrown"); + } catch (SessionException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Info("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(true, Integer.MIN_VALUE); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a durable session"); + e.printStackTrace(); + } + + try { + dSession.close(false, Integer.MAX_VALUE); + } catch (SessionException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } + + // 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.printStackTrace(); + } + + } + + // 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Info("SessionException is thrown"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + try { + versions = DurableSession.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException is thrown"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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/functiontest/GenericServiceTest.java b/test/functiontest/GenericServiceTest.java new file mode 100644 index 0000000..093a73e --- /dev/null +++ b/test/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 %s", ex.toString()); + ex.printStackTrace(); + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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. %s", ee.toString()); + ee.printStackTrace(); + } + catch (Throwable ee) { + logger.Error("Error in process request %s", ee.toString()); + ee.printStackTrace(); + + } + + } + logger.Info("Done retrieving responses"); + client.close(); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + logger.End("test_DurableGenericService"); + + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/Logger.java b/test/functiontest/Logger.java new file mode 100644 index 0000000..0ac6c1e --- /dev/null +++ b/test/functiontest/Logger.java @@ -0,0 +1,233 @@ +/** + * + */ +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) { + 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 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(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) { + + 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/functiontest/SessionAttachInfoTest.java b/test/functiontest/SessionAttachInfoTest.java new file mode 100644 index 0000000..cf31ebf --- /dev/null +++ b/test/functiontest/SessionAttachInfoTest.java @@ -0,0 +1,172 @@ +/** + * + */ +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 { + logger.Start("SessionAttachInfoTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionAttachInfoTest"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int)} + * . + */ + @Test + public final void testSessionAttachInfoStringInt() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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 %s", e.toString()); + e.printStackTrace(); + } + + DurableSession dSession_attached = null; + try { + dSession_attached = DurableSession.attachSession(attachInfo); + } catch (SessionException e1) { + logger.Error("SessionException when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Exception when attaching a durable session"); + e1.printStackTrace(); + } + + // 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"); + e1.printStackTrace(); + } catch (Exception e1) { + logger.Error("Invalid sessionAttachInfo when attaching a durable session"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + 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"); + e1.printStackTrace(); + } + + } + + private static Session iSession = null; + private static DurableSession dSession = null; + + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/SessionBaseTest.java b/test/functiontest/SessionBaseTest.java new file mode 100644 index 0000000..a36e620 --- /dev/null +++ b/test/functiontest/SessionBaseTest.java @@ -0,0 +1,452 @@ +/** + * + */ +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 { + logger.Start("SessionBaseTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionBaseTest"); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. + */ + @Test + public final void testGetId() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} + * . + */ + @Test + public final void testGetEndpointReference() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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(), "3.2"); + /* logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); + + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + sb = Session.createSession(info); + logger.assertEqual("client version", sb.getClientVersion() + .toString(), "3.2"); + /*logger.assertEqual("server version", sb.getServerVersion() + .toString(), "3.2"); +*/ + logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); + + sb.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(false); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} + * . + */ + @Test + public final void testCloseBooleanInt() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(true, 5000); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info); + session.close(true, 0); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(false, -1000); + logger.Error("EE is not thrown"); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(true, 1); + logger.Error("EE is not thrown 1"); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Error("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(true, Integer.MAX_VALUE); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("IllegalArgumentException when creating a durable session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testGetServiceVersions() { + + 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.printStackTrace(); + } + + // 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.printStackTrace(); + } + + } + + // 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("UE is thrown"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + try { + versions = SessionBase.GetServiceVersions(config.Scheduler, "", + config.UserName, config.Password); + logger.Error("EE is not thrown"); + } catch (IllegalArgumentException e) { + logger.Info("SessionException is thrown"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("SessionException is thrown"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } + + } + + /** + * Test method for NoServiceVersion + */ + @Test + public final void testNoServiceVersion() { + logger.assertEqual("noServiceVersion", SessionBase.NoServiceVersion, new Version(0,0)); + + } + + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/SessionPool.java b/test/functiontest/SessionPool.java new file mode 100644 index 0000000..7e3c1a2 --- /dev/null +++ b/test/functiontest/SessionPool.java @@ -0,0 +1,593 @@ +/** + * + */ +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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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 %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); + logger.assertTrue("check response", + reply.getRefID() == refId); + } catch (Throwable ex) { + logger.Error("Error in process request %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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 %s%n%s", e.toString(), + e.getStackTrace()); + } + + 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 %s", ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(true); + + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + + if (session != null) { + try { + session.close(false); //needed to keep the session in the pool + } catch (Throwable e1) { + logger.Error("Exception is thrown %s", e1.toString()); + e1.printStackTrace(); + } + } + + 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 %s", + ex.toString()); + + } + + } + logger.Info("Done retrieving %d responses", config.NbOfCalls); + client.close(); + } + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + 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: %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + } + logger.Info("Client %s calling endRequests()...", m + "_" + + k); + try { + client.endRequests(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + 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 %s", + ex.toString()); + + } + + } + } catch (SessionException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + logger.Info("Done retrieving %d responses", + config.NbOfCalls); + try { + client.close(true); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + 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 %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(false); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + logger.End("test_SessionPool_InteractiveConcurrentMultipleBatches"); + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/SessionStartInfoTest.java b/test/functiontest/SessionStartInfoTest.java new file mode 100644 index 0000000..0ba1979 --- /dev/null +++ b/test/functiontest/SessionStartInfoTest.java @@ -0,0 +1,502 @@ +/** + * + */ +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 { + logger.Start("SessionStartInfoTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionStartInfoTest"); + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + //should check the session created. + if (session !=null) { + try { + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + } + + + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + + + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String)} + * . + */ + @Test + public final void testSessionStartInfoStringString() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + + } + + /** + * 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() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString() { + 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.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_noVersion() { + 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.printStackTrace(); + } + 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + /** + * Test method for + * + */ + @Test + public final void testSessionStartInfoStringStringVersionStringString_Er() { + 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.printStackTrace(); + } catch (SessionException e) { + logger.Info("Session exception when creating a session"); + e.printStackTrace(); + } + + if (session != null) { + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + } + } + + + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/SessionTest.java b/test/functiontest/SessionTest.java new file mode 100644 index 0000000..0c6af03 --- /dev/null +++ b/test/functiontest/SessionTest.java @@ -0,0 +1,497 @@ +/** + * + */ +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("DurableSessionTest"); + logger = new Logger(true, true, "DurableSessionTest"); + + 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 { + logger.Start("SessionTest"); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + logger.End("SessionTest"); + } + + /** + * 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.Info(iSession.getAutoCloseJob().toString()); // BUG what's this + // for? + + } + + + /** + * 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.Info(iSession.httpEndpointReference()); + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} + * . + */ + @Test + public final void testCreateSessionSessionStartInfo() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } + + // boundary + try { + session = Session.createSession(null); + logger.Error("EException is not thrown."); + } catch (Throwable e) { + logger.Info("Timeout when creating a durable session"); + e.printStackTrace(); + } + + 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"); + e.printStackTrace(); + } + + // more boundary test case for invalid startInfo would be included in + // SessionStartInfo test + + } + + /** + * 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() { + + // 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() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("SessionException when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, Integer.MAX_VALUE); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, 0); + session.close(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info, -1); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, 1); + logger.Error("EException is not thrown."); + } catch (SocketTimeoutException e) { + logger.Info("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + try { + session = Session.createSession(info, Integer.MIN_VALUE); + logger.Error("EException is not thrown."); + } catch (IllegalArgumentException e) { + logger.Info("IllegalArgumentException when creating a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfo() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a session"); + e1.printStackTrace(); + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + } + + /** + * Test method for + * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} + * . + */ + @Test + public final void testAttachSessionSessionAttachInfoInt() { + // 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.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session_attached = Session.attachSession(attachInfo, 0); + } catch (SessionException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Error("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + try { + session_attached.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + // boundary + + try { + session = Session.createSession(info); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when creating a durable session"); + e.printStackTrace(); + } catch (SessionException e) { + logger.Error("Session exception when creating a durable session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a session"); + e.printStackTrace(); + } + + 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.printStackTrace(); + } catch (SocketTimeoutException e1) { + logger.Info("Timeout when attaching a durable session"); + e1.printStackTrace(); + } + + 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.printStackTrace(); + } catch (Throwable e) { + logger.Error("UE when creating a session"); + e.printStackTrace(); + } + + try { + session.close(); + } catch (SessionException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("Timeout when closing a durable session"); + e.printStackTrace(); + } + + } + + private static Session iSession = null; + private static Config config; + private static Logger logger; + +} diff --git a/test/functiontest/Util.java b/test/functiontest/Util.java new file mode 100644 index 0000000..096884e --- /dev/null +++ b/test/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/org/tempuri/CcpEchoSvc.java b/test/org/tempuri/CcpEchoSvc.java new file mode 100644 index 0000000..20ac8b3 --- /dev/null +++ b/test/org/tempuri/CcpEchoSvc.java @@ -0,0 +1,77 @@ + +/* + * + */ + +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.1 + * Tue Dec 28 11:00:17 GMT+08:00 2010 + * Generated source version: 2.3.1 + * + */ + + +@WebServiceClient(name = "CcpEchoSvc", + wsdlLocation = "file:tempuri.org.wsdl", + targetNamespace = "http://tempuri.org/") +public class CcpEchoSvc extends Service { + + public final static URL WSDL_LOCATION; + public final static QName SERVICE = new QName("http://tempuri.org/", "CcpEchoSvc"); + public final static QName DefaultBindingIEchoSvc = new QName("http://tempuri.org/", "DefaultBinding_IEchoSvc"); + 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 CcpEchoSvc(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public CcpEchoSvc(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public CcpEchoSvc() { + super(WSDL_LOCATION, SERVICE); + } + + /** + * + * @return + * returns IEchoSvc + */ + @WebEndpoint(name = "DefaultBinding_IEchoSvc") + public IEchoSvc getDefaultBindingIEchoSvc() { + return super.getPort(DefaultBindingIEchoSvc, IEchoSvc.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 IEchoSvc + */ + @WebEndpoint(name = "DefaultBinding_IEchoSvc") + public IEchoSvc getDefaultBindingIEchoSvc(WebServiceFeature... features) { + return super.getPort(DefaultBindingIEchoSvc, IEchoSvc.class, features); + } + +} diff --git a/test/org/tempuri/Echo.java b/test/org/tempuri/Echo.java new file mode 100644 index 0000000..e92344e --- /dev/null +++ b/test/org/tempuri/Echo.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="input" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "input" +}) +@XmlRootElement(name = "Echo") +public class Echo { + + @XmlElementRef(name = "input", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement input; + + /** + * Gets the value of the input property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getInput() { + return input; + } + + /** + * Sets the value of the input property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setInput(JAXBElement value) { + this.input = ((JAXBElement ) value); + } + +} diff --git a/test/org/tempuri/EchoResponse.java b/test/org/tempuri/EchoResponse.java new file mode 100644 index 0000000..b54219c --- /dev/null +++ b/test/org/tempuri/EchoResponse.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="EchoResult" type="{http://www.w3.org/2001/XMLSchema}string" 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 String }{@code >} + * + */ + public JAXBElement getEchoResult() { + return echoResult; + } + + /** + * Sets the value of the echoResult property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setEchoResult(JAXBElement value) { + this.echoResult = ((JAXBElement ) value); + } + +} diff --git a/test/org/tempuri/GenerateLoad.java b/test/org/tempuri/GenerateLoad.java new file mode 100644 index 0000000..fd6115c --- /dev/null +++ b/test/org/tempuri/GenerateLoad.java @@ -0,0 +1,120 @@ + +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="runMilliSeconds" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
+ *         <element name="dummyData" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
+ *         <element name="fileData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "runMilliSeconds", + "dummyData", + "fileData" +}) +@XmlRootElement(name = "GenerateLoad") +public class GenerateLoad { + + protected Double runMilliSeconds; + @XmlElementRef(name = "dummyData", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement dummyData; + @XmlElementRef(name = "fileData", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) + protected JAXBElement fileData; + + /** + * Gets the value of the runMilliSeconds property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getRunMilliSeconds() { + return runMilliSeconds; + } + + /** + * Sets the value of the runMilliSeconds property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setRunMilliSeconds(Double value) { + this.runMilliSeconds = value; + } + + /** + * Gets the value of the dummyData property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public JAXBElement getDummyData() { + return dummyData; + } + + /** + * Sets the value of the dummyData property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * + */ + public void setDummyData(JAXBElement value) { + this.dummyData = ((JAXBElement ) value); + } + + /** + * Gets the value of the fileData property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getFileData() { + return fileData; + } + + /** + * Sets the value of the fileData property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setFileData(JAXBElement value) { + this.fileData = ((JAXBElement ) value); + } + +} diff --git a/test/org/tempuri/GenerateLoadResponse.java b/test/org/tempuri/GenerateLoadResponse.java new file mode 100644 index 0000000..e765b3e --- /dev/null +++ b/test/org/tempuri/GenerateLoadResponse.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="GenerateLoadResult" type="{http://schemas.datacontract.org/2004/07/EchoSvcLib}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/org/tempuri/IEchoSvc.java b/test/org/tempuri/IEchoSvc.java new file mode 100644 index 0000000..ae9a94c --- /dev/null +++ b/test/org/tempuri/IEchoSvc.java @@ -0,0 +1,45 @@ +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.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * This class was generated by Apache CXF 2.3.1 + * Tue Dec 28 11:00:17 GMT+08:00 2010 + * Generated source version: 2.3.1 + * + */ + +@WebService(targetNamespace = "http://tempuri.org/", name = "IEchoSvc") +public interface IEchoSvc { + + @WebResult(name = "GenerateLoadResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/IEchoSvc/GenerateLoad", output = "http://tempuri.org/IEchoSvc/GenerateLoadResponse") + @RequestWrapper(localName = "GenerateLoad", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoad") + @WebMethod(operationName = "GenerateLoad", action = "http://tempuri.org/IEchoSvc/GenerateLoad") + @ResponseWrapper(localName = "GenerateLoadResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadResponse") + public StatisticInfo generateLoad( + @WebParam(name = "runMilliSeconds", targetNamespace = "http://tempuri.org/") + java.lang.Double runMilliSeconds, + @WebParam(name = "dummyData", targetNamespace = "http://tempuri.org/") + byte[] dummyData, + @WebParam(name = "fileData", targetNamespace = "http://tempuri.org/") + java.lang.String fileData + ); + + @WebResult(name = "EchoResult", targetNamespace = "http://tempuri.org/") + @Action(input = "http://tempuri.org/IEchoSvc/Echo", output = "http://tempuri.org/IEchoSvc/EchoResponse") + @RequestWrapper(localName = "Echo", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Echo") + @WebMethod(operationName = "Echo", action = "http://tempuri.org/IEchoSvc/Echo") + @ResponseWrapper(localName = "EchoResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoResponse") + public java.lang.String echo( + @WebParam(name = "input", targetNamespace = "http://tempuri.org/") + java.lang.String input + ); +} diff --git a/test/org/tempuri/ObjectFactory.java b/test/org/tempuri/ObjectFactory.java new file mode 100644 index 0000000..a518424 --- /dev/null +++ b/test/org/tempuri/ObjectFactory.java @@ -0,0 +1,117 @@ + +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; + + +/** + * 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 _EchoResponseEchoResult_QNAME = new QName("http://tempuri.org/", "EchoResult"); + private final static QName _EchoInput_QNAME = new QName("http://tempuri.org/", "input"); + private final static QName _GenerateLoadDummyData_QNAME = new QName("http://tempuri.org/", "dummyData"); + private final static QName _GenerateLoadFileData_QNAME = new QName("http://tempuri.org/", "fileData"); + private final static QName _GenerateLoadResponseGenerateLoadResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadResult"); + + /** + * 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 Echo } + * + */ + public Echo createEcho() { + return new Echo(); + } + + /** + * Create an instance of {@link GenerateLoadResponse } + * + */ + public GenerateLoadResponse createGenerateLoadResponse() { + return new GenerateLoadResponse(); + } + + /** + * Create an instance of {@link GenerateLoad } + * + */ + public GenerateLoad createGenerateLoad() { + return new GenerateLoad(); + } + + /** + * Create an instance of {@link EchoResponse } + * + */ + public EchoResponse createEchoResponse() { + return new EchoResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoResult", scope = EchoResponse.class) + public JAXBElement createEchoResponseEchoResult(String value) { + return new JAXBElement(_EchoResponseEchoResult_QNAME, String.class, EchoResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "input", scope = Echo.class) + public JAXBElement createEchoInput(String value) { + return new JAXBElement(_EchoInput_QNAME, String.class, Echo.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "dummyData", scope = GenerateLoad.class) + public JAXBElement createGenerateLoadDummyData(byte[] value) { + return new JAXBElement(_GenerateLoadDummyData_QNAME, byte[].class, GenerateLoad.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://tempuri.org/", name = "fileData", scope = GenerateLoad.class) + public JAXBElement createGenerateLoadFileData(String value) { + return new JAXBElement(_GenerateLoadFileData_QNAME, String.class, GenerateLoad.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); + } + +} diff --git a/test/org/tempuri/StatisticInfo.java b/test/org/tempuri/StatisticInfo.java new file mode 100644 index 0000000..9fa89af --- /dev/null +++ b/test/org/tempuri/StatisticInfo.java @@ -0,0 +1,121 @@ +/** + * + */ +package org.tempuri; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +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="startTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ *         <element name="taskId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "StatisticInfo", propOrder = { + "endTime", + "startTime", + "taskId" +}) +public class StatisticInfo { + + @XmlSchemaType(name = "dateTime") + protected XMLGregorianCalendar endTime; + @XmlSchemaType(name = "dateTime") + protected XMLGregorianCalendar startTime; + protected Integer taskId; + + /** + * 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 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; + } + + /** + * 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; + } + +} diff --git a/test/org/tempuri/package-info.java b/test/org/tempuri/package-info.java new file mode 100644 index 0000000..d479f7b --- /dev/null +++ b/test/org/tempuri/package-info.java @@ -0,0 +1,3 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://tempuri.org/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.tempuri; + diff --git a/test/readme.txt b/test/readme.txt new file mode 100644 index 0000000..b4ef7e9 --- /dev/null +++ b/test/readme.txt @@ -0,0 +1,71 @@ +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%\SOA\src +b) Build the HPC Java Session API source code by makejar.cmd, remember + to set up %JAVA_HOME% and %CXF_HOME% before run the script. + + +2. Download and compile the HPC Java Session API test cases + +a) Download HPC Java Session API test code to %basedir%\SOAtest\test +b) Download and copy AITestLibService.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to %basedir%\SOAtest\test +c) Build the HPC Java Session API test code by buildtests.cmd, remember + to set up %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, and copy it to the bin folder +b) Under %basedir%\SOAtest\test run cmd to launch the BVT test + java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore functionest.BVT +c) To run the full pass, under %basedir%\SOAtest\test run + java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore fullpass.Full + + + +On RHEL5.5: + +1. Download and compile the HPC Java Session API source code + +a) Download HPC Java Session API source code to $basedir/SOA/src +b) Build the HPC Java Session API source code by makejar.sh, remember + to export CXF_HOME and make sure $JAVA_HOME and $JAVA_BIN are set before run the script. + + +2. Download and compile the HPC Java Session API test cases + +a) Download HPC Java Session API test code to $basedir/SOAtest/test +b) Download and copy AITestLibService.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to $basedir/SOAtest/test + + +d) Build the HPC Java Session API test code by buildtests.sh, 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, and copy it to the bin folder +b) Make sure the CLASSPATH is set correctly, e.g. + export CLASSPATH=.:$CXF_HOME/lib/cxf-manifest.jar:./junit.jar:./org.hamcrest.core_1.1.0.v20090501071000.jar:./AITestLibService.jar:../../SOA/src:./bin +c) To run 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/ +d) Under $basedir/SOAtest/test run cmd to launch the BVT test + 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 +e) To run the full pass, under %basedir%\SOAtest\test run + 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/stresstest/Stress.java b/test/stresstest/Stress.java new file mode 100644 index 0000000..85d01d3 --- /dev/null +++ b/test/stresstest/Stress.java @@ -0,0 +1,335 @@ +/** + * + */ +package stresstest; + +import java.net.SocketTimeoutException; +import java.util.Random; +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; +import functiontest.Logger; +import functiontest.Config; +import functiontest.Util; + +/** + * @author yutongs + * + */ +public class Stress { + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + config = new Config("Stress"); + logger = new Logger(true, true, "Stress"); + + HpcJava.setUsername(config.UserName); + HpcJava.setPassword(config.Password); + + //read config params + minCalls = Integer.parseInt(config.getValue("MinCalls")); + maxCalls = Integer.parseInt(config.getValue("MaxCalls")); + minClients = Integer.parseInt(config.getValue("MinClients")); + maxClients = Integer.parseInt(config.getValue("MaxClients")); + minBatches = Integer.parseInt(config.getValue("MinBatches")); + maxBatches = Integer.parseInt(config.getValue("MaxBatches")); + + /*int minDataKb = Integer.parseInt(config.getValue("MinDataKb")); + int maxDataKb = Integer.parseInt(config.getValue("MaxDataKb")); + int minTimeMs = Integer.parseInt(config.getValue("MinTimeMs")); + int maxTimeMs = Integer.parseInt(config.getValue("MaxTimeMs")); + */ + rand = new Random(); + } + + /** + * @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 + } + + /** + * durable concurrent multiple batches, n * m batches + */ + @Test + public void test_Stress_DurableConcurrentMultipleBatches() { + logger.Start("test_BVT_DurableConcurrentMultipleBatches"); + + + int NbOfCalls = minCalls+ rand.nextInt(maxCalls -minCalls); + int NbOfClients = minClients + rand.nextInt(maxClients - minClients); + int NbOfBatches = minBatches + rand.nextInt(maxBatches - minBatches); + + + 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(NbOfClients); + + Thread[] workers = new Thread[NbOfClients]; + for (int m = 0; m < NbOfClients; m++) { + workers[m] = new Thread(new ConcurrentClient(m, NbOfBatches, NbOfCalls, L, session, 0)); + } + for (int m = 0; m < NbOfClients; m++) { + workers[m].start(); + } + + L.await(10, TimeUnit.MINUTES); + + CountDownLatch L2 = new CountDownLatch(NbOfClients); + + for (int m = 0; m < NbOfClients; m++) { + workers[m] = new Thread(new ConcurrentClient(m,NbOfBatches, NbOfCalls, L2, session, 1)); + } + for (int m = 0; m < NbOfClients; m++) { + workers[m].start(); + } + + L2.await(10, TimeUnit.MINUTES); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + logger.End("test_BVT_DurableConcurrentMultipleBatches"); + } + + /** + * interactive concurrent multiple batches, n * m batches + */ + @Test + public void test_Stress_InteractiveConcurrentMultipleBatches() { + logger.Start("test_BVT_InteractiveConcurrentMultipleBatches"); + + + int NbOfCalls = minCalls+ rand.nextInt(maxCalls -minCalls); + int NbOfClients = minClients + rand.nextInt(maxClients - minClients); + int NbOfBatches = minBatches + rand.nextInt(maxBatches - minBatches); + + + 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(NbOfClients); + + Thread[] workers = new Thread[NbOfClients]; + for (int m = 0; m < NbOfClients; m++) { + workers[m] = new Thread(new ConcurrentClient(m, NbOfBatches, NbOfCalls, L, session, 0)); + } + for (int m = 0; m < NbOfClients; m++) { + workers[m].start(); + } + + L.await(10, TimeUnit.MINUTES); + + CountDownLatch L2 = new CountDownLatch(NbOfClients); + + for (int m = 0; m < NbOfClients; m++) { + workers[m] = new Thread(new ConcurrentClient(m,NbOfBatches, NbOfCalls, L2, session, 1)); + } + for (int m = 0; m < NbOfClients; m++) { + workers[m].start(); + } + + L2.await(10, TimeUnit.MINUTES); + + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + try { + session.close(); + } catch (Throwable e) { + logger.Error("Exception is thrown %s", e.toString()); + e.printStackTrace(); + } + + logger.End("test_BVT_InteractiveConcurrentMultipleBatches"); + } + + class ConcurrentClient implements Runnable { + public ConcurrentClient(int m, int NbOfBatches, int NbOfCalls, CountDownLatch l, SessionBase session, + int sendget) { + this.m = m; + this.l = l; + this.NbOfBatches = NbOfBatches; + this.NbOfCalls = NbOfCalls; + this.session = session; + this.sendget = sendget; + + } + + @Override + public void run() { + if (sendget == 0) { + for (int k = 0; k < NbOfBatches; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + + logger.Info("Client %s sending %d requests...", + m + "_" + k, NbOfCalls); + + for (int i = 0; i < NbOfCalls; i++) { + Echo request = Util.generateEchoRequest(m * k); + try { + client.sendRequest(request, i); + } catch (SessionException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } catch (SocketTimeoutException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + } + logger.Info("Client %s calling endRequests()...", m + "_" + + k); + try { + client.endRequests(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + l.countDown(); + } else if (sendget == 1) { + for (int k = 0; k < NbOfBatches; k++) { + BrokerClient client = new BrokerClient( + "Client" + m + "_" + k, session, + AITestLibService.class); + logger.Info("Client%s retrieving responses...", m + "_" + k); + try { + int count =0; + for (BrokerResponse response : client + .getResponses(EchoResponse.class)) { + try { + ComputerInfo reply = response.getResult() + .getEchoResult().getValue(); + count++; + + } catch (Throwable ex) { + logger.Error("Error in process request %s", + ex.toString()); + + } + + } + logger.assertEqual("response count should equal", count, NbOfCalls); + + } catch (SessionException e) { + logger.Error("SessionException: %s", e.toString()); + e.printStackTrace(); + } + logger.Info("Done retrieving %d responses", + NbOfCalls); + try { + client.close(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + l.countDown(); + } + + } + + private int m = 0; + private int NbOfBatches = 0; + private int NbOfCalls = 0; + private CountDownLatch l = null; + private SessionBase session = null; + private int sendget = 0; + + } + + + //read config params + private static int minCalls = 0; + private static int maxCalls = 0; + private static int minClients = 0; + private static int maxClients = 0; + private static int minBatches = 0; + private static int maxBatches = 0; + + private static Random rand = null; + + + private static Config config; + private static Logger logger; + + + +} diff --git a/test/unittest/DataClientTest.java b/test/unittest/DataClientTest.java new file mode 100644 index 0000000..b01b531 --- /dev/null +++ b/test/unittest/DataClientTest.java @@ -0,0 +1,268 @@ +package unittest; + +import junit.framework.Assert; + +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.DataClient; +import com.microsoft.hpc.scheduler.session.DataLifeCycle; +import com.microsoft.hpc.exceptions.DataException; +import com.microsoft.hpc.scheduler.session.SessionException; + +public class DataClientTest +{ + static String serverName = "vincent-hpc"; + static String userName = "fareast\\wsdcta"; + static String password = "Pa55word$$4"; + + @Test + public void testBasic() { + byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; + try { + DataClient c = DataClient.create("Test", serverName, userName, + password); + c.writeRawBytesAll(data); + c.close(); + + DataClient d = DataClient.open("Test", serverName, userName, + password); + byte[] result = d.readRawBytesAll(); + + int i = 0; + for (byte b : result) { + Assert.assertEquals(data[i], b); + i++; + } + d.close(); + + DataClient.delete("Test", serverName, userName, password); + } catch (DataException e) { + // TODO Auto-generated catch block + Assert.fail(e.getMessage()); + } catch (Exception ex) { + ex.printStackTrace(); + Assert.fail(ex.getMessage()); + } + } + + @Test + public void testBasic2() { + byte[] data = { 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 7 }; + try { + DataClient c = DataClient.create("Test", serverName, userName, + password); + c.writeRawBytesAll(data); + c.close(); + + DataClient d = DataClient.open("Test", serverName, userName, + password); + byte[] result = d.readRawBytesAll(); + + int i = 0; + for (byte b : result) { + Assert.assertEquals(data[i], b); + i++; + } + d.close(); + DataClient.delete("Test", serverName, userName, password); + } catch (DataException e) { + // TODO Auto-generated catch block + Assert.fail(e.getMessage()); + } catch (Exception ex) { + ex.printStackTrace(); + Assert.fail(ex.getMessage()); + } + } + + @Test + public void testCompress() { + byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; + try { + DataClient.delete("Test2", serverName, userName, password); + DataClient c = DataClient.create("Test2", serverName, userName, + password); + c.writeRawBytesAll(data, true); + c.close(); + + DataClient d = DataClient.open("Test2", serverName, userName, + password); + byte[] result = d.readRawBytesAll(); + + int i = 0; + for (byte b : result) { + Assert.assertEquals(data[i], b); + i++; + } + d.close(); + DataClient.delete("Test2", serverName, userName, password); + } catch (DataException e) { + // TODO Auto-generated catch block + Assert.fail(e.getMessage()); + } + } + + @Test + public void testLifecycle() { + byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; + try { + DataClient.delete("Test2", serverName, userName, password); + DataClient c = DataClient.create("Test2", serverName, userName, + password); + c.setDataLifeCycle(new DataLifeCycle(10)); + c.writeRawBytesAll(data, true); + c.close(); + + DataClient d = DataClient.open("Test2", serverName, userName, + password); + byte[] result = d.readRawBytesAll(); + + int i = 0; + for (byte b : result) { + Assert.assertEquals(data[i], b); + i++; + } + d.close(); + + DataClient.delete("Test2", serverName, userName, password); + } catch (DataException e) { + // TODO Auto-generated catch block + Assert.fail(e.getMessage()); + } + } + + @Test + public void testCompress2() { + byte[] data = { 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, + 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, + 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, + 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, + 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, + 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, + 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, + 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, + 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6 }; + try { + DataClient.delete("Test2", serverName, userName, password); + DataClient c = DataClient.create("Test2", serverName, userName, + password); + c.writeRawBytesAll(data, true); + c.close(); + + DataClient d = DataClient.open("Test2", serverName, userName, + password); + byte[] result = d.readRawBytesAll(); + + int i = 0; + for (byte b : result) { + Assert.assertEquals(data[i], b); + i++; + } + d.close(); + DataClient.delete("Test2", serverName, userName, password); + } catch (DataException e) { + // TODO Auto-generated catch block + Assert.fail(e.getMessage()); + } + } + + String ConvertPath(String original, String runtimeShare) + { + int firstSlash = original.indexOf('\\', 3); + int secondSlash = original.indexOf('\\', firstSlash + 1); + + if (secondSlash == -1) + { + return null; + } + + String result = runtimeShare + original.substring(secondSlash); + return result.replace('\\', '/'); + } + + @Test + public void testConvertPath() { + String data = "\\\\junsuwin\\runtime$\\soa\\data\\14\\1.dat"; + + Assert.assertEquals("/mnt/smb/soa/data/14/1.dat",ConvertPath(data, "/mnt/smb")); + } +} diff --git a/test/unittest/SessionInfoTest.java b/test/unittest/SessionInfoTest.java new file mode 100644 index 0000000..eae1290 --- /dev/null +++ b/test/unittest/SessionInfoTest.java @@ -0,0 +1,90 @@ +/** + * + */ +package unittest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.hpc.scheduler.session.HpcJava; +import com.microsoft.hpc.scheduler.session.SessionUnitType; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.Version; + +/** + * @author junsu + * + */ +public class SessionInfoTest +{ + static String serverName = "junsuwin"; + static String userName = "fareast\\wsdcta"; + static String password = "Pa55word##3"; + + @BeforeClass + public static void before() { + HpcJava.setPassword(password); + HpcJava.setUsername(userName); + } + + @Test + public void TestBasicProperty() { + SessionStartInfo info = new SessionStartInfo("A", "B"); + assertEquals("headnode is not match", info.getHeadnode(), "A"); + assertEquals("service name is not match", info.getServiceName(), "B"); + + assertEquals("default security is not true", true, info.isSecure()); + assertEquals("default sharesession is not false", false, + info.isShareSession()); + } + + @Test + public void TestUnittype() { + SessionStartInfo info = new SessionStartInfo("A", "V"); + info.setResourceUnitType(SessionUnitType.Socket); + assertEquals("Resource Unit Type is not matched", + SessionUnitType.Socket, info.getResourceUnitType()); + + info.setClientIdleTimeout(3000); + assertEquals("clientIdleTimeout", info.clientIdleTimeout(), 3000); + } + + @Test + public void TestEnv() { + SessionStartInfo info = new SessionStartInfo("A", "V"); + info.addEnvironment("A", "B"); + info.addEnvironment("C", "D"); + + HashMap k = info.getEnvironments(); + assertEquals("env is wrong", "B", k.get("A")); + assertEquals("env is wrong", "D", k.get("C")); + } + + @Test + public void TestVersion() { + Version Version10 = new Version(1, 0); + Version Version12 = new Version(1, 2); + + Version Version1000 = new Version(1, 0, 0, 0); + Version Version1020 = new Version(1, 0, 2, 0); + + assertTrue(Version12.compareTo(Version10) > 0); + assertTrue(Version1020.compareTo(Version10) > 0); + assertTrue(Version10 == Version10); + } + + @Test + public void TestCrash() { + SessionStartInfo info = new SessionStartInfo("A", "V"); + assertEquals("getResourceUnitType", info.getResourceUnitType(), + SessionUnitType.Core); + assertEquals("nodeGroupsStr", info.getNodeGroups(), null); + assertEquals("serviceJobName", info.getServiceJobName(), null); + assertEquals("isCanPreempt", info.isPreemptive(), false); + } +} diff --git a/test/unittest/SessionPoolTest.java b/test/unittest/SessionPoolTest.java new file mode 100644 index 0000000..e388886 --- /dev/null +++ b/test/unittest/SessionPoolTest.java @@ -0,0 +1,180 @@ +package unittest; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.BeforeClass; +import org.junit.Test; + +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; +import com.microsoft.hpc.scheduler.session.SessionUnitType; + +public class SessionPoolTest +{ + static String schedulerName = "qingzhi-2008r2"; + static String userName = "fareast\\wsdcta"; + static String password = "Pa55word$$4"; + + @BeforeClass + public static void before() + { + HpcJava.setPassword(password); + HpcJava.setUsername(userName); + } + + @Test + public void CheckInvalidParameter() + { + try + { + SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(false); + info.setUseSessionPool(true); + + DurableSession session1 = DurableSession.createSession(info); + session1.close(); + } + catch(IllegalArgumentException e) { + System.out.println(e.getMessage()); + assertTrue(e.getMessage().compareTo("Session pool is not supported by unshared session.") == 0); + } + catch (Exception e) { + e.printStackTrace(); + fail("unexpected exception"); + } + } + + @Test + public void UseDurableSessionPoolForSameService() + { + try + { + SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(true); + + DurableSession session1 = DurableSession.createSession(info); + session1.close(false); + + info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(true); + DurableSession session2 = DurableSession.createSession(info); + session2.close(); + + assertTrue(session1.getId() == session2.getId()); + } + catch (Exception e) { + e.printStackTrace(); + fail("unexpected exception"); + } + } + + @Test + public void UseInteractiveSessionPoolForSameService() + { + try + { + SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(true); + + Session session1 = Session.createSession(info); + session1.close(false); + + info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(true); + Session session2 = Session.createSession(info); + session2.close(); + + assertTrue(session1.getId() == session2.getId()); + } + catch (Exception e) { + e.printStackTrace(); + fail("unexpected exception"); + } + } + + @Test + public void NotUseSessionPoolForSameService() + { + try + { + SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(false); + + DurableSession session1 = DurableSession.createSession(info); + session1.close(false); + + info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setShareSession(true); + info.setUseSessionPool(false); + DurableSession session2 = DurableSession.createSession(info); + session2.close(); + + assertTrue(session1.getId() != session2.getId()); + } + catch (Exception e) { + e.printStackTrace(); + fail("unexpected exception"); + } + } + + @Test + public void NotUseSessionPoolForDiffService() + { + try + { + SessionStartInfo info = new SessionStartInfo(schedulerName, "aitestservicelib"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setUseSessionPool(true); + info.setShareSession(true); + DurableSession session1 = DurableSession.createSession(info); + session1.close(false); + + info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); + info.setResourceUnitType(SessionUnitType.Core); + info.setMaxUnits(1); + info.setMinUnits(1); + info.setUseSessionPool(true); + info.setShareSession(true); + DurableSession session2 = DurableSession.createSession(info); + session2.close(); + + assertTrue(session2.getId() != session1.getId()); + session1.close(); + } + catch (Exception e) { + e.printStackTrace(); + fail("unexpected exception"); + } + } +} diff --git a/test/unittest/SessionTest.java b/test/unittest/SessionTest.java new file mode 100644 index 0000000..a129816 --- /dev/null +++ b/test/unittest/SessionTest.java @@ -0,0 +1,645 @@ +package unittest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.lang.reflect.Method; +import java.net.SocketTimeoutException; +import java.util.Date; + +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.ws.Service; +import javax.xml.ws.soap.SOAPBinding; +import javax.xml.ws.soap.SOAPFaultException; + +import junit.framework.Assert; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.tempuri.CcpEchoSvc; +import org.tempuri.Echo; +import org.tempuri.EchoResponse; +import org.tempuri.GenerateLoad; +import org.tempuri.GenerateLoadResponse; +import org.tempuri.IEchoSvc; +import org.tempuri.StatisticInfo; + +import com.microsoft.hpc.genericservice.GenericOperation; +import com.microsoft.hpc.genericservice.GenericService; +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.SessionBase; +import com.microsoft.hpc.scheduler.session.SessionException; +import com.microsoft.hpc.scheduler.session.SessionStartInfo; +import com.microsoft.hpc.scheduler.session.Version; + +public class SessionTest +{ + + static String serverName = "junsuwin"; + static String userName = "fareast\\wsdcta"; + static String password = "Pa55word$$4"; + + @BeforeClass + public static void before() { + HpcJava.setPassword(password); + HpcJava.setUsername(userName); + } + + /** + * Creates a request class using the specified objects as input + * + * The order of input should be the order they appear in the + * TRequest class. + * The function works by iterating through all set[requestClass] + * methods and call the corresponding ObjectFactory, if necessary, to create + * the input. + * + * @param + * return type + * @param requestClass + * instance to create + * @param args + * input objects + * @return A request to be sent to the broker using SendRequest + * @see BrokerClient#sendRequest(Object) + */ + public static TRequest createRequest( + Class requestClass, Object... args) { + return createRequest(requestClass, null, args, false); + } + + /** + * Creates a request class using the specified objects as input + * + * The order of input should be the order they appear in the + * TRequest class + * The function works by iterate through all set[requestClass] + * methods and call the corresponding ObjectFactory, if necessary, to create + * the input. + * + * @param + * return type + * @param requestClass + * instance to create + * @param classNames + * class names to check each argument against + * @param args + * input objects + * @return A request to be sent to the broker using SendRequest + * @see BrokerClient#sendRequest(Object) + */ + public static TRequest createRequest( + Class requestClass, Class classNames[], Object args[]) { + return createRequest(requestClass, classNames, args, true); + } + + /** + * Creates a request class using the specified objects as input + * + * @param + * return type + * @param requestClass + * instance to create + * @param classNames + * class names to check against + * @param args + * input objects + * @return A request to be sent to the broker using SendRequest + * @see BrokerClient#sendRequest(Object) + */ + private static TRequest createRequest( + Class requestClass, Class classNames[], Object args[], + boolean checkClassArgs) { + TRequest request; + try { + if (checkClassArgs && (args.length != classNames.length)) + throw new Exception(); + request = requestClass.newInstance(); + Class ObjectFactory = Class.forName(requestClass.getPackage() + .getName() + ".ObjectFactory"); + Object of = ObjectFactory.newInstance(); + int i = 0; + for (Method t : requestClass.getDeclaredMethods()) { + if (t.getName().startsWith("set")) { + String parameter = t.getName().substring("set".length()); + if (t.getParameterTypes()[0] == JAXBElement.class) { + for (Method ob : ObjectFactory.getDeclaredMethods()) { + String methodName = ob.getName(); + boolean nameisValid = methodName + .startsWith("create" + + requestClass.getSimpleName() + + parameter) + && !methodName.contains("Response"); + // && methodName.contains(parameter); + + if (nameisValid) { + if (!checkClassArgs + || ob.getParameterTypes()[0] == classNames[i]) + t.invoke(request, ob.invoke(of, args[i])); + else + throw new Exception(); + } + } + } else if (!checkClassArgs + || (t.getParameterTypes()[0] == classNames[i])) { + t.invoke(request, args[i]); + } else { + throw new Exception(); + } + i++; + } + } + } catch (Exception e) { + throw new IllegalArgumentException(); + } + return request; + } + + @Test + public void testCreateSession() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc", + userName, password); + Session session = null; + try { + session = Session.createSession(info); + session.close(true); + return; + } catch (SocketTimeoutException e) { + fail("unexpect failure:" + e.getMessage()); + } catch (SessionException e) { + fail("unexpect failure:" + e.getMessage()); + } + + assertNotNull("Create Interactive Session Failed", session); + } + + @Test + public void testCreateSession2() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc", + new Version(2, 0)); + Session session = null; + try { + session = Session.createSession(info); + session.close(true); + return; + } catch (SocketTimeoutException e) { + fail("unexpect failure:" + e.getMessage()); + } catch (SessionException e) { + fail("unexpect failure:" + e.getMessage()); + } + + assertNotNull("Create Interactive Session Failed", session); + } + + @Test + public void testCreateDurableSession() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + session.close(true); + return; + } catch (SocketTimeoutException e) { + fail("unexpect failure:" + e.getMessage()); + } catch (SessionException e) { + fail("unexpect failure:" + e.getMessage()); + } + + assertNotNull("Create Interactive Session Failed", session); + } + + @Test + public void testV2client() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(false); + Session session = null; + try { + session = Session.createSession(info); + + Service svc = Service.create(CcpEchoSvc.SERVICE); + QName portName = new QName("http://hpc.microsoft.com", + "HpcBrokerClientHttpsPort"); + svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, + session.getEndpointReference()); + IEchoSvc client = svc.getPort(portName, IEchoSvc.class); + + assertNotNull("return null", client.echo("HelloWorld")); + + session.close(true); + return; + } catch (SocketTimeoutException e) { + fail("unexpect failure:" + e.getMessage()); + } catch (SessionException e) { + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testBrokerClient() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(true); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + echo.sendRequest(req, ""); + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + fail("unexpect failure:" + e.getMessage()); + e.printStackTrace(); + } + } + + @Test + public void testGenericService() { + SessionStartInfo info = new SessionStartInfo(serverName, + "GenericService1"); + info.setSecure(false); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, GenericService.class); + GenericOperation req = SessionTest + . createRequest(GenericOperation.class, + "hello world"); + + req = new GenericOperation(); + req.setArgs(new com.microsoft.hpc.genericservice.ObjectFactory() + .createGenericOperationArgs("A")); + + echo.sendRequest(req, ""); + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + fail("unexpect failure:" + e.getMessage()); + e.printStackTrace(); + } + } + + @Test + public void testSecureBrokerClient() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(true); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + echo.sendRequest(req); + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testGetResponse() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(true); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + echo.sendRequest(req, "SA"); + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + assertEquals(r.getUserData(), "SA"); + System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testManyRequest() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(false); + Session session = null; + try { + session = Session.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + for (int i = 0; i < 4000; i++) { + echo.sendRequest(req); + } + + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + // System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testResponseHandler() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(false); + + try { + final Session session = Session.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + echo.setResponseHandler(EchoResponse.class, + new ResponseListener() { + int fetchedCount = 0; + + @Override + public void endOfMessage() { + Assert.assertEquals(10, fetchedCount); + synchronized (session) { + session.notify(); + } + } + + @Override + public void raiseError(Exception e) { + fail(e.getMessage()); + } + + @Override + public void responseReturned( + BrokerResponse response) { + try { + fetchedCount++; + String value = response.getResult() + .getEchoResult().getValue(); + assertNotNull("result is null", value); + } catch (SOAPFaultException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail("failed with exception: " + e.getMessage()); + } catch (SOAPException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail("failed with exception: " + e.getMessage()); + } + } + + }); + + for (int i = 0; i < 10; i++) { + echo.sendRequest(req); + } + + echo.endRequests(); + synchronized (session) { + session.wait(); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testFlush() { + int fetchedCount = 0; + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + echo.sendRequest(req); + echo.flush(); + echo.sendRequest(req); + echo.sendRequest(req); + echo.flush(); + echo.sendRequest(req); + echo.endRequests(); + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + fetchedCount++; + } + Assert.assertEquals(4, fetchedCount); + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void testTimeout() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(false); + try { + Session session; + session = Session.createSession(info, 10); + Assert.fail(); + } catch (SocketTimeoutException s) { + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + + fail("didn't fail with timeout"); + } + + @Test + public void testManyRequestWithMultiThreads() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + info.setSecure(false); + Session session = null; + try { + Date d = new Date(); + session = Session.createSession(info); + + final BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + final Echo req = SessionTest. createRequest(Echo.class, + "hello world"); + + Runnable runnable = new Runnable() { + public void run() { + for (int i = 0; i < 400; i++) { + try { + echo.sendRequest(req); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SocketTimeoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + + Thread[] threads = new Thread[10]; + for (int i = 0; i < 10; i++) { + threads[i] = new Thread(runnable); + threads[i].start(); + } + for (int i = 0; i < 10; i++) { + threads[i].join(); + } + + echo.endRequests(); + + Date end = new Date(); + System.out.println(end.getTime() - d.getTime()); + + Iterable> p = echo + .getResponses(EchoResponse.class); + for (BrokerResponse r : p) { + String value = r.getResult().getEchoResult().getValue(); + assertNotNull("result is null", value); + // System.out.println(value); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void test64KMsg() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + + BrokerClient echo = new BrokerClient( + "clientid0", session, CcpEchoSvc.class); + GenerateLoad req = SessionTest. createRequest( + GenerateLoad.class, (double) 100.0, new byte[1024 * 64], + null); + + echo.sendRequest(req); + echo.endRequests(); + Iterable> p = echo + .getResponses(GenerateLoadResponse.class); + for (BrokerResponse r : p) { + StatisticInfo value = r.getResult().getGenerateLoadResult() + .getValue(); + assertNotNull("result is null", value); + } + session.close(true); + return; + } catch (Exception e) { + e.printStackTrace(); + fail("unexpect failure:" + e.getMessage()); + } + } + + @Test + public void TestNoServiceVersion() { + try { + Version[] t = Session.GetServiceVersions(serverName, "CCPEchoSvc", + HpcJava.getUsername(), HpcJava.getPassword()); + assertEquals("t should be 1.", t.length, 1); + assertEquals("t should be 1.", t[0], SessionBase.NoServiceVersion); + } catch (SessionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void TestGetServerVersion() { + SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); + DurableSession session = null; + try { + session = DurableSession.createSession(info); + Version v = session.getServerVersion(); + assertEquals("major version is 3.", v.getMajor(), 3); + assertEquals("minor version is 2.", v.getMinor(), 2); + assertEquals(v.toString(), "3.2.3674.0"); + session.close(); + } catch (SessionException e) { + fail("unexpected exception"); + } catch (SocketTimeoutException e) { + fail("unexpected exception"); + } + } +} From 89684adcd4cfec5e26252228c0cc1b3cccbd272a Mon Sep 17 00:00:00 2001 From: Microsoft HPC Date: Thu, 29 Dec 2011 10:02:05 +0800 Subject: [PATCH 02/23] Update test cases. --- sample/helloworld/RunTest.sh | 2 +- .../hpc/scheduler/session/SessionBase.java | 2 +- test/TestCase/TestData.xml | 10 +- .../functiontest/BrokerClientTest.java | 2 +- test/TestCase/functiontest/Config.java | 10 +- .../TestCase/functiontest/DataClientTest.java | 2 +- .../functiontest/DurableSessionTest.java | 6 +- .../functiontest/SessionBaseTest.java | 10 +- .../functiontest/SessionStartInfoTest.java | 1 - test/fullpass/Full.java | 35 - test/functiontest/BVT.java | 1442 ---------- test/functiontest/BrokerClientTest.java | 2440 ----------------- test/functiontest/BrokerResponseTest.java | 182 -- test/functiontest/CommonDataBytes.java | 26 - test/functiontest/CommonDataHelper.java | 277 -- test/functiontest/CommonDataTestActionId.java | 35 - test/functiontest/CommonDataTestDurable.java | 295 -- .../CommonDataTestInteractive.java | 295 -- test/functiontest/Config.java | 100 - test/functiontest/DataClientHelper.java | 97 - test/functiontest/DataClientTest.java | 1381 ---------- test/functiontest/DurableSessionTest.java | 1284 --------- test/functiontest/GenericServiceTest.java | 230 -- test/functiontest/Logger.java | 233 -- test/functiontest/SessionAttachInfoTest.java | 172 -- test/functiontest/SessionBaseTest.java | 452 --- test/functiontest/SessionPool.java | 593 ---- test/functiontest/SessionStartInfoTest.java | 502 ---- test/functiontest/SessionTest.java | 497 ---- test/functiontest/Util.java | 81 - 30 files changed, 22 insertions(+), 10672 deletions(-) delete mode 100644 test/fullpass/Full.java delete mode 100644 test/functiontest/BVT.java delete mode 100644 test/functiontest/BrokerClientTest.java delete mode 100644 test/functiontest/BrokerResponseTest.java delete mode 100644 test/functiontest/CommonDataBytes.java delete mode 100644 test/functiontest/CommonDataHelper.java delete mode 100644 test/functiontest/CommonDataTestActionId.java delete mode 100644 test/functiontest/CommonDataTestDurable.java delete mode 100644 test/functiontest/CommonDataTestInteractive.java delete mode 100644 test/functiontest/Config.java delete mode 100644 test/functiontest/DataClientHelper.java delete mode 100644 test/functiontest/DataClientTest.java delete mode 100644 test/functiontest/DurableSessionTest.java delete mode 100644 test/functiontest/GenericServiceTest.java delete mode 100644 test/functiontest/Logger.java delete mode 100644 test/functiontest/SessionAttachInfoTest.java delete mode 100644 test/functiontest/SessionBaseTest.java delete mode 100644 test/functiontest/SessionPool.java delete mode 100644 test/functiontest/SessionStartInfoTest.java delete mode 100644 test/functiontest/SessionTest.java delete mode 100644 test/functiontest/Util.java diff --git a/sample/helloworld/RunTest.sh b/sample/helloworld/RunTest.sh index 4cb3cdb..95d0eb9 100644 --- a/sample/helloworld/RunTest.sh +++ b/sample/helloworld/RunTest.sh @@ -8,7 +8,7 @@ fi JAVA_HOME=/usr/java/jdk1.6.0_23 CXF_HOME=/usr/java/apache-cxf-2.4.0 -Keystore_Password=Pa55word&&7 +Keystore_Password=[password] CLASSPATH=.:Microsoft-HpcSession-3.0.jar:CcpEchoSvc.jar:$CXF_HOME/lib/cxf-manifest.jar PATH=$PATH:$JAVA_HOME/bin:/home diff --git a/src/com/microsoft/hpc/scheduler/session/SessionBase.java b/src/com/microsoft/hpc/scheduler/session/SessionBase.java index 4f7f02b..3907040 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionBase.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionBase.java @@ -85,7 +85,7 @@ public class SessionBase /** * the client version */ - private static Version clientVersion = new Version(3, 2); + private static Version clientVersion = new Version(3, 3); /* * the Magic Infinite date diff --git a/test/TestCase/TestData.xml b/test/TestCase/TestData.xml index 88d0d28..4b3ef46 100644 --- a/test/TestCase/TestData.xml +++ b/test/TestCase/TestData.xml @@ -2,15 +2,15 @@ -shpc-0042 -fareast\wsdcta -Pa55word&&7 +headnode +username +password JavaTestService 10 3 2 - fareast\wsdcta2 - Pa55word&&7 + username2 + password2 2 diff --git a/test/TestCase/functiontest/BrokerClientTest.java b/test/TestCase/functiontest/BrokerClientTest.java index 9c32335..8819920 100644 --- a/test/TestCase/functiontest/BrokerClientTest.java +++ b/test/TestCase/functiontest/BrokerClientTest.java @@ -1970,7 +1970,7 @@ public void testGetResponsesInt_E1() { * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} * . */ - @Test + @Ignore public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt() { // functional diff --git a/test/TestCase/functiontest/Config.java b/test/TestCase/functiontest/Config.java index a444877..f7c0faa 100644 --- a/test/TestCase/functiontest/Config.java +++ b/test/TestCase/functiontest/Config.java @@ -16,12 +16,12 @@ */ public class Config { - public String UserName = "fareast\\wsdcta"; - public String Password = "Pa55word##3"; - public String UserName2 = "fareast\\wsdcta2"; - public String Password2 = "Pa55word##3"; + public String UserName = "username"; + public String Password = "password"; + public String UserName2 = "username2"; + public String Password2 = "password2"; - public String Scheduler = "wcs-1515118"; + public String Scheduler = "headnode"; public String ServiceName = "JavaTestService"; public int NbOfCalls = 12; public int NbOfClients = 1; diff --git a/test/TestCase/functiontest/DataClientTest.java b/test/TestCase/functiontest/DataClientTest.java index 41a61b0..105037e 100644 --- a/test/TestCase/functiontest/DataClientTest.java +++ b/test/TestCase/functiontest/DataClientTest.java @@ -872,7 +872,7 @@ public final void DataClient_SOADataServer_5() throws IOException { } - @Test(timeout = 600000) + @Ignore // DataClient.Delete - Unauthorized delete public final void DataClient_API_Delete_3() throws IOException, DataException { diff --git a/test/TestCase/functiontest/DurableSessionTest.java b/test/TestCase/functiontest/DurableSessionTest.java index 6928307..0c57af7 100644 --- a/test/TestCase/functiontest/DurableSessionTest.java +++ b/test/TestCase/functiontest/DurableSessionTest.java @@ -649,7 +649,7 @@ public final void testGetClientVersion() { logger.assertEqual("DurableSession clientVersion major", v.getMajor(), 3); logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), - 2); + 3); // boundary try { @@ -697,8 +697,8 @@ public final void testGetServerVersion() { logger.Info(v.toString()); logger.assertEqual("DurableSession serverVersion major", v.getMajor(), 3); - logger.assertEqual("DurableSession serverVersion minor", v.getMinor(), - 2); // BUG to check if the server Version + //logger.assertEqual("DurableSession serverVersion minor", v.getMinor(), + // 2); // BUG to check if the server Version // boundary try { diff --git a/test/TestCase/functiontest/SessionBaseTest.java b/test/TestCase/functiontest/SessionBaseTest.java index a36e620..b162d13 100644 --- a/test/TestCase/functiontest/SessionBaseTest.java +++ b/test/TestCase/functiontest/SessionBaseTest.java @@ -150,10 +150,10 @@ public final void testGetClientVersion() { try { sb = DurableSession.createSession(info); logger.assertEqual("client version", sb.getClientVersion() - .toString(), "3.2"); + .toString(), "3.3"); /* logger.assertEqual("server version", sb.getServerVersion() .toString(), "3.2"); -*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); +*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3")); sb.close(); @@ -168,11 +168,11 @@ public final void testGetClientVersion() { try { sb = Session.createSession(info); logger.assertEqual("client version", sb.getClientVersion() - .toString(), "3.2"); + .toString(), "3.3"); /*logger.assertEqual("server version", sb.getServerVersion() .toString(), "3.2"); */ - logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); + logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3")); sb.close(); } catch (SocketTimeoutException e) { @@ -361,7 +361,7 @@ public final void testGetServiceVersions() { logger.assertEqual("ccpechosvc version", SessionBase .GetServiceVersions(config.Scheduler, config.ServiceName, config.UserName, config.Password)[0].toString(), - "3.2"); + "3.3"); } catch (SessionException e) { logger.Error("Session exception"); e.printStackTrace(); diff --git a/test/TestCase/functiontest/SessionStartInfoTest.java b/test/TestCase/functiontest/SessionStartInfoTest.java index 0ba1979..2f3c07f 100644 --- a/test/TestCase/functiontest/SessionStartInfoTest.java +++ b/test/TestCase/functiontest/SessionStartInfoTest.java @@ -161,7 +161,6 @@ public final void testSessionStartInfoStringStringStringString() { 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(), ""); diff --git a/test/fullpass/Full.java b/test/fullpass/Full.java deleted file mode 100644 index cff7d99..0000000 --- a/test/fullpass/Full.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -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/functiontest/BVT.java b/test/functiontest/BVT.java deleted file mode 100644 index 0428677..0000000 --- a/test/functiontest/BVT.java +++ /dev/null @@ -1,1442 +0,0 @@ -/** - * - */ -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()); - } - - SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, - sessionId, config.UserName, config.Password); - - try { - session = Session.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); - // 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 (session != null) { - try { - session.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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - 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/functiontest/BrokerClientTest.java b/test/functiontest/BrokerClientTest.java deleted file mode 100644 index 9c32335..0000000 --- a/test/functiontest/BrokerClientTest.java +++ /dev/null @@ -1,2440 +0,0 @@ -/** - * - */ -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); - - logger.Start("BrokerClientTest"); - - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - if (dClient != null) - dClient.close(true); - - if (iClient != null) - iClient.close(true); - - logger.End("BrokerClientTest"); - } - - /** - * 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() { - 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 : %s", e.getMessage()); - } catch (Throwable e) { - logger.Error("UE : %s", e.getMessage()); - } - - 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 : %s", e.getMessage()); - } catch (Throwable e) { - logger.Error("UE : %s", e.getMessage()); - } - - } - - /** - * 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() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } - } - - } - - /** - * 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() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(null); - logger.Error("Excetion is expected. d null"); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(1); - logger.Error("Excetion is expected. i int"); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(true); - logger.Error("Excetion is expected. i boolean "); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object)} - * . - */ - @Test - public final void testSendRequestObjectObject() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request, 1); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - try { - iClient.sendRequest(null, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(null, "datat"); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(new Object(), 1); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(new Object(), "data"); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, null); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - // 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()); e.printStackTrace(); } - * - * try { iClient.sendRequest(request, request); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - * - * try { dClient.sendRequest(request, true); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - } - - /** - * 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() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", - "http://tempuri.org/IEchoSvc/Echo"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); e.printStackTrace(); } - * - * try { dClient.sendRequest(request, "datat", ""); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - try { - iClient.sendRequest(request, 1, null); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - /* - * try { dClient.sendRequest(request, "datat", "&^(&^%$#{}?_?#@*"); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class)} - * . - */ - @Test - public final void testGetResponses() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (NullPointerException e) { - logger.Info("Expected excpetion when getting responses %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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() { - - // 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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", - e.toString()); - e.printStackTrace(); - } - - }); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * 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() { - - // boundary - // when the responsehandler is null - Echo request = Util.generateEchoRequest(); - - try { - iClient.setResponseHandler(EchoResponse.class, null); - logger.Error("EE is not thrown."); - } catch (NullPointerException e) { - logger.Info("NullPointerException is expected."); - e.printStackTrace(); - } - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(3000); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } // BUG this cannot throw InvalidOperationException - - // boundary - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} - * . - */ - @Test - public final void testEndRequestsInt_1() { - // functional - Echo request = Util.generateEchoRequest(); - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(0); - } catch (Throwable e) { - logger.Error("UE for 0 timeout %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - } - - @Test - public final void testEndRequestsInt_0() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(-1); - logger.Error("EE is not thrown. -1"); - } catch (Throwable e) { - logger.Info("Expected Exception %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(Integer.MIN_VALUE); - logger.Error("EE is not thrown. min"); - } catch (Throwable e) { - logger.Info("Expected Exception %s", e.toString()); - e.printStackTrace(); - } - - /* - * 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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test - public final void testFlush() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test(timeout = 180000) - public final void testFlush_1() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } - } - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(); // BUG flush should throw SessionException or - // InvalidOperationException - dClient.endRequests(); - } catch (Throwable e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test(timeout = 180000) - public final void testFlush_Bug1() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(); - //dClient.endRequests(); - } catch (Throwable e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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 %s", - e.toString()); - - } - }); - - 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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush(int)}. - */ - @Test - public final void testFlushInt() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(3000); // BUG flush should throw SessionException or - // InvalidOperationException - } catch (Throwable e) { - logger.Error("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - try { - dClient.flush(-1); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(1); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(0); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. - */ - @Test - public final void testEndRequests() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(); // BUG this cannot throw - // InvalidOperationException - } catch (Throwable e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. - */ - @Test - public final void testEndRequests_1() { - - // boundary - Echo request = Util.generateEchoRequest(); - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when end requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close()}. - */ - @Test - public final void testClose() { - // functional - // bug 11821 - - try { - dClient.close(); - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean)} - * . - */ - @Test - public final void testCloseBoolean() { - // functional - // bug 11821 - - try { - dClient.close(true); - } catch (IllegalStateException e) { - logger.Info("IllegalStateException is thrown. %s", e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt() { - // functional - - try { - dClient.close(false, 5000); - dClient = null; - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt_1() { - // boundary - // bug 11821 - - try { - dClient.close(false, -1); - logger.Error("EException is not thrown"); - } catch (Throwable e) { - logger.Info("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } - - - - try { - dClient.close(true, 1); - logger.Error("EException is not thrown"); - } catch (Throwable e) { - logger.Info("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.close(true, 0); - - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, int)} - * . - */ - @Test - public final void testSendRequestObjectObjectInt() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request, 1, 5000); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", Integer.MAX_VALUE); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, 0); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, -5000); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, null, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo", - 5000); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", - "http://tempuri.org/IEchoSvc/Echo", 0); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - } - - - /** - * Test method for GetRequestCount - */ - @Test - public final void testGetRequestCount() { - - 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 %s", ex.toString()); - - } - - } - - 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 %s",e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("UE is thrown %s",e.toString()); - e.printStackTrace(); - } - - - - - - } - - /** - * Test method for GetStatus - */ - @Test - public final void testGetStatus() { - - 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 %s", ex.toString()); - - } - - } - - 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 %s",e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("UE is thrown %s",e.toString()); - e.printStackTrace(); - } - - - - - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} - * . - */ - @Test - public void testGetResponsesInt() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} - * . - */ - @Test - public void testGetResponsesInt_E1() { - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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 - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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()); - e.printStackTrace(); - l.countDown(); - } - - }, 15000); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - - /** - * 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 - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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", - e.toString()); - e.printStackTrace(); - } - - }, 0); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * 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 - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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"); - e.printStackTrace(); - l.countDown(); - return; - } - } - logger.Error("Error in process request %s raised error", - e.toString()); - e.printStackTrace(); - l.countDown(); - return; - - } - - }, 5); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObject() { - - // functional - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObjectInt() { - // functional - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }, 5000); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObjectInt_E1() { - // boundary - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }, 0); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - 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/functiontest/BrokerResponseTest.java b/test/functiontest/BrokerResponseTest.java deleted file mode 100644 index cd6bbd1..0000000 --- a/test/functiontest/BrokerResponseTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * - */ -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 { - logger.Start("BrokerResponseTest"); - - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("BrokerResponseTest"); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getMessage()}. - */ - @Test - public final void testGetMessage() { - logger.Info(iResponse.getMessage().toString()); - logger.Info(iResponse.getMessage().getContentDescription()); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getResult()}. - */ - @Test - public final void testGetResult() { - 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.printStackTrace(); - } catch (SOAPException e) { - logger.Error("response getresult error"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SOAPException e) { - logger.Error("response getresult error"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getUserData()}. - */ - @Test - public final void testGetUserData() { - - logger.assertEqual("get user data", iResponse.getUserData(), "1"); - logger.assertEqual("get user data", dResponse.getUserData(), "2"); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getSOAPMessage(java.lang.Object)} - * . - */ - @Test - public final void testGetSOAPMessage() { - - logger.Info(iResponse.getMessage().toString()); - // it is not public, do not test it here - } - - 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/functiontest/CommonDataBytes.java b/test/functiontest/CommonDataBytes.java deleted file mode 100644 index 977c4ec..0000000 --- a/test/functiontest/CommonDataBytes.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - */ -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/functiontest/CommonDataHelper.java b/test/functiontest/CommonDataHelper.java deleted file mode 100644 index 648f0f1..0000000 --- a/test/functiontest/CommonDataHelper.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * - */ -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/functiontest/CommonDataTestActionId.java b/test/functiontest/CommonDataTestActionId.java deleted file mode 100644 index 972b972..0000000 --- a/test/functiontest/CommonDataTestActionId.java +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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/functiontest/CommonDataTestDurable.java b/test/functiontest/CommonDataTestDurable.java deleted file mode 100644 index 5cbc308..0000000 --- a/test/functiontest/CommonDataTestDurable.java +++ /dev/null @@ -1,295 +0,0 @@ -/** - * - */ -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("CommonDataTest"); - logger = new Logger(true, true, "DataClientTest"); - 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 { - logger.Start("CommonDataTest"); - } - - /** - * @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 - } - } - logger.End("CommonDataTest"); - } - - @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 { - 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); - } - } - - @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 { - 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); - - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - private static Config config; - private static Logger logger; - private static int[] dataSizeToCheck; -} diff --git a/test/functiontest/CommonDataTestInteractive.java b/test/functiontest/CommonDataTestInteractive.java deleted file mode 100644 index 9ec1ae7..0000000 --- a/test/functiontest/CommonDataTestInteractive.java +++ /dev/null @@ -1,295 +0,0 @@ -/** - * - */ -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("CommonDataTest"); - logger = new Logger(true, true, "DataClientTest"); - 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 { - logger.Start("CommonDataTest"); - } - - /** - * @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 - } - } - logger.End("CommonDataTest"); - } - - @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 { - 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); - } - } - - @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 { - 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); - - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - private static Config config; - private static Logger logger; - private static int[] dataSizeToCheck; -} diff --git a/test/functiontest/Config.java b/test/functiontest/Config.java deleted file mode 100644 index 249f308..0000000 --- a/test/functiontest/Config.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * - */ -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 = "fareast\\wsdcta"; - public String Password = "Pa55word##3"; - public String UserName2 = "fareast\\wsdcta2"; - public String Password2 = "Pa55word##3"; - - 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("bin/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/functiontest/DataClientHelper.java b/test/functiontest/DataClientHelper.java deleted file mode 100644 index e8e5a49..0000000 --- a/test/functiontest/DataClientHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * - */ -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/functiontest/DataClientTest.java b/test/functiontest/DataClientTest.java deleted file mode 100644 index 41a61b0..0000000 --- a/test/functiontest/DataClientTest.java +++ /dev/null @@ -1,1381 +0,0 @@ -/** - * - */ -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("CommonDataTest"); - 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 { - logger.Start("DataClientTest"); - } - - /** - * @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(); - logger.End("DataClientTest"); - } - - @Test(timeout = 600000) - // headnode=NULL - public final void DataClient_API_Create_1() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // headnode=string.Empty - public final void DataClient_API_Create_2() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // headnode is not existed - public final void DataClient_API_Create_3() throws DataException { - 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()); - } - } - - // @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 { - 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()); - } - } - - @Test(timeout = 600000) - // dataClientId=string.Empty - public final void DataClient_API_Create_6() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // valid dataClientId", - public final void DataClient_API_Create_7() { - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Create - invalid dataClientId - public final void DataClient_API_Create_8() { - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Create - username=NULL - public final void DataClient_API_Create_9() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - username is empty - public final void DataClient_API_Create_10() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - password=NULL - public final void DataClient_API_Create_11() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - password is empty - public final void DataClient_API_Create_12() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - create two DataClient with the same name - public final void DataClient_API_Create_13() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - object is NULL - public final void DataClient_API_WriteRaw_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - call WriteAll twice - public final void DataClient_API_WriteRaw_2() throws DataException { - 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(); - } - - - @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 { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read before write - public final void DataClient_API_ReadRaw_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Multiple read - public final void DataClient_API_ReadRaw_2() throws IllegalStateException, - DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read after deleted - public final void DataClient_API_ReadRaw_4() throws DataException { - 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()); - - } - - } - - - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read after deleted - public final void DataClient_API_ReadRaw_6() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read raw from write raw could be - // serializable - public final void DataClient_API_ReadRaw_7() throws IOException, - DataException, ClassNotFoundException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Could not write empty byte - public void DataClient_API_WriteRaw_8() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Could not write empty byte - public void DataClient_API_WriteRaw_9() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Unauthorized write - public void DataClient_API_WriteRaw_10() throws DataException { - 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); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode=NULL - public final void DataClient_API_Open_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode=string.Empty - public final void DataClient_API_Open_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode is not existed - public final void DataClient_API_Open_3() throws DataException { - 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(); - } - - // 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 { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - dataClientId=string.Empty - public final void DataClient_API_Open_6() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - valid dataClientId - public final void DataClient_API_Open_7() throws DataException { - 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(); - - } - - @Test(timeout = 600000) - // DataClient.Open - invalid dataClientId - public void DataClient_API_Open_8() { - - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Open - Open dataClient which does not exist - public final void DataClient_API_Open_9() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - multiple Open and Read - public final void DataClient_API_Open_10() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - Open dataClient which has been closed - public final void DataClient_API_Open_11() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Open - Opened dataClient is read only - public final void DataClient_API_Open_12() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - data server unreachable - public final void DataClient_SOADataServer_1() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - data server is empty - public final void DataClient_SOADataServer_2() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - multiple data server path - public final void DataClient_SOADataServer_3() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - public void DataClient_SOADataServer_4() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - local path - public final void DataClient_SOADataServer_5() throws IOException { - 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); - } - - - @Test(timeout = 600000) - // DataClient.Delete - Unauthorized delete - public final void DataClient_API_Delete_3() throws IOException, - DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Delete - Authorized delete - public final void DataClient_API_Delete_4() throws IOException, - DataException { - 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()); - } - } - - 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 { - // 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(); - - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll not in compress - public final void DataClient_API_WriteCompress_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll not in compress (by default)", - public final void DataClient_API_WriteCompress_3() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - no data written - public final void DataClient_API_FilePath_1() throws DataException { - DataClient dataClient = DataClientHelper.Create(); - String filePath = dataClient.getStorePath(); - logger.Info("The data file path is %s", filePath); - - DataClientHelper.Delete(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - data deleted - public final void DataClient_API_FilePath_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - data could be read by simple file solution - public final void DataClient_API_FilePath_3() throws IOException, - DataException, ClassNotFoundException { - 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(); - } - - @Test(timeout = 600000) - // DataSecurity - Unauthorized read (by default) - public final void DataClient_API_DataSecurity_2() throws DataException { - 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); - - } - - @Test(timeout = 600000) - // DataSecurity - Authorized read for another user - public final void DataClient_API_DataSecurity_4() throws DataException, - SocketTimeoutException, SessionException, - DatatypeConfigurationException { - 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); - } - - @Test(timeout = 600000) - // Concurrency write - public final void DataClient_Concurrency_1() throws InterruptedException, - BrokenBarrierException, DataException { - 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(); - } - - @Test(timeout = 600000) - // Concurrency read and close - public final void DataClient_Concurrency_2() throws InterruptedException, - BrokenBarrierException { - DataClient_Concurrency_2_Helper(CommonDataHelper.defaultDataClientId, - false, 100); - } - - 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 { - 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(); - } - - 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/functiontest/DurableSessionTest.java b/test/functiontest/DurableSessionTest.java deleted file mode 100644 index 6928307..0000000 --- a/test/functiontest/DurableSessionTest.java +++ /dev/null @@ -1,1284 +0,0 @@ -/** - * - */ -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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } - - // 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"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SocketTimeoutException was thrown"); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SessionException was thrown"); - } - - SessionStartInfo info2 = new SessionStartInfo(config.Scheduler, - config.ServiceName); - - try { - dSession = DurableSession.createSession(info2); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SocketTimeoutException was thrown"); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SessionException was thrown"); - } finally { - try { - dSession.close(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info, 0); - - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info, 1); - logger.Error("EException is not thrown."); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached = DurableSession.attachSession(attachInfo, 0); - } catch (SessionException e1) { - logger.Error("SessionException when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("SessionException when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Info("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (NullPointerException e1) { - logger.Info("NullPointerException when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - Version v = dSession.getClientVersion(); - logger.assertEqual("DurableSession clientVersion major", v.getMajor(), - 3); - logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), - 2); - - // boundary - try { - dSession.close(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - Version v = dSession.getServerVersion(); - logger.Info(v.toString()); - logger.assertEqual("DurableSession serverVersion major", v.getMajor(), - 3); - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 %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); - 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 %s", ex.toString()); - - } - - } - 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 %s", e1.toString()); - e1.printStackTrace(); - } - - 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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(); - session.close(); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // boundary - - dSession = null; - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(true, 1); - logger.Error("EE is not thrown"); - } catch (SessionException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Info("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(true, Integer.MIN_VALUE); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(false, Integer.MAX_VALUE); - } catch (SessionException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } - - // 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.printStackTrace(); - } - - } - - // 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Info("SessionException is thrown"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - try { - versions = DurableSession.GetServiceVersions(config.Scheduler, "", - config.UserName, config.Password); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException is thrown"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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/functiontest/GenericServiceTest.java b/test/functiontest/GenericServiceTest.java deleted file mode 100644 index 093a73e..0000000 --- a/test/functiontest/GenericServiceTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/** - * - */ -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 %s", ex.toString()); - ex.printStackTrace(); - - } - - } - logger.Info("Done retrieving responses"); - client.close(); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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. %s", ee.toString()); - ee.printStackTrace(); - } - catch (Throwable ee) { - logger.Error("Error in process request %s", ee.toString()); - ee.printStackTrace(); - - } - - } - logger.Info("Done retrieving responses"); - client.close(); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_DurableGenericService"); - - } - - - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/Logger.java b/test/functiontest/Logger.java deleted file mode 100644 index 0ac6c1e..0000000 --- a/test/functiontest/Logger.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * - */ -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) { - 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 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(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) { - - 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/functiontest/SessionAttachInfoTest.java b/test/functiontest/SessionAttachInfoTest.java deleted file mode 100644 index cf31ebf..0000000 --- a/test/functiontest/SessionAttachInfoTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * - */ -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 { - logger.Start("SessionAttachInfoTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionAttachInfoTest"); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int)} - * . - */ - @Test - public final void testSessionAttachInfoStringInt() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - DurableSession dSession_attached = null; - try { - dSession_attached = DurableSession.attachSession(attachInfo); - } catch (SessionException e1) { - logger.Error("SessionException when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - // 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"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Invalid sessionAttachInfo when attaching a durable session"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - } - - private static Session iSession = null; - private static DurableSession dSession = null; - - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/SessionBaseTest.java b/test/functiontest/SessionBaseTest.java deleted file mode 100644 index a36e620..0000000 --- a/test/functiontest/SessionBaseTest.java +++ /dev/null @@ -1,452 +0,0 @@ -/** - * - */ -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 { - logger.Start("SessionBaseTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionBaseTest"); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. - */ - @Test - public final void testGetId() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} - * . - */ - @Test - public final void testGetEndpointReference() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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(), "3.2"); - /* logger.assertEqual("server version", sb.getServerVersion() - .toString(), "3.2"); -*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); - - - sb.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - sb = Session.createSession(info); - logger.assertEqual("client version", sb.getClientVersion() - .toString(), "3.2"); - /*logger.assertEqual("server version", sb.getServerVersion() - .toString(), "3.2"); -*/ - logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3.2")); - - sb.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(false); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(true, 5000); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(true, 0); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(false, -1000); - logger.Error("EE is not thrown"); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(true, 1); - logger.Error("EE is not thrown 1"); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Error("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(true, Integer.MAX_VALUE); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} - * . - */ - @Test - public final void testGetServiceVersions() { - - 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.printStackTrace(); - } - - // 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.printStackTrace(); - } - - } - - // 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("UE is thrown"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - try { - versions = SessionBase.GetServiceVersions(config.Scheduler, "", - config.UserName, config.Password); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("SessionException is thrown"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } - - } - - /** - * Test method for NoServiceVersion - */ - @Test - public final void testNoServiceVersion() { - logger.assertEqual("noServiceVersion", SessionBase.NoServiceVersion, new Version(0,0)); - - } - - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/SessionPool.java b/test/functiontest/SessionPool.java deleted file mode 100644 index 7e3c1a2..0000000 --- a/test/functiontest/SessionPool.java +++ /dev/null @@ -1,593 +0,0 @@ -/** - * - */ -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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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 %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); - logger.assertTrue("check response", - reply.getRefID() == refId); - } catch (Throwable ex) { - logger.Error("Error in process request %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(false); //needed to keep the session in the pool - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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 %s%n%s", e.toString(), - e.getStackTrace()); - } - - 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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(false); //needed to keep the session in the pool - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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 %s", - ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(); - } - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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: %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - } - logger.Info("Client %s calling endRequests()...", m + "_" - + k); - try { - client.endRequests(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - 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 %s", - ex.toString()); - - } - - } - } catch (SessionException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - logger.Info("Done retrieving %d responses", - config.NbOfCalls); - try { - client.close(true); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - 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 %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_SessionPool_InteractiveConcurrentMultipleBatches"); - } - - - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/SessionStartInfoTest.java b/test/functiontest/SessionStartInfoTest.java deleted file mode 100644 index 0ba1979..0000000 --- a/test/functiontest/SessionStartInfoTest.java +++ /dev/null @@ -1,502 +0,0 @@ -/** - * - */ -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 { - logger.Start("SessionStartInfoTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionStartInfoTest"); - } - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - //should check the session created. - if (session !=null) { - try { - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - } - - - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String)} - * . - */ - @Test - public final void testSessionStartInfoStringString() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - - } - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString() { - 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.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString_noVersion() { - 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.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString_Er() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/SessionTest.java b/test/functiontest/SessionTest.java deleted file mode 100644 index 0c6af03..0000000 --- a/test/functiontest/SessionTest.java +++ /dev/null @@ -1,497 +0,0 @@ -/** - * - */ -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("DurableSessionTest"); - logger = new Logger(true, true, "DurableSessionTest"); - - 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 { - logger.Start("SessionTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionTest"); - } - - /** - * 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.Info(iSession.getAutoCloseJob().toString()); // BUG what's this - // for? - - } - - - /** - * 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.Info(iSession.httpEndpointReference()); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} - * . - */ - @Test - public final void testCreateSessionSessionStartInfo() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } - - // boundary - try { - session = Session.createSession(null); - logger.Error("EException is not thrown."); - } catch (Throwable e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } - - // more boundary test case for invalid startInfo would be included in - // SessionStartInfo test - - } - - /** - * 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() { - - // 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() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, Integer.MAX_VALUE); - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, 0); - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info, -1); - logger.Error("EException is not thrown."); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, 1); - logger.Error("EException is not thrown."); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, Integer.MIN_VALUE); - logger.Error("EException is not thrown."); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} - * . - */ - @Test - public final void testAttachSessionSessionAttachInfo() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a session"); - e1.printStackTrace(); - } - - try { - session_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} - * . - */ - @Test - public final void testAttachSessionSessionAttachInfoInt() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session_attached = Session.attachSession(attachInfo, 0); - } catch (SessionException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Info("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - } - - private static Session iSession = null; - private static Config config; - private static Logger logger; - -} diff --git a/test/functiontest/Util.java b/test/functiontest/Util.java deleted file mode 100644 index 096884e..0000000 --- a/test/functiontest/Util.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - */ -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; - } -} From 0778b2b426ed045e2fc1b7d81187b5483e648fd1 Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Thu, 29 Dec 2011 16:45:59 +0800 Subject: [PATCH 03/23] Remove redundant files. --- test/TestData.xml | 55 -- test/build.xml | 286 --------- test/buildtests.cmd | 13 - test/buildtests.sh | 13 - test/org/tempuri/CcpEchoSvc.java | 77 --- test/org/tempuri/Echo.java | 65 --- test/org/tempuri/EchoResponse.java | 65 --- test/org/tempuri/GenerateLoad.java | 120 ---- test/org/tempuri/GenerateLoadResponse.java | 65 --- test/org/tempuri/IEchoSvc.java | 45 -- test/org/tempuri/ObjectFactory.java | 117 ---- test/org/tempuri/StatisticInfo.java | 121 ---- test/org/tempuri/package-info.java | 3 - test/readme.txt | 71 --- test/stresstest/Stress.java | 335 ----------- test/unittest/DataClientTest.java | 268 --------- test/unittest/SessionInfoTest.java | 90 --- test/unittest/SessionPoolTest.java | 180 ------ test/unittest/SessionTest.java | 645 --------------------- 19 files changed, 2634 deletions(-) delete mode 100644 test/TestData.xml delete mode 100644 test/build.xml delete mode 100644 test/buildtests.cmd delete mode 100644 test/buildtests.sh delete mode 100644 test/org/tempuri/CcpEchoSvc.java delete mode 100644 test/org/tempuri/Echo.java delete mode 100644 test/org/tempuri/EchoResponse.java delete mode 100644 test/org/tempuri/GenerateLoad.java delete mode 100644 test/org/tempuri/GenerateLoadResponse.java delete mode 100644 test/org/tempuri/IEchoSvc.java delete mode 100644 test/org/tempuri/ObjectFactory.java delete mode 100644 test/org/tempuri/StatisticInfo.java delete mode 100644 test/org/tempuri/package-info.java delete mode 100644 test/readme.txt delete mode 100644 test/stresstest/Stress.java delete mode 100644 test/unittest/DataClientTest.java delete mode 100644 test/unittest/SessionInfoTest.java delete mode 100644 test/unittest/SessionPoolTest.java delete mode 100644 test/unittest/SessionTest.java diff --git a/test/TestData.xml b/test/TestData.xml deleted file mode 100644 index d282ade..0000000 --- a/test/TestData.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - -shpc-0042 -fareast\wsdcta -Pa55word&&7 -AITestServiceLib -10 -3 -2 - fareast\wsdcta2 - Pa55word&&7 - 2 - - -12 -BVTValue1 - - - - -SoaGenericTestService - - - - aitestservicelib - - aitestservicelib - - \\shpc-0050\CommonData2 - 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 - - - - - \ No newline at end of file diff --git a/test/build.xml b/test/build.xml deleted file mode 100644 index 9b49554..0000000 --- a/test/build.xml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/buildtests.cmd b/test/buildtests.cmd deleted file mode 100644 index 753da1c..0000000 --- a/test/buildtests.cmd +++ /dev/null @@ -1,13 +0,0 @@ - @echo off - 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;AITestLibService.jar;..\..\SOA\src - - rd /s /q bin - md bin - echo Compiling - %javac% -sourcepath functiontest\*.java -d bin - %javac% fullpass\Full.java -d bin - echo Done - - \ No newline at end of file diff --git a/test/buildtests.sh b/test/buildtests.sh deleted file mode 100644 index e68b696..0000000 --- a/test/buildtests.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!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:./AITestLibService.jar:../../SOA/src - -rm -rf bin -mkdir bin - -echo Compiling -find ./functiontest -name *.java -print | xargs javac -d ./bin -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" - -find ./fullpass -name *.java -print | xargs javac -d ./bin -Djava.endorsed.dirs="$CXF_HOME/lib/endorsed" -echo Done - diff --git a/test/org/tempuri/CcpEchoSvc.java b/test/org/tempuri/CcpEchoSvc.java deleted file mode 100644 index 20ac8b3..0000000 --- a/test/org/tempuri/CcpEchoSvc.java +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * - */ - -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.1 - * Tue Dec 28 11:00:17 GMT+08:00 2010 - * Generated source version: 2.3.1 - * - */ - - -@WebServiceClient(name = "CcpEchoSvc", - wsdlLocation = "file:tempuri.org.wsdl", - targetNamespace = "http://tempuri.org/") -public class CcpEchoSvc extends Service { - - public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://tempuri.org/", "CcpEchoSvc"); - public final static QName DefaultBindingIEchoSvc = new QName("http://tempuri.org/", "DefaultBinding_IEchoSvc"); - 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 CcpEchoSvc(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public CcpEchoSvc(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public CcpEchoSvc() { - super(WSDL_LOCATION, SERVICE); - } - - /** - * - * @return - * returns IEchoSvc - */ - @WebEndpoint(name = "DefaultBinding_IEchoSvc") - public IEchoSvc getDefaultBindingIEchoSvc() { - return super.getPort(DefaultBindingIEchoSvc, IEchoSvc.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 IEchoSvc - */ - @WebEndpoint(name = "DefaultBinding_IEchoSvc") - public IEchoSvc getDefaultBindingIEchoSvc(WebServiceFeature... features) { - return super.getPort(DefaultBindingIEchoSvc, IEchoSvc.class, features); - } - -} diff --git a/test/org/tempuri/Echo.java b/test/org/tempuri/Echo.java deleted file mode 100644 index e92344e..0000000 --- a/test/org/tempuri/Echo.java +++ /dev/null @@ -1,65 +0,0 @@ - -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="input" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "input" -}) -@XmlRootElement(name = "Echo") -public class Echo { - - @XmlElementRef(name = "input", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) - protected JAXBElement input; - - /** - * Gets the value of the input property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public JAXBElement getInput() { - return input; - } - - /** - * Sets the value of the input property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setInput(JAXBElement value) { - this.input = ((JAXBElement ) value); - } - -} diff --git a/test/org/tempuri/EchoResponse.java b/test/org/tempuri/EchoResponse.java deleted file mode 100644 index b54219c..0000000 --- a/test/org/tempuri/EchoResponse.java +++ /dev/null @@ -1,65 +0,0 @@ - -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="EchoResult" type="{http://www.w3.org/2001/XMLSchema}string" 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 String }{@code >} - * - */ - public JAXBElement getEchoResult() { - return echoResult; - } - - /** - * Sets the value of the echoResult property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setEchoResult(JAXBElement value) { - this.echoResult = ((JAXBElement ) value); - } - -} diff --git a/test/org/tempuri/GenerateLoad.java b/test/org/tempuri/GenerateLoad.java deleted file mode 100644 index fd6115c..0000000 --- a/test/org/tempuri/GenerateLoad.java +++ /dev/null @@ -1,120 +0,0 @@ - -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="runMilliSeconds" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/>
- *         <element name="dummyData" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
- *         <element name="fileData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "runMilliSeconds", - "dummyData", - "fileData" -}) -@XmlRootElement(name = "GenerateLoad") -public class GenerateLoad { - - protected Double runMilliSeconds; - @XmlElementRef(name = "dummyData", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) - protected JAXBElement dummyData; - @XmlElementRef(name = "fileData", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) - protected JAXBElement fileData; - - /** - * Gets the value of the runMilliSeconds property. - * - * @return - * possible object is - * {@link Double } - * - */ - public Double getRunMilliSeconds() { - return runMilliSeconds; - } - - /** - * Sets the value of the runMilliSeconds property. - * - * @param value - * allowed object is - * {@link Double } - * - */ - public void setRunMilliSeconds(Double value) { - this.runMilliSeconds = value; - } - - /** - * Gets the value of the dummyData property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * - */ - public JAXBElement getDummyData() { - return dummyData; - } - - /** - * Sets the value of the dummyData property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * - */ - public void setDummyData(JAXBElement value) { - this.dummyData = ((JAXBElement ) value); - } - - /** - * Gets the value of the fileData property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public JAXBElement getFileData() { - return fileData; - } - - /** - * Sets the value of the fileData property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setFileData(JAXBElement value) { - this.fileData = ((JAXBElement ) value); - } - -} diff --git a/test/org/tempuri/GenerateLoadResponse.java b/test/org/tempuri/GenerateLoadResponse.java deleted file mode 100644 index e765b3e..0000000 --- a/test/org/tempuri/GenerateLoadResponse.java +++ /dev/null @@ -1,65 +0,0 @@ - -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="GenerateLoadResult" type="{http://schemas.datacontract.org/2004/07/EchoSvcLib}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/org/tempuri/IEchoSvc.java b/test/org/tempuri/IEchoSvc.java deleted file mode 100644 index ae9a94c..0000000 --- a/test/org/tempuri/IEchoSvc.java +++ /dev/null @@ -1,45 +0,0 @@ -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.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - -/** - * This class was generated by Apache CXF 2.3.1 - * Tue Dec 28 11:00:17 GMT+08:00 2010 - * Generated source version: 2.3.1 - * - */ - -@WebService(targetNamespace = "http://tempuri.org/", name = "IEchoSvc") -public interface IEchoSvc { - - @WebResult(name = "GenerateLoadResult", targetNamespace = "http://tempuri.org/") - @Action(input = "http://tempuri.org/IEchoSvc/GenerateLoad", output = "http://tempuri.org/IEchoSvc/GenerateLoadResponse") - @RequestWrapper(localName = "GenerateLoad", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoad") - @WebMethod(operationName = "GenerateLoad", action = "http://tempuri.org/IEchoSvc/GenerateLoad") - @ResponseWrapper(localName = "GenerateLoadResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.GenerateLoadResponse") - public StatisticInfo generateLoad( - @WebParam(name = "runMilliSeconds", targetNamespace = "http://tempuri.org/") - java.lang.Double runMilliSeconds, - @WebParam(name = "dummyData", targetNamespace = "http://tempuri.org/") - byte[] dummyData, - @WebParam(name = "fileData", targetNamespace = "http://tempuri.org/") - java.lang.String fileData - ); - - @WebResult(name = "EchoResult", targetNamespace = "http://tempuri.org/") - @Action(input = "http://tempuri.org/IEchoSvc/Echo", output = "http://tempuri.org/IEchoSvc/EchoResponse") - @RequestWrapper(localName = "Echo", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Echo") - @WebMethod(operationName = "Echo", action = "http://tempuri.org/IEchoSvc/Echo") - @ResponseWrapper(localName = "EchoResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoResponse") - public java.lang.String echo( - @WebParam(name = "input", targetNamespace = "http://tempuri.org/") - java.lang.String input - ); -} diff --git a/test/org/tempuri/ObjectFactory.java b/test/org/tempuri/ObjectFactory.java deleted file mode 100644 index a518424..0000000 --- a/test/org/tempuri/ObjectFactory.java +++ /dev/null @@ -1,117 +0,0 @@ - -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; - - -/** - * 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 _EchoResponseEchoResult_QNAME = new QName("http://tempuri.org/", "EchoResult"); - private final static QName _EchoInput_QNAME = new QName("http://tempuri.org/", "input"); - private final static QName _GenerateLoadDummyData_QNAME = new QName("http://tempuri.org/", "dummyData"); - private final static QName _GenerateLoadFileData_QNAME = new QName("http://tempuri.org/", "fileData"); - private final static QName _GenerateLoadResponseGenerateLoadResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadResult"); - - /** - * 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 Echo } - * - */ - public Echo createEcho() { - return new Echo(); - } - - /** - * Create an instance of {@link GenerateLoadResponse } - * - */ - public GenerateLoadResponse createGenerateLoadResponse() { - return new GenerateLoadResponse(); - } - - /** - * Create an instance of {@link GenerateLoad } - * - */ - public GenerateLoad createGenerateLoad() { - return new GenerateLoad(); - } - - /** - * Create an instance of {@link EchoResponse } - * - */ - public EchoResponse createEchoResponse() { - return new EchoResponse(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "EchoResult", scope = EchoResponse.class) - public JAXBElement createEchoResponseEchoResult(String value) { - return new JAXBElement(_EchoResponseEchoResult_QNAME, String.class, EchoResponse.class, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "input", scope = Echo.class) - public JAXBElement createEchoInput(String value) { - return new JAXBElement(_EchoInput_QNAME, String.class, Echo.class, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "dummyData", scope = GenerateLoad.class) - public JAXBElement createGenerateLoadDummyData(byte[] value) { - return new JAXBElement(_GenerateLoadDummyData_QNAME, byte[].class, GenerateLoad.class, ((byte[]) value)); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "fileData", scope = GenerateLoad.class) - public JAXBElement createGenerateLoadFileData(String value) { - return new JAXBElement(_GenerateLoadFileData_QNAME, String.class, GenerateLoad.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); - } - -} diff --git a/test/org/tempuri/StatisticInfo.java b/test/org/tempuri/StatisticInfo.java deleted file mode 100644 index 9fa89af..0000000 --- a/test/org/tempuri/StatisticInfo.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * - */ -package org.tempuri; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -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="startTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
- *         <element name="taskId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "StatisticInfo", propOrder = { - "endTime", - "startTime", - "taskId" -}) -public class StatisticInfo { - - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar endTime; - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar startTime; - protected Integer taskId; - - /** - * 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 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; - } - - /** - * 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; - } - -} diff --git a/test/org/tempuri/package-info.java b/test/org/tempuri/package-info.java deleted file mode 100644 index d479f7b..0000000 --- a/test/org/tempuri/package-info.java +++ /dev/null @@ -1,3 +0,0 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://tempuri.org/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.tempuri; - diff --git a/test/readme.txt b/test/readme.txt deleted file mode 100644 index b4ef7e9..0000000 --- a/test/readme.txt +++ /dev/null @@ -1,71 +0,0 @@ -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%\SOA\src -b) Build the HPC Java Session API source code by makejar.cmd, remember - to set up %JAVA_HOME% and %CXF_HOME% before run the script. - - -2. Download and compile the HPC Java Session API test cases - -a) Download HPC Java Session API test code to %basedir%\SOAtest\test -b) Download and copy AITestLibService.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to %basedir%\SOAtest\test -c) Build the HPC Java Session API test code by buildtests.cmd, remember - to set up %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, and copy it to the bin folder -b) Under %basedir%\SOAtest\test run cmd to launch the BVT test - java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore functionest.BVT -c) To run the full pass, under %basedir%\SOAtest\test run - java -Xmx1024m -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext";%CXF_HOME%\lib;%CXF_HOME%\lib\endorsed org.junit.runner.JUnitCore fullpass.Full - - - -On RHEL5.5: - -1. Download and compile the HPC Java Session API source code - -a) Download HPC Java Session API source code to $basedir/SOA/src -b) Build the HPC Java Session API source code by makejar.sh, remember - to export CXF_HOME and make sure $JAVA_HOME and $JAVA_BIN are set before run the script. - - -2. Download and compile the HPC Java Session API test cases - -a) Download HPC Java Session API test code to $basedir/SOAtest/test -b) Download and copy AITestLibService.jar, junit.jar and org.hamcrest.core_1.1.0.v20090501071000.jar to $basedir/SOAtest/test - - -d) Build the HPC Java Session API test code by buildtests.sh, 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, and copy it to the bin folder -b) Make sure the CLASSPATH is set correctly, e.g. - export CLASSPATH=.:$CXF_HOME/lib/cxf-manifest.jar:./junit.jar:./org.hamcrest.core_1.1.0.v20090501071000.jar:./AITestLibService.jar:../../SOA/src:./bin -c) To run 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/ -d) Under $basedir/SOAtest/test run cmd to launch the BVT test - 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 -e) To run the full pass, under %basedir%\SOAtest\test run - 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/stresstest/Stress.java b/test/stresstest/Stress.java deleted file mode 100644 index 85d01d3..0000000 --- a/test/stresstest/Stress.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * - */ -package stresstest; - -import java.net.SocketTimeoutException; -import java.util.Random; -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; -import functiontest.Logger; -import functiontest.Config; -import functiontest.Util; - -/** - * @author yutongs - * - */ -public class Stress { - - /** - * @throws java.lang.Exception - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - config = new Config("Stress"); - logger = new Logger(true, true, "Stress"); - - HpcJava.setUsername(config.UserName); - HpcJava.setPassword(config.Password); - - //read config params - minCalls = Integer.parseInt(config.getValue("MinCalls")); - maxCalls = Integer.parseInt(config.getValue("MaxCalls")); - minClients = Integer.parseInt(config.getValue("MinClients")); - maxClients = Integer.parseInt(config.getValue("MaxClients")); - minBatches = Integer.parseInt(config.getValue("MinBatches")); - maxBatches = Integer.parseInt(config.getValue("MaxBatches")); - - /*int minDataKb = Integer.parseInt(config.getValue("MinDataKb")); - int maxDataKb = Integer.parseInt(config.getValue("MaxDataKb")); - int minTimeMs = Integer.parseInt(config.getValue("MinTimeMs")); - int maxTimeMs = Integer.parseInt(config.getValue("MaxTimeMs")); - */ - rand = new Random(); - } - - /** - * @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 - } - - /** - * durable concurrent multiple batches, n * m batches - */ - @Test - public void test_Stress_DurableConcurrentMultipleBatches() { - logger.Start("test_BVT_DurableConcurrentMultipleBatches"); - - - int NbOfCalls = minCalls+ rand.nextInt(maxCalls -minCalls); - int NbOfClients = minClients + rand.nextInt(maxClients - minClients); - int NbOfBatches = minBatches + rand.nextInt(maxBatches - minBatches); - - - 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(NbOfClients); - - Thread[] workers = new Thread[NbOfClients]; - for (int m = 0; m < NbOfClients; m++) { - workers[m] = new Thread(new ConcurrentClient(m, NbOfBatches, NbOfCalls, L, session, 0)); - } - for (int m = 0; m < NbOfClients; m++) { - workers[m].start(); - } - - L.await(10, TimeUnit.MINUTES); - - CountDownLatch L2 = new CountDownLatch(NbOfClients); - - for (int m = 0; m < NbOfClients; m++) { - workers[m] = new Thread(new ConcurrentClient(m,NbOfBatches, NbOfCalls, L2, session, 1)); - } - for (int m = 0; m < NbOfClients; m++) { - workers[m].start(); - } - - L2.await(10, TimeUnit.MINUTES); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_BVT_DurableConcurrentMultipleBatches"); - } - - /** - * interactive concurrent multiple batches, n * m batches - */ - @Test - public void test_Stress_InteractiveConcurrentMultipleBatches() { - logger.Start("test_BVT_InteractiveConcurrentMultipleBatches"); - - - int NbOfCalls = minCalls+ rand.nextInt(maxCalls -minCalls); - int NbOfClients = minClients + rand.nextInt(maxClients - minClients); - int NbOfBatches = minBatches + rand.nextInt(maxBatches - minBatches); - - - 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(NbOfClients); - - Thread[] workers = new Thread[NbOfClients]; - for (int m = 0; m < NbOfClients; m++) { - workers[m] = new Thread(new ConcurrentClient(m, NbOfBatches, NbOfCalls, L, session, 0)); - } - for (int m = 0; m < NbOfClients; m++) { - workers[m].start(); - } - - L.await(10, TimeUnit.MINUTES); - - CountDownLatch L2 = new CountDownLatch(NbOfClients); - - for (int m = 0; m < NbOfClients; m++) { - workers[m] = new Thread(new ConcurrentClient(m,NbOfBatches, NbOfCalls, L2, session, 1)); - } - for (int m = 0; m < NbOfClients; m++) { - workers[m].start(); - } - - L2.await(10, TimeUnit.MINUTES); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_BVT_InteractiveConcurrentMultipleBatches"); - } - - class ConcurrentClient implements Runnable { - public ConcurrentClient(int m, int NbOfBatches, int NbOfCalls, CountDownLatch l, SessionBase session, - int sendget) { - this.m = m; - this.l = l; - this.NbOfBatches = NbOfBatches; - this.NbOfCalls = NbOfCalls; - this.session = session; - this.sendget = sendget; - - } - - @Override - public void run() { - if (sendget == 0) { - for (int k = 0; k < NbOfBatches; k++) { - BrokerClient client = new BrokerClient( - "Client" + m + "_" + k, session, - AITestLibService.class); - - logger.Info("Client %s sending %d requests...", - m + "_" + k, NbOfCalls); - - for (int i = 0; i < NbOfCalls; i++) { - Echo request = Util.generateEchoRequest(m * k); - try { - client.sendRequest(request, i); - } catch (SessionException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - } - logger.Info("Client %s calling endRequests()...", m + "_" - + k); - try { - client.endRequests(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - l.countDown(); - } else if (sendget == 1) { - for (int k = 0; k < NbOfBatches; k++) { - BrokerClient client = new BrokerClient( - "Client" + m + "_" + k, session, - AITestLibService.class); - logger.Info("Client%s retrieving responses...", m + "_" + k); - try { - int count =0; - for (BrokerResponse response : client - .getResponses(EchoResponse.class)) { - try { - ComputerInfo reply = response.getResult() - .getEchoResult().getValue(); - count++; - - } catch (Throwable ex) { - logger.Error("Error in process request %s", - ex.toString()); - - } - - } - logger.assertEqual("response count should equal", count, NbOfCalls); - - } catch (SessionException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - logger.Info("Done retrieving %d responses", - NbOfCalls); - try { - client.close(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - l.countDown(); - } - - } - - private int m = 0; - private int NbOfBatches = 0; - private int NbOfCalls = 0; - private CountDownLatch l = null; - private SessionBase session = null; - private int sendget = 0; - - } - - - //read config params - private static int minCalls = 0; - private static int maxCalls = 0; - private static int minClients = 0; - private static int maxClients = 0; - private static int minBatches = 0; - private static int maxBatches = 0; - - private static Random rand = null; - - - private static Config config; - private static Logger logger; - - - -} diff --git a/test/unittest/DataClientTest.java b/test/unittest/DataClientTest.java deleted file mode 100644 index b01b531..0000000 --- a/test/unittest/DataClientTest.java +++ /dev/null @@ -1,268 +0,0 @@ -package unittest; - -import junit.framework.Assert; - -import org.junit.Test; - -import com.microsoft.hpc.scheduler.session.DataClient; -import com.microsoft.hpc.scheduler.session.DataLifeCycle; -import com.microsoft.hpc.exceptions.DataException; -import com.microsoft.hpc.scheduler.session.SessionException; - -public class DataClientTest -{ - static String serverName = "vincent-hpc"; - static String userName = "fareast\\wsdcta"; - static String password = "Pa55word$$4"; - - @Test - public void testBasic() { - byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; - try { - DataClient c = DataClient.create("Test", serverName, userName, - password); - c.writeRawBytesAll(data); - c.close(); - - DataClient d = DataClient.open("Test", serverName, userName, - password); - byte[] result = d.readRawBytesAll(); - - int i = 0; - for (byte b : result) { - Assert.assertEquals(data[i], b); - i++; - } - d.close(); - - DataClient.delete("Test", serverName, userName, password); - } catch (DataException e) { - // TODO Auto-generated catch block - Assert.fail(e.getMessage()); - } catch (Exception ex) { - ex.printStackTrace(); - Assert.fail(ex.getMessage()); - } - } - - @Test - public void testBasic2() { - byte[] data = { 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 7 }; - try { - DataClient c = DataClient.create("Test", serverName, userName, - password); - c.writeRawBytesAll(data); - c.close(); - - DataClient d = DataClient.open("Test", serverName, userName, - password); - byte[] result = d.readRawBytesAll(); - - int i = 0; - for (byte b : result) { - Assert.assertEquals(data[i], b); - i++; - } - d.close(); - DataClient.delete("Test", serverName, userName, password); - } catch (DataException e) { - // TODO Auto-generated catch block - Assert.fail(e.getMessage()); - } catch (Exception ex) { - ex.printStackTrace(); - Assert.fail(ex.getMessage()); - } - } - - @Test - public void testCompress() { - byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; - try { - DataClient.delete("Test2", serverName, userName, password); - DataClient c = DataClient.create("Test2", serverName, userName, - password); - c.writeRawBytesAll(data, true); - c.close(); - - DataClient d = DataClient.open("Test2", serverName, userName, - password); - byte[] result = d.readRawBytesAll(); - - int i = 0; - for (byte b : result) { - Assert.assertEquals(data[i], b); - i++; - } - d.close(); - DataClient.delete("Test2", serverName, userName, password); - } catch (DataException e) { - // TODO Auto-generated catch block - Assert.fail(e.getMessage()); - } - } - - @Test - public void testLifecycle() { - byte[] data = { 1, 2, 3, 4, 5, 6, 7 }; - try { - DataClient.delete("Test2", serverName, userName, password); - DataClient c = DataClient.create("Test2", serverName, userName, - password); - c.setDataLifeCycle(new DataLifeCycle(10)); - c.writeRawBytesAll(data, true); - c.close(); - - DataClient d = DataClient.open("Test2", serverName, userName, - password); - byte[] result = d.readRawBytesAll(); - - int i = 0; - for (byte b : result) { - Assert.assertEquals(data[i], b); - i++; - } - d.close(); - - DataClient.delete("Test2", serverName, userName, password); - } catch (DataException e) { - // TODO Auto-generated catch block - Assert.fail(e.getMessage()); - } - } - - @Test - public void testCompress2() { - byte[] data = { 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, - 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, - 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, - 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, 1, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, 6, 7, - 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 61, 2, 3, 4, 5, - 6, 7, 1, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, - 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, - 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, - 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6, 71, 2, 3, 4, 5, 6 }; - try { - DataClient.delete("Test2", serverName, userName, password); - DataClient c = DataClient.create("Test2", serverName, userName, - password); - c.writeRawBytesAll(data, true); - c.close(); - - DataClient d = DataClient.open("Test2", serverName, userName, - password); - byte[] result = d.readRawBytesAll(); - - int i = 0; - for (byte b : result) { - Assert.assertEquals(data[i], b); - i++; - } - d.close(); - DataClient.delete("Test2", serverName, userName, password); - } catch (DataException e) { - // TODO Auto-generated catch block - Assert.fail(e.getMessage()); - } - } - - String ConvertPath(String original, String runtimeShare) - { - int firstSlash = original.indexOf('\\', 3); - int secondSlash = original.indexOf('\\', firstSlash + 1); - - if (secondSlash == -1) - { - return null; - } - - String result = runtimeShare + original.substring(secondSlash); - return result.replace('\\', '/'); - } - - @Test - public void testConvertPath() { - String data = "\\\\junsuwin\\runtime$\\soa\\data\\14\\1.dat"; - - Assert.assertEquals("/mnt/smb/soa/data/14/1.dat",ConvertPath(data, "/mnt/smb")); - } -} diff --git a/test/unittest/SessionInfoTest.java b/test/unittest/SessionInfoTest.java deleted file mode 100644 index eae1290..0000000 --- a/test/unittest/SessionInfoTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - */ -package unittest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; - -import org.junit.BeforeClass; -import org.junit.Test; - -import com.microsoft.hpc.scheduler.session.HpcJava; -import com.microsoft.hpc.scheduler.session.SessionUnitType; -import com.microsoft.hpc.scheduler.session.SessionStartInfo; -import com.microsoft.hpc.scheduler.session.Version; - -/** - * @author junsu - * - */ -public class SessionInfoTest -{ - static String serverName = "junsuwin"; - static String userName = "fareast\\wsdcta"; - static String password = "Pa55word##3"; - - @BeforeClass - public static void before() { - HpcJava.setPassword(password); - HpcJava.setUsername(userName); - } - - @Test - public void TestBasicProperty() { - SessionStartInfo info = new SessionStartInfo("A", "B"); - assertEquals("headnode is not match", info.getHeadnode(), "A"); - assertEquals("service name is not match", info.getServiceName(), "B"); - - assertEquals("default security is not true", true, info.isSecure()); - assertEquals("default sharesession is not false", false, - info.isShareSession()); - } - - @Test - public void TestUnittype() { - SessionStartInfo info = new SessionStartInfo("A", "V"); - info.setResourceUnitType(SessionUnitType.Socket); - assertEquals("Resource Unit Type is not matched", - SessionUnitType.Socket, info.getResourceUnitType()); - - info.setClientIdleTimeout(3000); - assertEquals("clientIdleTimeout", info.clientIdleTimeout(), 3000); - } - - @Test - public void TestEnv() { - SessionStartInfo info = new SessionStartInfo("A", "V"); - info.addEnvironment("A", "B"); - info.addEnvironment("C", "D"); - - HashMap k = info.getEnvironments(); - assertEquals("env is wrong", "B", k.get("A")); - assertEquals("env is wrong", "D", k.get("C")); - } - - @Test - public void TestVersion() { - Version Version10 = new Version(1, 0); - Version Version12 = new Version(1, 2); - - Version Version1000 = new Version(1, 0, 0, 0); - Version Version1020 = new Version(1, 0, 2, 0); - - assertTrue(Version12.compareTo(Version10) > 0); - assertTrue(Version1020.compareTo(Version10) > 0); - assertTrue(Version10 == Version10); - } - - @Test - public void TestCrash() { - SessionStartInfo info = new SessionStartInfo("A", "V"); - assertEquals("getResourceUnitType", info.getResourceUnitType(), - SessionUnitType.Core); - assertEquals("nodeGroupsStr", info.getNodeGroups(), null); - assertEquals("serviceJobName", info.getServiceJobName(), null); - assertEquals("isCanPreempt", info.isPreemptive(), false); - } -} diff --git a/test/unittest/SessionPoolTest.java b/test/unittest/SessionPoolTest.java deleted file mode 100644 index e388886..0000000 --- a/test/unittest/SessionPoolTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package unittest; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.BeforeClass; -import org.junit.Test; - -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; -import com.microsoft.hpc.scheduler.session.SessionUnitType; - -public class SessionPoolTest -{ - static String schedulerName = "qingzhi-2008r2"; - static String userName = "fareast\\wsdcta"; - static String password = "Pa55word$$4"; - - @BeforeClass - public static void before() - { - HpcJava.setPassword(password); - HpcJava.setUsername(userName); - } - - @Test - public void CheckInvalidParameter() - { - try - { - SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(false); - info.setUseSessionPool(true); - - DurableSession session1 = DurableSession.createSession(info); - session1.close(); - } - catch(IllegalArgumentException e) { - System.out.println(e.getMessage()); - assertTrue(e.getMessage().compareTo("Session pool is not supported by unshared session.") == 0); - } - catch (Exception e) { - e.printStackTrace(); - fail("unexpected exception"); - } - } - - @Test - public void UseDurableSessionPoolForSameService() - { - try - { - SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(true); - - DurableSession session1 = DurableSession.createSession(info); - session1.close(false); - - info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(true); - DurableSession session2 = DurableSession.createSession(info); - session2.close(); - - assertTrue(session1.getId() == session2.getId()); - } - catch (Exception e) { - e.printStackTrace(); - fail("unexpected exception"); - } - } - - @Test - public void UseInteractiveSessionPoolForSameService() - { - try - { - SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(true); - - Session session1 = Session.createSession(info); - session1.close(false); - - info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(true); - Session session2 = Session.createSession(info); - session2.close(); - - assertTrue(session1.getId() == session2.getId()); - } - catch (Exception e) { - e.printStackTrace(); - fail("unexpected exception"); - } - } - - @Test - public void NotUseSessionPoolForSameService() - { - try - { - SessionStartInfo info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(false); - - DurableSession session1 = DurableSession.createSession(info); - session1.close(false); - - info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setShareSession(true); - info.setUseSessionPool(false); - DurableSession session2 = DurableSession.createSession(info); - session2.close(); - - assertTrue(session1.getId() != session2.getId()); - } - catch (Exception e) { - e.printStackTrace(); - fail("unexpected exception"); - } - } - - @Test - public void NotUseSessionPoolForDiffService() - { - try - { - SessionStartInfo info = new SessionStartInfo(schedulerName, "aitestservicelib"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setUseSessionPool(true); - info.setShareSession(true); - DurableSession session1 = DurableSession.createSession(info); - session1.close(false); - - info = new SessionStartInfo(schedulerName, "CcpEchoSvc"); - info.setResourceUnitType(SessionUnitType.Core); - info.setMaxUnits(1); - info.setMinUnits(1); - info.setUseSessionPool(true); - info.setShareSession(true); - DurableSession session2 = DurableSession.createSession(info); - session2.close(); - - assertTrue(session2.getId() != session1.getId()); - session1.close(); - } - catch (Exception e) { - e.printStackTrace(); - fail("unexpected exception"); - } - } -} diff --git a/test/unittest/SessionTest.java b/test/unittest/SessionTest.java deleted file mode 100644 index a129816..0000000 --- a/test/unittest/SessionTest.java +++ /dev/null @@ -1,645 +0,0 @@ -package unittest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import java.lang.reflect.Method; -import java.net.SocketTimeoutException; -import java.util.Date; - -import javax.xml.bind.JAXBElement; -import javax.xml.namespace.QName; -import javax.xml.soap.SOAPException; -import javax.xml.ws.Service; -import javax.xml.ws.soap.SOAPBinding; -import javax.xml.ws.soap.SOAPFaultException; - -import junit.framework.Assert; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.tempuri.CcpEchoSvc; -import org.tempuri.Echo; -import org.tempuri.EchoResponse; -import org.tempuri.GenerateLoad; -import org.tempuri.GenerateLoadResponse; -import org.tempuri.IEchoSvc; -import org.tempuri.StatisticInfo; - -import com.microsoft.hpc.genericservice.GenericOperation; -import com.microsoft.hpc.genericservice.GenericService; -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.SessionBase; -import com.microsoft.hpc.scheduler.session.SessionException; -import com.microsoft.hpc.scheduler.session.SessionStartInfo; -import com.microsoft.hpc.scheduler.session.Version; - -public class SessionTest -{ - - static String serverName = "junsuwin"; - static String userName = "fareast\\wsdcta"; - static String password = "Pa55word$$4"; - - @BeforeClass - public static void before() { - HpcJava.setPassword(password); - HpcJava.setUsername(userName); - } - - /** - * Creates a request class using the specified objects as input - * - * The order of input should be the order they appear in the - * TRequest class. - * The function works by iterating through all set[requestClass] - * methods and call the corresponding ObjectFactory, if necessary, to create - * the input. - * - * @param - * return type - * @param requestClass - * instance to create - * @param args - * input objects - * @return A request to be sent to the broker using SendRequest - * @see BrokerClient#sendRequest(Object) - */ - public static TRequest createRequest( - Class requestClass, Object... args) { - return createRequest(requestClass, null, args, false); - } - - /** - * Creates a request class using the specified objects as input - * - * The order of input should be the order they appear in the - * TRequest class - * The function works by iterate through all set[requestClass] - * methods and call the corresponding ObjectFactory, if necessary, to create - * the input. - * - * @param - * return type - * @param requestClass - * instance to create - * @param classNames - * class names to check each argument against - * @param args - * input objects - * @return A request to be sent to the broker using SendRequest - * @see BrokerClient#sendRequest(Object) - */ - public static TRequest createRequest( - Class requestClass, Class classNames[], Object args[]) { - return createRequest(requestClass, classNames, args, true); - } - - /** - * Creates a request class using the specified objects as input - * - * @param - * return type - * @param requestClass - * instance to create - * @param classNames - * class names to check against - * @param args - * input objects - * @return A request to be sent to the broker using SendRequest - * @see BrokerClient#sendRequest(Object) - */ - private static TRequest createRequest( - Class requestClass, Class classNames[], Object args[], - boolean checkClassArgs) { - TRequest request; - try { - if (checkClassArgs && (args.length != classNames.length)) - throw new Exception(); - request = requestClass.newInstance(); - Class ObjectFactory = Class.forName(requestClass.getPackage() - .getName() + ".ObjectFactory"); - Object of = ObjectFactory.newInstance(); - int i = 0; - for (Method t : requestClass.getDeclaredMethods()) { - if (t.getName().startsWith("set")) { - String parameter = t.getName().substring("set".length()); - if (t.getParameterTypes()[0] == JAXBElement.class) { - for (Method ob : ObjectFactory.getDeclaredMethods()) { - String methodName = ob.getName(); - boolean nameisValid = methodName - .startsWith("create" - + requestClass.getSimpleName() - + parameter) - && !methodName.contains("Response"); - // && methodName.contains(parameter); - - if (nameisValid) { - if (!checkClassArgs - || ob.getParameterTypes()[0] == classNames[i]) - t.invoke(request, ob.invoke(of, args[i])); - else - throw new Exception(); - } - } - } else if (!checkClassArgs - || (t.getParameterTypes()[0] == classNames[i])) { - t.invoke(request, args[i]); - } else { - throw new Exception(); - } - i++; - } - } - } catch (Exception e) { - throw new IllegalArgumentException(); - } - return request; - } - - @Test - public void testCreateSession() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc", - userName, password); - Session session = null; - try { - session = Session.createSession(info); - session.close(true); - return; - } catch (SocketTimeoutException e) { - fail("unexpect failure:" + e.getMessage()); - } catch (SessionException e) { - fail("unexpect failure:" + e.getMessage()); - } - - assertNotNull("Create Interactive Session Failed", session); - } - - @Test - public void testCreateSession2() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc", - new Version(2, 0)); - Session session = null; - try { - session = Session.createSession(info); - session.close(true); - return; - } catch (SocketTimeoutException e) { - fail("unexpect failure:" + e.getMessage()); - } catch (SessionException e) { - fail("unexpect failure:" + e.getMessage()); - } - - assertNotNull("Create Interactive Session Failed", session); - } - - @Test - public void testCreateDurableSession() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - session.close(true); - return; - } catch (SocketTimeoutException e) { - fail("unexpect failure:" + e.getMessage()); - } catch (SessionException e) { - fail("unexpect failure:" + e.getMessage()); - } - - assertNotNull("Create Interactive Session Failed", session); - } - - @Test - public void testV2client() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(false); - Session session = null; - try { - session = Session.createSession(info); - - Service svc = Service.create(CcpEchoSvc.SERVICE); - QName portName = new QName("http://hpc.microsoft.com", - "HpcBrokerClientHttpsPort"); - svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, - session.getEndpointReference()); - IEchoSvc client = svc.getPort(portName, IEchoSvc.class); - - assertNotNull("return null", client.echo("HelloWorld")); - - session.close(true); - return; - } catch (SocketTimeoutException e) { - fail("unexpect failure:" + e.getMessage()); - } catch (SessionException e) { - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testBrokerClient() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(true); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - echo.sendRequest(req, ""); - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - fail("unexpect failure:" + e.getMessage()); - e.printStackTrace(); - } - } - - @Test - public void testGenericService() { - SessionStartInfo info = new SessionStartInfo(serverName, - "GenericService1"); - info.setSecure(false); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, GenericService.class); - GenericOperation req = SessionTest - . createRequest(GenericOperation.class, - "hello world"); - - req = new GenericOperation(); - req.setArgs(new com.microsoft.hpc.genericservice.ObjectFactory() - .createGenericOperationArgs("A")); - - echo.sendRequest(req, ""); - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - fail("unexpect failure:" + e.getMessage()); - e.printStackTrace(); - } - } - - @Test - public void testSecureBrokerClient() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(true); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - echo.sendRequest(req); - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testGetResponse() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(true); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - echo.sendRequest(req, "SA"); - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - assertEquals(r.getUserData(), "SA"); - System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testManyRequest() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(false); - Session session = null; - try { - session = Session.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - for (int i = 0; i < 4000; i++) { - echo.sendRequest(req); - } - - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - // System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testResponseHandler() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(false); - - try { - final Session session = Session.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - echo.setResponseHandler(EchoResponse.class, - new ResponseListener() { - int fetchedCount = 0; - - @Override - public void endOfMessage() { - Assert.assertEquals(10, fetchedCount); - synchronized (session) { - session.notify(); - } - } - - @Override - public void raiseError(Exception e) { - fail(e.getMessage()); - } - - @Override - public void responseReturned( - BrokerResponse response) { - try { - fetchedCount++; - String value = response.getResult() - .getEchoResult().getValue(); - assertNotNull("result is null", value); - } catch (SOAPFaultException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - fail("failed with exception: " + e.getMessage()); - } catch (SOAPException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - fail("failed with exception: " + e.getMessage()); - } - } - - }); - - for (int i = 0; i < 10; i++) { - echo.sendRequest(req); - } - - echo.endRequests(); - synchronized (session) { - session.wait(); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testFlush() { - int fetchedCount = 0; - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - echo.sendRequest(req); - echo.flush(); - echo.sendRequest(req); - echo.sendRequest(req); - echo.flush(); - echo.sendRequest(req); - echo.endRequests(); - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - fetchedCount++; - } - Assert.assertEquals(4, fetchedCount); - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void testTimeout() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(false); - try { - Session session; - session = Session.createSession(info, 10); - Assert.fail(); - } catch (SocketTimeoutException s) { - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - - fail("didn't fail with timeout"); - } - - @Test - public void testManyRequestWithMultiThreads() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - info.setSecure(false); - Session session = null; - try { - Date d = new Date(); - session = Session.createSession(info); - - final BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - final Echo req = SessionTest. createRequest(Echo.class, - "hello world"); - - Runnable runnable = new Runnable() { - public void run() { - for (int i = 0; i < 400; i++) { - try { - echo.sendRequest(req); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }; - - Thread[] threads = new Thread[10]; - for (int i = 0; i < 10; i++) { - threads[i] = new Thread(runnable); - threads[i].start(); - } - for (int i = 0; i < 10; i++) { - threads[i].join(); - } - - echo.endRequests(); - - Date end = new Date(); - System.out.println(end.getTime() - d.getTime()); - - Iterable> p = echo - .getResponses(EchoResponse.class); - for (BrokerResponse r : p) { - String value = r.getResult().getEchoResult().getValue(); - assertNotNull("result is null", value); - // System.out.println(value); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void test64KMsg() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - - BrokerClient echo = new BrokerClient( - "clientid0", session, CcpEchoSvc.class); - GenerateLoad req = SessionTest. createRequest( - GenerateLoad.class, (double) 100.0, new byte[1024 * 64], - null); - - echo.sendRequest(req); - echo.endRequests(); - Iterable> p = echo - .getResponses(GenerateLoadResponse.class); - for (BrokerResponse r : p) { - StatisticInfo value = r.getResult().getGenerateLoadResult() - .getValue(); - assertNotNull("result is null", value); - } - session.close(true); - return; - } catch (Exception e) { - e.printStackTrace(); - fail("unexpect failure:" + e.getMessage()); - } - } - - @Test - public void TestNoServiceVersion() { - try { - Version[] t = Session.GetServiceVersions(serverName, "CCPEchoSvc", - HpcJava.getUsername(), HpcJava.getPassword()); - assertEquals("t should be 1.", t.length, 1); - assertEquals("t should be 1.", t[0], SessionBase.NoServiceVersion); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void TestGetServerVersion() { - SessionStartInfo info = new SessionStartInfo(serverName, "CCPEchoSvc"); - DurableSession session = null; - try { - session = DurableSession.createSession(info); - Version v = session.getServerVersion(); - assertEquals("major version is 3.", v.getMajor(), 3); - assertEquals("minor version is 2.", v.getMinor(), 2); - assertEquals(v.toString(), "3.2.3674.0"); - session.close(); - } catch (SessionException e) { - fail("unexpected exception"); - } catch (SocketTimeoutException e) { - fail("unexpected exception"); - } - } -} From 5dc4bde3a8d6a50ef405cd9b6b64e97d2cc1cc4a Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Mon, 30 Jan 2012 17:41:29 +0800 Subject: [PATCH 04/23] change the manifest files used in Linux --- src/makejar.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/makejar.sh b/src/makejar.sh index d71bf2e..7945e7c 100644 --- a/src/makejar.sh +++ b/src/makejar.sh @@ -1,9 +1,9 @@ #!/bin/sh -export CXF_HOME=/usr/java/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 manifestclient 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-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 manifesthost com/microsoft/hpc/servicehost +jar cvfm Microsoft-HpcServiceHost-3.0.jar manifesthost_linux com/microsoft/hpc/servicehost From c4e75bff6b265b41c76b1bec87bd5c926ca9322f Mon Sep 17 00:00:00 2001 From: MicrosoftHPC Date: Wed, 1 Feb 2012 11:15:32 +0800 Subject: [PATCH 05/23] Add new user preference RequireSSLValidation (by default false) to enable/disable SSL validation. --- .../microsoft/hpc/scheduler/session/CxfClientBase.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/microsoft/hpc/scheduler/session/CxfClientBase.java b/src/com/microsoft/hpc/scheduler/session/CxfClientBase.java index 986b7e2..b545e57 100644 --- a/src/com/microsoft/hpc/scheduler/session/CxfClientBase.java +++ b/src/com/microsoft/hpc/scheduler/session/CxfClientBase.java @@ -68,6 +68,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.prefs.*; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; @@ -93,7 +94,6 @@ */ class CxfClientBase implements CallbackHandler { - // the service proxy object Object serviceObj; @@ -105,7 +105,7 @@ class CxfClientBase implements CallbackHandler // the client object org.apache.cxf.endpoint.Client client; - + /** * Setup the common security settings for Http/https call to SOA services * @@ -124,7 +124,9 @@ void Initialize(String username, String password, Object serviceObj) { addWSSHeaders(cxfEndpoint); // skip SSL setup - trustAll((HTTPConduit) client.getConduit()); + Preferences prefs = Preferences.userNodeForPackage(getClass()); + if (!prefs.getBoolean("RequireSSLValidation", false)) + trustAll((HTTPConduit) client.getConduit()); } // debug purpose From 280eba1efb6c6bcea154cfc2dbc11bff0787848f Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Wed, 1 Feb 2012 13:29:45 +0800 Subject: [PATCH 06/23] Update the readme file for the ssl certificate setup and the test config data file --- README | 29 ++++++++++ src/manifestclient_linux | 2 +- src/manifesthost_linux | 2 +- test/TestCase/TestData.xml | 112 ++++++++++++++++++++----------------- 4 files changed, 93 insertions(+), 52 deletions(-) diff --git a/README b/README index c43b0a0..ee1b207 100644 --- a/README +++ b/README @@ -53,6 +53,35 @@ 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. + - download java code: http://techblog.kz/wp-content/uploads/InstallCert.java + + + - Create the environment variable JAVA_HOME and set it to the Java installation path. + + - "$JAVA_HOME/bin/javac" InstallCert.java + + a) Create head node certificate. + - "$JAVA_HOME/bin/java" InstallCert + - The above should create a file called "jssecacerts" + - copy jssecacerts to overwrite $JAVA_HOME/jre/lib/security/cacerts (NOTE: You need administrate privilege on Vista/7) + + b) Create broker node certificate. + - "$JAVA_HOME/bin/java" InstallCert + - The above should create a file called "jssecacerts" + - copy jssecacerts to overwrite $JAVA_HOME/jre/lib/security/cacerts + + This is expected to overwrite the cacerts created in a). + + 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 certificate is not required. + How to use ========== 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_linux b/src/manifesthost_linux index ee999f5..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/lib/cxf-manifest.jar +Class-Path: Microsoft-HpcSession-3.0.jar /usr/java/apache-cxf-2.4.0/lib/cxf-manifest.jar diff --git a/test/TestCase/TestData.xml b/test/TestCase/TestData.xml index 4b3ef46..2cdeab6 100644 --- a/test/TestCase/TestData.xml +++ b/test/TestCase/TestData.xml @@ -1,55 +1,67 @@ - - - - -headnode -username -password -JavaTestService -10 -3 -2 - username2 - password2 - 2 - - -12 -BVTValue1 - - - - -SoaGenericTestService + + + + +shpc-0042 +fareast\wsdcta +Pa55word&&7 +AITestServiceLib +10 +3 +2 + fareast\wsdcta2 + Pa55word&&7 + 2 + + +12 +BVTValue1 + + + + +SoaGenericTestService + + + + aitestservicelib + + aitestservicelib + + \\shpc-0042\runtime$ + 1024,32768,1048576,4194304,16777216,67108864,104857600 + \\Mingqing-box\TestConfig-1 + - - - JavaTestService - - JavaTestService - - \\shpc-0050\CommonData2 + + \\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 - - - - - \ No newline at end of file + + \\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 + + + + + From e9e0490fc653996e64f8a5ec5bdb00d911398c09 Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Wed, 1 Feb 2012 15:27:25 +0800 Subject: [PATCH 07/23] Update test cases and version number for the master branch. --- .../hpc/scheduler/session/SessionBase.java | 2 +- test/TestCase/TestData.xml | 10 +- test/TestCase/functiontest/BVT.java | 2894 +++++----- .../functiontest/BrokerClientTest.java | 5041 +++++++++-------- .../functiontest/BrokerResponseTest.java | 372 +- .../functiontest/CommonDataBytes.java | 52 +- .../functiontest/CommonDataHelper.java | 554 +- .../functiontest/CommonDataTestActionId.java | 70 +- .../functiontest/CommonDataTestDurable.java | 606 +- .../CommonDataTestInteractive.java | 606 +- test/TestCase/functiontest/Config.java | 200 +- .../functiontest/DataClientHelper.java | 194 +- .../TestCase/functiontest/DataClientTest.java | 2866 +++++----- .../functiontest/DurableSessionTest.java | 2568 ++++----- .../functiontest/GenericServiceTest.java | 460 +- test/TestCase/functiontest/Logger.java | 529 +- .../functiontest/SessionAttachInfoTest.java | 349 +- .../functiontest/SessionBaseTest.java | 916 +-- test/TestCase/functiontest/SessionPool.java | 1182 ++-- .../functiontest/SessionStartInfoTest.java | 1016 ++-- test/TestCase/functiontest/SessionTest.java | 1005 ++-- test/TestCase/functiontest/Util.java | 162 +- 22 files changed, 11035 insertions(+), 10619 deletions(-) diff --git a/src/com/microsoft/hpc/scheduler/session/SessionBase.java b/src/com/microsoft/hpc/scheduler/session/SessionBase.java index 3907040..80bf5a9 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionBase.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionBase.java @@ -85,7 +85,7 @@ public class SessionBase /** * the client version */ - private static Version clientVersion = new Version(3, 3); + private static Version clientVersion = new Version(4, 0); /* * the Magic Infinite date diff --git a/test/TestCase/TestData.xml b/test/TestCase/TestData.xml index 2cdeab6..d604367 100644 --- a/test/TestCase/TestData.xml +++ b/test/TestCase/TestData.xml @@ -2,15 +2,15 @@ -shpc-0042 -fareast\wsdcta -Pa55word&&7 +headnode +username +password AITestServiceLib 10 3 2 - fareast\wsdcta2 - Pa55word&&7 + username2 + password2 2 diff --git a/test/TestCase/functiontest/BVT.java b/test/TestCase/functiontest/BVT.java index 0428677..810e59a 100644 --- a/test/TestCase/functiontest/BVT.java +++ b/test/TestCase/functiontest/BVT.java @@ -1,1442 +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()); - } - - SessionAttachInfo attInfo = new SessionAttachInfo(config.Scheduler, - sessionId, config.UserName, config.Password); - - try { - session = Session.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); - // 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 (session != null) { - try { - session.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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - 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; - -} +/** + * + */ +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 index 8819920..cd50fb9 100644 --- a/test/TestCase/functiontest/BrokerClientTest.java +++ b/test/TestCase/functiontest/BrokerClientTest.java @@ -1,2440 +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); - - logger.Start("BrokerClientTest"); - - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - if (dClient != null) - dClient.close(true); - - if (iClient != null) - iClient.close(true); - - logger.End("BrokerClientTest"); - } - - /** - * 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() { - 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 : %s", e.getMessage()); - } catch (Throwable e) { - logger.Error("UE : %s", e.getMessage()); - } - - 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 : %s", e.getMessage()); - } catch (Throwable e) { - logger.Error("UE : %s", e.getMessage()); - } - - } - - /** - * 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() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } - } - - } - - /** - * 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() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(null); - logger.Error("Excetion is expected. d null"); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(1); - logger.Error("Excetion is expected. i int"); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(true); - logger.Error("Excetion is expected. i boolean "); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object)} - * . - */ - @Test - public final void testSendRequestObjectObject() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request, 1); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - try { - iClient.sendRequest(null, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(null, "datat"); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(new Object(), 1); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(new Object(), "data"); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, null); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - // 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()); e.printStackTrace(); } - * - * try { iClient.sendRequest(request, request); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - * - * try { dClient.sendRequest(request, true); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - } - - /** - * 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() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", - "http://tempuri.org/IEchoSvc/Echo"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); e.printStackTrace(); } - * - * try { dClient.sendRequest(request, "datat", ""); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - try { - iClient.sendRequest(request, 1, null); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - /* - * try { dClient.sendRequest(request, "datat", "&^(&^%$#{}?_?#@*"); - * logger.Error("Excetion is expected."); } catch (SessionException e) { - * logger.Info("Expected exception when sending requests %s", - * e.toString()); e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(java.lang.Class)} - * . - */ - @Test - public final void testGetResponses() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (NullPointerException e) { - logger.Info("Expected excpetion when getting responses %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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() { - - // 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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", - e.toString()); - e.printStackTrace(); - } - - }); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * 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() { - - // boundary - // when the responsehandler is null - Echo request = Util.generateEchoRequest(); - - try { - iClient.setResponseHandler(EchoResponse.class, null); - logger.Error("EE is not thrown."); - } catch (NullPointerException e) { - logger.Info("NullPointerException is expected."); - e.printStackTrace(); - } - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(3000); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } // BUG this cannot throw InvalidOperationException - - // boundary - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests(int)} - * . - */ - @Test - public final void testEndRequestsInt_1() { - // functional - Echo request = Util.generateEchoRequest(); - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(0); - } catch (Throwable e) { - logger.Error("UE for 0 timeout %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - } - - @Test - public final void testEndRequestsInt_0() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(-1); - logger.Error("EE is not thrown. -1"); - } catch (Throwable e) { - logger.Info("Expected Exception %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(Integer.MIN_VALUE); - logger.Error("EE is not thrown. min"); - } catch (Throwable e) { - logger.Info("Expected Exception %s", e.toString()); - e.printStackTrace(); - } - - /* - * 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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test - public final void testFlush() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test(timeout = 180000) - public final void testFlush_1() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } - } - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(); // BUG flush should throw SessionException or - // InvalidOperationException - dClient.endRequests(); - } catch (Throwable e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush()}. - */ - @Test(timeout = 180000) - public final void testFlush_Bug1() { - - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(); - //dClient.endRequests(); - } catch (Throwable e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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 %s", - e.toString()); - - } - }); - - 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()); - * e.printStackTrace(); } - */ - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#flush(int)}. - */ - @Test - public final void testFlushInt() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(3000); // BUG flush should throw SessionException or - // InvalidOperationException - } catch (Throwable e) { - logger.Error("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - - try { - dClient.flush(-1); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(1); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.flush(0); - logger.Error("Expected exception is not thrown"); - - } catch (Throwable e) { - logger.Info("Excpetion when flushing requests %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. - */ - @Test - public final void testEndRequests() { - - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.endRequests(); // BUG this cannot throw - // InvalidOperationException - } catch (Throwable e) { - logger.Error("Excpetion when end requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#endRequests()}. - */ - @Test - public final void testEndRequests_1() { - - // boundary - Echo request = Util.generateEchoRequest(); - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when end requests %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close()}. - */ - @Test - public final void testClose() { - // functional - // bug 11821 - - try { - dClient.close(); - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean)} - * . - */ - @Test - public final void testCloseBoolean() { - // functional - // bug 11821 - - try { - dClient.close(true); - } catch (IllegalStateException e) { - logger.Info("IllegalStateException is thrown. %s", e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - // 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt() { - // functional - - try { - dClient.close(false, 5000); - dClient = null; - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#close(java.lang.Boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt_1() { - // boundary - // bug 11821 - - try { - dClient.close(false, -1); - logger.Error("EException is not thrown"); - } catch (Throwable e) { - logger.Info("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } - - - - try { - dClient.close(true, 1); - logger.Error("EException is not thrown"); - } catch (Throwable e) { - logger.Info("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.close(true, 0); - - } catch (Throwable e) { - logger.Error("Excpetion when close the client %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#sendRequest(java.lang.Object, java.lang.Object, int)} - * . - */ - @Test - public final void testSendRequestObjectObjectInt() { - Echo request = Util.generateEchoRequest(); - // function - try { - iClient.sendRequest(request, 1, 5000); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", Integer.MAX_VALUE); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, 0); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, 1, -5000); - logger.Error("Excetion is expected."); - } catch (SessionException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - try { - iClient.sendRequest(request, null, 1); - logger.Error("Excetion is expected."); - } catch (NullPointerException e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Info("Expected exception when sending requests %s", - e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - iClient.sendRequest(request, 1, "http://tempuri.org/IEchoSvc/Echo", - 5000); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - dClient.sendRequest(request, "data", - "http://tempuri.org/IEchoSvc/Echo", 0); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - // boundary - } - - - /** - * Test method for GetRequestCount - */ - @Test - public final void testGetRequestCount() { - - 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 %s", ex.toString()); - - } - - } - - 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 %s",e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("UE is thrown %s",e.toString()); - e.printStackTrace(); - } - - - - - - } - - /** - * Test method for GetStatus - */ - @Test - public final void testGetStatus() { - - 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 %s", ex.toString()); - - } - - } - - 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 %s",e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("UE is thrown %s",e.toString()); - e.printStackTrace(); - } - - - - - - } - - /** - * 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 - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} - * . - */ - @Test - public void testGetResponsesInt() { - // functional - Echo request = Util.generateEchoRequest(); - - try { - dClient.sendRequest(request, "data"); - dClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#getResponses(int)} - * . - */ - @Test - public void testGetResponsesInt_E1() { - // functional - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Exception in getResponse %s", e.toString()); - e.printStackTrace(); - } - } catch (SessionException e) { - logger.Error("Excpetion when getting responses %s", e.toString()); - e.printStackTrace(); - } - - // 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - 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()); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when getting responses %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(java.lang.Class, com.microsoft.hpc.scheduler.session.ResponseListener, int)} - * . - */ - @Ignore - public void testSetResponseHandlerClassOfTMessageResponseListenerOfTMessageInt() { - - // 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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()); - e.printStackTrace(); - l.countDown(); - } - - }, 15000); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - - /** - * 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 - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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", - e.toString()); - e.printStackTrace(); - } - - }, 0); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * 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 - - 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 %s", - e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", - e.toString()); - e.printStackTrace(); - } - 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"); - e.printStackTrace(); - l.countDown(); - return; - } - } - logger.Error("Error in process request %s raised error", - e.toString()); - e.printStackTrace(); - l.countDown(); - return; - - } - - }, 5); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(2, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObject() { - - // functional - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObjectInt() { - // functional - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }, 5000); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerClient#setResponseHandler(com.microsoft.hpc.scheduler.session.ResponseListener, int)} - * . - */ - @Test - public void testSetResponseHandlerResponseListenerOfObjectInt_E1() { - // boundary - - 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 %s", e.toString()); - e.printStackTrace(); - } catch (SOAPException e) { - logger.Error("Error in process request %s", e.toString()); - e.printStackTrace(); - } - 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", e.toString()); - e.printStackTrace(); - } - - }, 0); - - try { - iClient.sendRequest(request, "data"); - iClient.endRequests(); - } catch (SessionException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Excpetion when sending requests %s", e.toString()); - e.printStackTrace(); - } - - try { - l.await(10, TimeUnit.MINUTES); - } catch (InterruptedException e1) { - logger.Error("Excpetion when awaiting latch %s", e1.toString()); - e1.printStackTrace(); - } - - } - - 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; - -} +/** + * + */ +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 index cd6bbd1..5550f79 100644 --- a/test/TestCase/functiontest/BrokerResponseTest.java +++ b/test/TestCase/functiontest/BrokerResponseTest.java @@ -1,182 +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 { - logger.Start("BrokerResponseTest"); - - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("BrokerResponseTest"); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getMessage()}. - */ - @Test - public final void testGetMessage() { - logger.Info(iResponse.getMessage().toString()); - logger.Info(iResponse.getMessage().getContentDescription()); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getResult()}. - */ - @Test - public final void testGetResult() { - 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.printStackTrace(); - } catch (SOAPException e) { - logger.Error("response getresult error"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SOAPException e) { - logger.Error("response getresult error"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getUserData()}. - */ - @Test - public final void testGetUserData() { - - logger.assertEqual("get user data", iResponse.getUserData(), "1"); - logger.assertEqual("get user data", dResponse.getUserData(), "2"); - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.BrokerResponse#getSOAPMessage(java.lang.Object)} - * . - */ - @Test - public final void testGetSOAPMessage() { - - logger.Info(iResponse.getMessage().toString()); - // it is not public, do not test it here - } - - 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; - -} +/** + * + */ +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 index 977c4ec..183cdab 100644 --- a/test/TestCase/functiontest/CommonDataBytes.java +++ b/test/TestCase/functiontest/CommonDataBytes.java @@ -1,26 +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; - } -} +/** + * + */ +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 index 648f0f1..2afc5bf 100644 --- a/test/TestCase/functiontest/CommonDataHelper.java +++ b/test/TestCase/functiontest/CommonDataHelper.java @@ -1,277 +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."); - } - -} +/** + * + */ +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 index 972b972..0a28021 100644 --- a/test/TestCase/functiontest/CommonDataTestActionId.java +++ b/test/TestCase/functiontest/CommonDataTestActionId.java @@ -1,35 +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; - } -} +//------------------------------------------------------------------------------ +// +// 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 index 5cbc308..f4c0829 100644 --- a/test/TestCase/functiontest/CommonDataTestDurable.java +++ b/test/TestCase/functiontest/CommonDataTestDurable.java @@ -1,295 +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("CommonDataTest"); - logger = new Logger(true, true, "DataClientTest"); - 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 { - logger.Start("CommonDataTest"); - } - - /** - * @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 - } - } - logger.End("CommonDataTest"); - } - - @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 { - 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); - } - } - - @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 { - 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); - - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - private static Config config; - private static Logger logger; - private static int[] dataSizeToCheck; -} +/** + * + */ +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 index 9ec1ae7..9c732a2 100644 --- a/test/TestCase/functiontest/CommonDataTestInteractive.java +++ b/test/TestCase/functiontest/CommonDataTestInteractive.java @@ -1,295 +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("CommonDataTest"); - logger = new Logger(true, true, "DataClientTest"); - 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 { - logger.Start("CommonDataTest"); - } - - /** - * @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 - } - } - logger.End("CommonDataTest"); - } - - @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 { - 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); - } - } - - @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 { - 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); - - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - @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 { - 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); - } - } - - private static Config config; - private static Logger logger; - private static int[] dataSizeToCheck; -} +/** + * + */ +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 index f7c0faa..fb07bf7 100644 --- a/test/TestCase/functiontest/Config.java +++ b/test/TestCase/functiontest/Config.java @@ -1,100 +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 = "headnode"; - public String ServiceName = "JavaTestService"; - 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; - -} +/** + * + */ +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 index e8e5a49..8b21862 100644 --- a/test/TestCase/functiontest/DataClientHelper.java +++ b/test/TestCase/functiontest/DataClientHelper.java @@ -1,97 +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); - - } - -} +/** + * + */ +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 index 105037e..738be5a 100644 --- a/test/TestCase/functiontest/DataClientTest.java +++ b/test/TestCase/functiontest/DataClientTest.java @@ -1,1381 +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("CommonDataTest"); - 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 { - logger.Start("DataClientTest"); - } - - /** - * @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(); - logger.End("DataClientTest"); - } - - @Test(timeout = 600000) - // headnode=NULL - public final void DataClient_API_Create_1() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // headnode=string.Empty - public final void DataClient_API_Create_2() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // headnode is not existed - public final void DataClient_API_Create_3() throws DataException { - 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()); - } - } - - // @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 { - 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()); - } - } - - @Test(timeout = 600000) - // dataClientId=string.Empty - public final void DataClient_API_Create_6() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // valid dataClientId", - public final void DataClient_API_Create_7() { - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Create - invalid dataClientId - public final void DataClient_API_Create_8() { - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Create - username=NULL - public final void DataClient_API_Create_9() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - username is empty - public final void DataClient_API_Create_10() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - password=NULL - public final void DataClient_API_Create_11() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - password is empty - public final void DataClient_API_Create_12() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Create - create two DataClient with the same name - public final void DataClient_API_Create_13() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - object is NULL - public final void DataClient_API_WriteRaw_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - call WriteAll twice - public final void DataClient_API_WriteRaw_2() throws DataException { - 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(); - } - - - @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 { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read before write - public final void DataClient_API_ReadRaw_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Multiple read - public final void DataClient_API_ReadRaw_2() throws IllegalStateException, - DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read after deleted - public final void DataClient_API_ReadRaw_4() throws DataException { - 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()); - - } - - } - - - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read after deleted - public final void DataClient_API_ReadRaw_6() throws DataException { - 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()); - } - - } - - @Test(timeout = 600000) - // DataClient.ReadRawBytesAll - Read raw from write raw could be - // serializable - public final void DataClient_API_ReadRaw_7() throws IOException, - DataException, ClassNotFoundException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Could not write empty byte - public void DataClient_API_WriteRaw_8() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Could not write empty byte - public void DataClient_API_WriteRaw_9() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll - Unauthorized write - public void DataClient_API_WriteRaw_10() throws DataException { - 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); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode=NULL - public final void DataClient_API_Open_1() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode=string.Empty - public final void DataClient_API_Open_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - headnode is not existed - public final void DataClient_API_Open_3() throws DataException { - 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(); - } - - // 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 { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - dataClientId=string.Empty - public final void DataClient_API_Open_6() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - valid dataClientId - public final void DataClient_API_Open_7() throws DataException { - 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(); - - } - - @Test(timeout = 600000) - // DataClient.Open - invalid dataClientId - public void DataClient_API_Open_8() { - - 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()); - } - } - } - - @Test(timeout = 600000) - // DataClient.Open - Open dataClient which does not exist - public final void DataClient_API_Open_9() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - multiple Open and Read - public final void DataClient_API_Open_10() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.Open - Open dataClient which has been closed - public final void DataClient_API_Open_11() throws DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Open - Opened dataClient is read only - public final void DataClient_API_Open_12() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - data server unreachable - public final void DataClient_SOADataServer_1() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - data server is empty - public final void DataClient_SOADataServer_2() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - multiple data server path - public final void DataClient_SOADataServer_3() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - public void DataClient_SOADataServer_4() throws IOException { - 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); - } - - @Test(timeout = 600000) - // CCP_SOADATASERVER - Invalid data server path - local path - public final void DataClient_SOADataServer_5() throws IOException { - 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); - } - - - @Ignore - // DataClient.Delete - Unauthorized delete - public final void DataClient_API_Delete_3() throws IOException, - DataException { - 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()); - } - } - - @Test(timeout = 600000) - // DataClient.Delete - Authorized delete - public final void DataClient_API_Delete_4() throws IOException, - DataException { - 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()); - } - } - - 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 { - // 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(); - - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll not in compress - public final void DataClient_API_WriteCompress_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.WriteRawBytesAll not in compress (by default)", - public final void DataClient_API_WriteCompress_3() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - no data written - public final void DataClient_API_FilePath_1() throws DataException { - DataClient dataClient = DataClientHelper.Create(); - String filePath = dataClient.getStorePath(); - logger.Info("The data file path is %s", filePath); - - DataClientHelper.Delete(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - data deleted - public final void DataClient_API_FilePath_2() throws DataException { - 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(); - } - - @Test(timeout = 600000) - // DataClient.GetFilePath - data could be read by simple file solution - public final void DataClient_API_FilePath_3() throws IOException, - DataException, ClassNotFoundException { - 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(); - } - - @Test(timeout = 600000) - // DataSecurity - Unauthorized read (by default) - public final void DataClient_API_DataSecurity_2() throws DataException { - 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); - - } - - @Test(timeout = 600000) - // DataSecurity - Authorized read for another user - public final void DataClient_API_DataSecurity_4() throws DataException, - SocketTimeoutException, SessionException, - DatatypeConfigurationException { - 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); - } - - @Test(timeout = 600000) - // Concurrency write - public final void DataClient_Concurrency_1() throws InterruptedException, - BrokenBarrierException, DataException { - 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(); - } - - @Test(timeout = 600000) - // Concurrency read and close - public final void DataClient_Concurrency_2() throws InterruptedException, - BrokenBarrierException { - DataClient_Concurrency_2_Helper(CommonDataHelper.defaultDataClientId, - false, 100); - } - - 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 { - 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(); - } - - 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; - -} +/** + * + */ +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 index 0c57af7..426cf77 100644 --- a/test/TestCase/functiontest/DurableSessionTest.java +++ b/test/TestCase/functiontest/DurableSessionTest.java @@ -1,1284 +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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } - - // 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"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SocketTimeoutException was thrown"); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SessionException was thrown"); - } - - SessionStartInfo info2 = new SessionStartInfo(config.Scheduler, - config.ServiceName); - - try { - dSession = DurableSession.createSession(info2); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SocketTimeoutException was thrown"); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.Error("SessionException was thrown"); - } finally { - try { - dSession.close(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info, 0); - - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info, 1); - logger.Error("EException is not thrown."); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached = DurableSession.attachSession(attachInfo, 0); - } catch (SessionException e1) { - logger.Error("SessionException when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("SessionException when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Info("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (NullPointerException e1) { - logger.Info("NullPointerException when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - Version v = dSession.getClientVersion(); - logger.assertEqual("DurableSession clientVersion major", v.getMajor(), - 3); - logger.assertEqual("DurableSession clientVersion minor", v.getMinor(), - 3); - - // boundary - try { - dSession.close(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - Version v = dSession.getServerVersion(); - logger.Info(v.toString()); - logger.assertEqual("DurableSession serverVersion major", v.getMajor(), - 3); - //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 - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - if (dSession == null) { - logger.Error("creating dSession failed"); - return; - } - - try { - dSession.close(); - } catch (SessionException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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 %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); - 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 %s", ex.toString()); - - } - - } - 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 %s", e1.toString()); - e1.printStackTrace(); - } - - 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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(); - session.close(); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // boundary - - dSession = null; - try { - dSession = DurableSession.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(true, 1); - logger.Error("EE is not thrown"); - } catch (SessionException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Info("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(true, Integer.MIN_VALUE); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a durable session"); - e.printStackTrace(); - } - - try { - dSession.close(false, Integer.MAX_VALUE); - } catch (SessionException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } - - // 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.printStackTrace(); - } - - } - - // 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Info("SessionException is thrown"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - try { - versions = DurableSession.GetServiceVersions(config.Scheduler, "", - config.UserName, config.Password); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException is thrown"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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; - -} +/** + * + */ +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 index 093a73e..fffa56b 100644 --- a/test/TestCase/functiontest/GenericServiceTest.java +++ b/test/TestCase/functiontest/GenericServiceTest.java @@ -1,230 +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 %s", ex.toString()); - ex.printStackTrace(); - - } - - } - logger.Info("Done retrieving responses"); - client.close(); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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. %s", ee.toString()); - ee.printStackTrace(); - } - catch (Throwable ee) { - logger.Error("Error in process request %s", ee.toString()); - ee.printStackTrace(); - - } - - } - logger.Info("Done retrieving responses"); - client.close(); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_DurableGenericService"); - - } - - - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index 0ac6c1e..9101880 100644 --- a/test/TestCase/functiontest/Logger.java +++ b/test/TestCase/functiontest/Logger.java @@ -1,233 +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) { - 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 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(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) { - - 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; - -} +/** + * + */ +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 index cf31ebf..747e409 100644 --- a/test/TestCase/functiontest/SessionAttachInfoTest.java +++ b/test/TestCase/functiontest/SessionAttachInfoTest.java @@ -1,172 +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 { - logger.Start("SessionAttachInfoTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionAttachInfoTest"); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionAttachInfo#SessionAttachInfo(java.lang.String, int)} - * . - */ - @Test - public final void testSessionAttachInfoStringInt() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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 %s", e.toString()); - e.printStackTrace(); - } - - DurableSession dSession_attached = null; - try { - dSession_attached = DurableSession.attachSession(attachInfo); - } catch (SessionException e1) { - logger.Error("SessionException when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Exception when attaching a durable session"); - e1.printStackTrace(); - } - - // 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"); - e1.printStackTrace(); - } catch (Exception e1) { - logger.Error("Invalid sessionAttachInfo when attaching a durable session"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - 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"); - e1.printStackTrace(); - } - - } - - private static Session iSession = null; - private static DurableSession dSession = null; - - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index b162d13..676feb0 100644 --- a/test/TestCase/functiontest/SessionBaseTest.java +++ b/test/TestCase/functiontest/SessionBaseTest.java @@ -1,452 +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 { - logger.Start("SessionBaseTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionBaseTest"); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#getId()}. - */ - @Test - public final void testGetId() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#getEndpointReference()} - * . - */ - @Test - public final void testGetEndpointReference() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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(), "3.3"); - /* logger.assertEqual("server version", sb.getServerVersion() - .toString(), "3.2"); -*/ logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3")); - - - sb.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - sb = Session.createSession(info); - logger.assertEqual("client version", sb.getClientVersion() - .toString(), "3.3"); - /*logger.assertEqual("server version", sb.getServerVersion() - .toString(), "3.2"); -*/ - logger.assertTrue("server version",sb.getServerVersion().toString().startsWith("3")); - - sb.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(false); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#close(boolean, int)} - * . - */ - @Test - public final void testCloseBooleanInt() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(true, 5000); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info); - session.close(true, 0); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(false, -1000); - logger.Error("EE is not thrown"); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(true, 1); - logger.Error("EE is not thrown 1"); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Error("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(true, Integer.MAX_VALUE); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("IllegalArgumentException when creating a durable session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, java.lang.String)} - * . - */ - @Test - public final void testGetServiceVersions() { - - try { - logger.assertEqual("ccpechosvc version", SessionBase - .GetServiceVersions(config.Scheduler, config.ServiceName, - config.UserName, config.Password)[0].toString(), - "3.3"); - } catch (SessionException e) { - logger.Error("Session exception"); - e.printStackTrace(); - } - - // 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.printStackTrace(); - } - - } - - // 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("UE is thrown"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - try { - versions = SessionBase.GetServiceVersions(config.Scheduler, "", - config.UserName, config.Password); - logger.Error("EE is not thrown"); - } catch (IllegalArgumentException e) { - logger.Info("SessionException is thrown"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("SessionException is thrown"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } - - } - - /** - * Test method for NoServiceVersion - */ - @Test - public final void testNoServiceVersion() { - logger.assertEqual("noServiceVersion", SessionBase.NoServiceVersion, new Version(0,0)); - - } - - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index 7e3c1a2..6ac0643 100644 --- a/test/TestCase/functiontest/SessionPool.java +++ b/test/TestCase/functiontest/SessionPool.java @@ -1,593 +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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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 %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); - logger.assertTrue("check response", - reply.getRefID() == refId); - } catch (Throwable ex) { - logger.Error("Error in process request %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(false); //needed to keep the session in the pool - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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 %s%n%s", e.toString(), - e.getStackTrace()); - } - - 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 %s", ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(true); - - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - - if (session != null) { - try { - session.close(false); //needed to keep the session in the pool - } catch (Throwable e1) { - logger.Error("Exception is thrown %s", e1.toString()); - e1.printStackTrace(); - } - } - - 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 %s", - ex.toString()); - - } - - } - logger.Info("Done retrieving %d responses", config.NbOfCalls); - client.close(); - } - - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - 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: %s", e.toString()); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - } - logger.Info("Client %s calling endRequests()...", m + "_" - + k); - try { - client.endRequests(); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - 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 %s", - ex.toString()); - - } - - } - } catch (SessionException e) { - logger.Error("SessionException: %s", e.toString()); - e.printStackTrace(); - } - logger.Info("Done retrieving %d responses", - config.NbOfCalls); - try { - client.close(true); - } catch (SocketTimeoutException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SessionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - 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 %s", e.toString()); - e.printStackTrace(); - } - - try { - session.close(false); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - - logger.End("test_SessionPool_InteractiveConcurrentMultipleBatches"); - } - - - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index 2f3c07f..3186698 100644 --- a/test/TestCase/functiontest/SessionStartInfoTest.java +++ b/test/TestCase/functiontest/SessionStartInfoTest.java @@ -1,501 +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 { - logger.Start("SessionStartInfoTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionStartInfoTest"); - } - - /** - * 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() { - 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("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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - //should check the session created. - if (session !=null) { - try { - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - } - - - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - - - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.SessionStartInfo#SessionStartInfo(java.lang.String, java.lang.String)} - * . - */ - @Test - public final void testSessionStartInfoStringString() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - - } - - /** - * 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() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString() { - 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.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString_noVersion() { - 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.printStackTrace(); - } - 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - /** - * Test method for - * - */ - @Test - public final void testSessionStartInfoStringStringVersionStringString_Er() { - 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.printStackTrace(); - } catch (SessionException e) { - logger.Info("Session exception when creating a session"); - e.printStackTrace(); - } - - if (session != null) { - try { - session.close(); - } catch (Throwable e) { - logger.Error("Exception is thrown %s", e.toString()); - e.printStackTrace(); - } - } - } - - - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index 0c6af03..b7d72ce 100644 --- a/test/TestCase/functiontest/SessionTest.java +++ b/test/TestCase/functiontest/SessionTest.java @@ -1,497 +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("DurableSessionTest"); - logger = new Logger(true, true, "DurableSessionTest"); - - 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 { - logger.Start("SessionTest"); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - logger.End("SessionTest"); - } - - /** - * 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.Info(iSession.getAutoCloseJob().toString()); // BUG what's this - // for? - - } - - - /** - * 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.Info(iSession.httpEndpointReference()); - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#createSession(com.microsoft.hpc.scheduler.session.SessionStartInfo)} - * . - */ - @Test - public final void testCreateSessionSessionStartInfo() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } - - // boundary - try { - session = Session.createSession(null); - logger.Error("EException is not thrown."); - } catch (Throwable e) { - logger.Info("Timeout when creating a durable session"); - e.printStackTrace(); - } - - 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"); - e.printStackTrace(); - } - - // more boundary test case for invalid startInfo would be included in - // SessionStartInfo test - - } - - /** - * 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() { - - // 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() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("SessionException when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, Integer.MAX_VALUE); - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, 0); - session.close(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info, -1); - logger.Error("EException is not thrown."); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, 1); - logger.Error("EException is not thrown."); - } catch (SocketTimeoutException e) { - logger.Info("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - try { - session = Session.createSession(info, Integer.MIN_VALUE); - logger.Error("EException is not thrown."); - } catch (IllegalArgumentException e) { - logger.Info("IllegalArgumentException when creating a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo)} - * . - */ - @Test - public final void testAttachSessionSessionAttachInfo() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a session"); - e1.printStackTrace(); - } - - try { - session_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SessionException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - } - - /** - * Test method for - * {@link com.microsoft.hpc.scheduler.session.Session#attachSession(com.microsoft.hpc.scheduler.session.SessionAttachInfo, int)} - * . - */ - @Test - public final void testAttachSessionSessionAttachInfoInt() { - // 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.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session_attached = Session.attachSession(attachInfo, 0); - } catch (SessionException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Error("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - try { - session_attached.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - // boundary - - try { - session = Session.createSession(info); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when creating a durable session"); - e.printStackTrace(); - } catch (SessionException e) { - logger.Error("Session exception when creating a durable session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a session"); - e.printStackTrace(); - } - - 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.printStackTrace(); - } catch (SocketTimeoutException e1) { - logger.Info("Timeout when attaching a durable session"); - e1.printStackTrace(); - } - - 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.printStackTrace(); - } catch (Throwable e) { - logger.Error("UE when creating a session"); - e.printStackTrace(); - } - - try { - session.close(); - } catch (SessionException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } catch (SocketTimeoutException e) { - logger.Error("Timeout when closing a durable session"); - e.printStackTrace(); - } - - } - - private static Session iSession = null; - private static Config config; - private static Logger logger; - -} +/** + * + */ +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 index 096884e..f3e62be 100644 --- a/test/TestCase/functiontest/Util.java +++ b/test/TestCase/functiontest/Util.java @@ -1,81 +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; - } -} +/** + * + */ +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; + } +} From 299b48356d5ff8f52248fe646a2396f6782a1ee5 Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Thu, 2 Feb 2012 14:07:15 +0800 Subject: [PATCH 08/23] Add the GetCert.java to install the certificates on Java clients and update the README --- README | 25 +++++------- tools/GetCert.java | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 16 deletions(-) create mode 100644 tools/GetCert.java diff --git a/README b/README index ee1b207..875e6e6 100644 --- a/README +++ b/README @@ -56,31 +56,24 @@ How to setup the system On java client (Linux) machine, set up SSL trust between Java client and Headnode/BrokerNode. - - download java code: http://techblog.kz/wp-content/uploads/InstallCert.java - - - Create the environment variable JAVA_HOME and set it to the Java installation path. - - - "$JAVA_HOME/bin/javac" InstallCert.java + - Create the environment variable JAVA_HOME and set it to the Java installation path. Compile the GetCert.java under ~/tools/ - a) Create head node certificate. - - "$JAVA_HOME/bin/java" InstallCert - - The above should create a file called "jssecacerts" - - copy jssecacerts to overwrite $JAVA_HOME/jre/lib/security/cacerts (NOTE: You need administrate privilege on Vista/7) + - "$JAVA_HOME/bin/javac" GetCert.java - b) Create broker node certificate. - - "$JAVA_HOME/bin/java" InstallCert - - The above should create a file called "jssecacerts" - - copy jssecacerts to overwrite $JAVA_HOME/jre/lib/security/cacerts - - This is expected to overwrite the cacerts created in a). + 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 certificate is not required. + 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/tools/GetCert.java b/tools/GetCert.java new file mode 100644 index 0000000..c4b4966 --- /dev/null +++ b/tools/GetCert.java @@ -0,0 +1,95 @@ + +import java.io.*; +import java.security.*; +import java.security.cert.*; +import javax.net.ssl.*; +import static java.lang.System.out; + +public class GetCert { + + public static void main(String[] args) throws Exception { + String hostname; + int port = 443; + char[] passphrase; + if (args.length==0 || args.length>2 ) + { + out.println("Usage: java GetCert [passphrase]"); + return; + } + hostname = args[0]; + String p = (args.length == 1) ? "changeit" : args[1]; + passphrase = p.toCharArray(); + + 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, passphrase); + in.close(); + + SSLContext context = SSLContext.getInstance("TLS"); + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(ks); + X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0]; + SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); + + context.init(null, new TrustManager[] {tm}, null); + SSLSocketFactory factory = context.getSocketFactory(); + + SSLSocket socket = (SSLSocket)factory.createSocket(hostname, port); + socket.setSoTimeout(15000); + try { + socket.startHandshake(); + socket.close(); + out.println("The certificate trusted is already in store"); + return; + } catch (SSLException e) { + out.println("The certificate trusted is not in store"); + } + + X509Certificate[] chain = tm.chain; + + for (int k = 0; k < chain.length; k++) { + X509Certificate cert = chain[k]; + String alias = hostname + "-" + (k + 1); + ks.setCertificateEntry(alias, cert); + out.println("Added certificate with alias: "+alias); + } + + OutputStream out = new FileOutputStream("cacerts_new"); + ks.store(out, passphrase); + out.close(); + + } + + private static class SavingTrustManager implements X509TrustManager { + + private final X509TrustManager tm; + private X509Certificate[] chain; + + SavingTrustManager(X509TrustManager tm) { + this.tm = tm; + } + + public X509Certificate[] getAcceptedIssuers() { + throw new UnsupportedOperationException(); + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + throw new UnsupportedOperationException(); + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + this.chain = chain; + tm.checkServerTrusted(chain, authType); + } + + } + +} From 629c5d9b088bc49929cde1bdb18c0254a35bd101 Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Wed, 29 Feb 2012 10:49:11 +0800 Subject: [PATCH 09/23] Update the tool GetCert. --- tools/GetCert.java | 135 ++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/tools/GetCert.java b/tools/GetCert.java index c4b4966..1452103 100644 --- a/tools/GetCert.java +++ b/tools/GetCert.java @@ -2,93 +2,102 @@ 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 { + public static void main(String[] args) + throws Exception { String hostname; - int port = 443; - char[] passphrase; + int portnumber = 443; + char[] password; if (args.length==0 || args.length>2 ) { - out.println("Usage: java GetCert [passphrase]"); + out.println("Usage: java GetCert [password]"); return; } hostname = args[0]; - String p = (args.length == 1) ? "changeit" : args[1]; - passphrase = p.toCharArray(); - - 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, passphrase); - in.close(); + String pass = (args.length == 1) ? "changeit" : args[1]; + password = pass.toCharArray(); SSLContext context = SSLContext.getInstance("TLS"); - TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - tmf.init(ks); - X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0]; - SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); - + 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, port); + SSLSocket socket = (SSLSocket)factory.createSocket(hostname, portnumber); socket.setSoTimeout(15000); + Certificate[] serverCerts=null; try { socket.startHandshake(); + serverCerts = socket.getSession().getPeerCertificates(); socket.close(); - out.println("The certificate trusted is already in store"); - return; + out.println("Server certificates successfully retrieved."); } catch (SSLException e) { - out.println("The certificate trusted is not in store"); + out.println("Obtain server certificates failed."); + e.printStackTrace(); + return; } - - X509Certificate[] chain = tm.chain; - - for (int k = 0; k < chain.length; k++) { - X509Certificate cert = chain[k]; - String alias = hostname + "-" + (k + 1); - ks.setCertificateEntry(alias, cert); - out.println("Added certificate with alias: "+alias); + + 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, passphrase); + ks.store(out, password); out.close(); - - } - - private static class SavingTrustManager implements X509TrustManager { - - private final X509TrustManager tm; - private X509Certificate[] chain; - - SavingTrustManager(X509TrustManager tm) { - this.tm = tm; - } - - public X509Certificate[] getAcceptedIssuers() { - throw new UnsupportedOperationException(); - } - - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - throw new UnsupportedOperationException(); - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - this.chain = chain; - tm.checkServerTrusted(chain, authType); - } + + return; } From 39cec261b2545f703375526a4aa5dcfa3dfe2e44 Mon Sep 17 00:00:00 2001 From: Yutong Sun Date: Mon, 5 Mar 2012 13:30:18 +0800 Subject: [PATCH 10/23] Add the Copyright to the GetCert --- tools/GetCert.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tools/GetCert.java b/tools/GetCert.java index 1452103..8d8c600 100644 --- a/tools/GetCert.java +++ b/tools/GetCert.java @@ -1,3 +1,67 @@ +//------------------------------------------------------------------------------ +// +// 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.*; From b8d9fd839da80f6f81aa364b02c20b03b73941a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Mar 2012 15:26:38 +0800 Subject: [PATCH 11/23] Add sample to get user data field on service side. --- .../src/org/tempuri/IEchoSvcImpl.java | 116 +++++++++++------- 1 file changed, 71 insertions(+), 45 deletions(-) diff --git a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java index 9b4b83a..8371494 100644 --- a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java +++ b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java @@ -7,48 +7,60 @@ 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 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 -{ +@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()); + 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"); + public java.lang.Integer echoData(java.lang.String dataClientId) { + ServiceContext.Logger.traceEvent(Level.INFO, + "Executing operation echoData"); ServiceContext.Logger.traceEvent(Level.ALL, dataClientId); - try - { + try { DataClient client = ServiceContext.getDataClient(dataClientId); byte[] data = client.readRawBytesAll(); return data.length; - } catch (java.lang.Exception ex) - { + } catch (java.lang.Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex); } @@ -60,34 +72,28 @@ public java.lang.Integer echoData(java.lang.String dataClientId) * @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"); + 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 - { + try { StatisticInfo info = new StatisticInfo(); // Set start time to now. info.setStartTime(Utility.getXMLCurrentTime()); - if (!Utility.isNullOrEmpty(fileData)) - { + if (!Utility.isNullOrEmpty(fileData)) { byte[] buffer = new byte[BufferSize]; int readed; InputStream file; - try - { + try { file = new FileInputStream(new File(fileData)); - } - catch (FileNotFoundException e) - { + } catch (FileNotFoundException e) { throw new Exception("File not found", e); } - do - { + do { readed = file.read(buffer, 0, BufferSize); } while (readed != BufferSize); @@ -95,7 +101,8 @@ public StatisticInfo generateLoad(java.lang.Double runMilliSeconds, byte[] dummy } GregorianCalendar target = new GregorianCalendar(); - target.add(GregorianCalendar.MILLISECOND, runMilliSeconds.intValue()); + target.add(GregorianCalendar.MILLISECOND, + runMilliSeconds.intValue()); String dummy = System.getenv("CCP_TASKINSTANCEID"); if (!Utility.isNullOrEmpty(dummy)) { try { @@ -105,17 +112,15 @@ public StatisticInfo generateLoad(java.lang.Double runMilliSeconds, byte[] dummy info.setTaskId(0); } } - - while (GregorianCalendar.getInstance().before(target)) - { + + while (GregorianCalendar.getInstance().before(target)) { // busy wait } - + info.setEndTime(Utility.getXMLCurrentTime()); return info; - } catch (java.lang.Exception ex) - { + } catch (java.lang.Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex); } @@ -126,19 +131,40 @@ public StatisticInfo generateLoad(java.lang.Double runMilliSeconds, byte[] dummy * * @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"); + 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 userData = getUserData(); + ServiceContext.Logger.traceEvent(Level.INFO, "UserData : " + userData); + try { String computername = InetAddress.getLocalHost().getHostName(); return computername + ":" + input; - } catch (java.lang.Exception ex) - { + } 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; + } + } From 3d8f7badda18564774d4d187f3a26f55e36c851c Mon Sep 17 00:00:00 2001 From: MicrosoftHPC Date: Fri, 30 Mar 2012 17:06:33 +0800 Subject: [PATCH 12/23] Add extended priority support --- .../scheduler/session/SessionStartInfo.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java b/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java index 646f380..413bf2f 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java @@ -337,6 +337,17 @@ public Integer getPriority() { 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 @@ -472,6 +483,17 @@ 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 From 83d514e8b227c067681f730a268fc9419148a6af Mon Sep 17 00:00:00 2001 From: MicrosoftHPC Date: Fri, 25 May 2012 11:19:59 +0800 Subject: [PATCH 13/23] add common data sample. --- sample/helloworld/HelloWorld.java | 465 +++++++++++++++++------------- 1 file changed, 265 insertions(+), 200 deletions(-) diff --git a/sample/helloworld/HelloWorld.java b/sample/helloworld/HelloWorld.java index 0de371c..6088c26 100644 --- a/sample/helloworld/HelloWorld.java +++ b/sample/helloworld/HelloWorld.java @@ -1,200 +1,265 @@ -//------------------------------------------------------------------------------ -// -// 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 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(); + } + 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; + } + +} From a9a58e9361eb7d81d6a590fc580768149b018867 Mon Sep 17 00:00:00 2001 From: MicrosoftHPC Date: Fri, 25 May 2012 14:07:04 +0800 Subject: [PATCH 14/23] add common data sample - part 2. --- sample/helloworld/CcpEchoSvc.jar | Bin 26708 -> 26763 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sample/helloworld/CcpEchoSvc.jar b/sample/helloworld/CcpEchoSvc.jar index 1a99c904332bfad43de5545c1524c9106777461d..cdc52336f713ddf62ab349f6f2c12afe570c2b4b 100644 GIT binary patch literal 26763 zcmbrlV{~TSwk;ex6+5%p0@s^ z&AGCk)q3w^^fAVil>i1o27vhdx_oQm1^BlQBmfA2l#n7HwV1Rp?fWnQ05E{81USU+ z6+r)7Ci_2bM*dv!e>O|;Ns9>!DJarN3ExPKjz~&S(@eoiP*aSLPSnWL%`$H8+0lqg zQHe=SIsOEJOg_Ts#loO80ZG~?e>5UN+e7<~nv}nfO6jssd}4ZScV!3o*Mm&c-9CtX z{+r*|?+1bU>!Gav_!S_Zf3>zVrv0B+ApCQMfv$tDzO|Kuovyyae^`$3-z~S-H!-x- zwf_&>@cz>_Z3a3zrvI>+@c+J9n~wG0ZeaJvTcG)WyMdv;iM73xzJ;mYU-$Y4F8;h1 z-~akvGJ0l)`VPXM@73DQl}6t}*WSKP@k|j4*fP6^y)%JXs;#7@d42hOVMPd`m75*j?RR zV1oqA({aTj8u)AHLnCT?#C-te(=r9@2#hC6K|+f0p=}rz%ut_>Is=SyLSiX(2Y$~( z?iK>WX^=d+D-BSOM3D+?H^~O7aHB6vjty+|D$Y@O$by8u{e+9>IeXH%H2hghrrD)E z5b}q=J+be0$}Xn3^$ja@T4mz5BMD2b@3k&Bw2US&)9a%2tqm+g%jWLa zews}}Rsq2PYjS2(#N5Qi#g>4UPbQ2EXNIq~^jA2HF^GX}ZIw9=%QmiFHCx2mxu}fm z!3)6bQ7T63o^E>%=>aTQ#$f!s3~cB`%zUj0w|8ZPQFT3sT>F-xtKv-4=HtbE(<|JoC^PB=QO6-LAZq2wcR`0}Q5e~N zu0*_=%i_DzsJ|2tIlZA0@a79i^d&+&5IEB>r<=3Gg zmD!ZoCfaYEidbfH(E1dr@1XyXhkt6c0JWD3A3Tw8I#)-Ns)no8vYgHI6W5WI3@(cf=GYx=KP7>rg#GqMQNIe z^NtJ&ExWz`V7p@ZWjWGXf`7||IbESPB! zu*)KN)Z0^EMsP2AiugeGsM0Yg@pGt*ofei(a>}pq8hR%&;plvuJv!XrKd;fZ5#E)_ z;;9?AgE%tv0W_|p{c?T;_8O7S9i{kb13n1(CyJM3QI$EsN(&g?c26Rb>!GXkF?@qE z{b{S*mjxf}s7N0LG76jvuyHwT6AldGq@O{$`TqPfBlWB0OUZr!f9 zL0TycfFc1yvc#)0#lgDD=-O_qQCYoyHf64_r)y^QEM#km9zH-F{G?T#cPr8-b5PlD zi;s+|v9Fz8i`5KOwT5VuURj@N3`FFC_J-YT*}_GEEpp6h@e|fG#x@Ig$lg+s{1{N- zbZc04i^Y=hcHJnd0$il24(bYM8t8&aEE8Cm~B;sYng#DVGI!7s($ip%k4aY67p^EgKcAnp`R zpaXMFRwbk8LQj*_}$| zuX#;TZQ6;Rgzejvo%Ulv%f&kPW`@BGAB9{K%+J+MfI#=k&}^80y0J9UW7-=QiF%W_ zV{#>eVl^X8Rv9b~Y)uV@!6)JfcEEZv6!1Y%~zG-kGO)!dZZ(gDl)$)O#t>juf zG=7DzT?K;%0Q4#LW>pPs4_jZ`&yunGf1YnaV8TeTy@UOJ^;_uQ0$~9G06agh|H_>H zR3x7NwIcoP)&CYG&+#!RKUsLtP0vlvkW#;7N(2ZY*=)bBe1enG{U`bJZwMDe++L`) zCNt02JKES`;R2 zj(McPW?4DHOu;O@=#!yVq`6_2tat1gtq$%UnS}4`KdGPF??F^!qmWmy;F;sI{E)wJ z^^^z?2%zYf}@(?RCtEOg{_-!yllnJ@69MGw-eQpd`cZdwj&Bur9iMh!V--$%+! zOb6dW*hfUfGre3rGj4zU!RWW#vndzoyv$hO{XI70Uu^iq6#BJ(UM4r1w3v?VDAZ~c z6BXeNT{95AKWIB*s8{yo!L|;?tAY0)p0q1%LpXX)=bbTEFv~TfFbvVgnM3K_btlb( zzQ9SP=24OyF&WC^BQi3TP8q>BU$vj{7RM|N$6jH@&QH13J&$tyv{G5+{<7P7-xigi zlZ91TzQn#&pKI9qf!!X#WSA=-@I^;zhv_ma(SShqQ2~IutE9(Q3;#fOt*c~fG_fP* z9sw$o%7DhHf?q2y5V|Cb><<4&GhmbGf=CG*Ss?iARd*unNw9~if=FM3L7yOish5uYQfin-0ZJ_zm*Ef>@#`EQeh>B`AfQZB^L=F9R@%k)Bq+oZbcBNd z|B%pO^)LR#YhQq8g^QM!Sg}ILNY(N}6-^GIOnMG^C5dtw#@MLjGHIj9dW03K-qS}w zkszh&*OSvI(CVtP&X&93r1r|!fj?Ix_7jaGpwPap7vQiJUh$(Phn;818@IIhjr zMwt#GyKxrB$h`o+dUs5wn@F$$&CPlmjcy=XQD!%bbzRwHx+yA>W0shcK?ZxvD0Ne8 zIe9$U+&&)pu1=U1$)49I zRHogX(DI8WS6dwkB~`pj|H5br-FqXI1%SfG@xx&JXVZDbOQ%_!ik?T!S~W_C&+3eD zlFn;pG7@(UrN?$sP;iPp^zgUM;SRSWN;*d3pBJswv#F6yQjG025b!h1H$Nv*8m+DL zG;gSQa&rkQW%PA`_Pg`AIB4#iqk|g+9-Bk`w!+B=LkLRXO1ns{nAP94gM*q3=%>@_ zv5@w%%>o*kqem*-*0pu)wf{54qj~3fFz()tX1YcJmmzcZhL$#tcBcR4N*(?P5!ipM6wtR3`gF4jPWu1IMiP|O z6;_nt-@iD;Sb|88a&D=rUWzqtzeaUrC}YYw+i+B4=HC}!hK)FSo{BW3g&JO`}ii9ZvqI6z>+ z$S~YwURJ+3akz$VGlx?!DKNFtG@xOZKfc8(J7S5|h%yesldCwU!5rl_Oga2I)*T2G z3Gy|{oCz9VyCfVy2YZq#Hz-z~l1k5UPaBnX)s0jL+2NP=!X7K6IQX*CGugDmHb*YR zo>My5=$po1r7tVYQvq$J(oel=aCj~8yKWw^(ZLTR*fK#?qhHtZi-oYV%N0rFgEs>M!Eu5Ju<<@;i#D)u)p@pt-LDI zP{n_roMK+hk&(pn^aZN@QVTD57mi|kp?;17CPfc+7%_8#Yg!L+u40FG3P5dr)HMhL zZwtBu!Dox_kGo652jn23KNJtA162OF2)cR)K$t&%Xoa;R(z!80*o?Ph3l+P*nwEDnD#h*({3rpEI zyX|U9G|Tr(^GNUnFu!B+c?F?jE}=qCkx1$m{VkR`fA9?A++A3>6(lbcL7Z+^Ux?G1 zSWt?+?2I-uVH7-oRquz&3gE7@&U)#Zr>1T=-sCTYaNNz~?aD(XP6YSp@r|jv=yMer zs%P9b{R?=P6DMk4qKY45oL0HI9N>o=qUlD)la?}mK;rUU3Phgbd<91ZG4o2buM$LY zm%P|`jH*bH!^}^K?&mzcnh>b9I#NGt|>V{-5VUM+b8<^gc!A3s8dD#OYQyz@k#G+N zEg?lhn<0HyRjQeB;>>+itaUSS%*+P-aCuVaMxEPb%pnqECJjTAr}C@)Wg_v1A{h4+ z3NaAuQ{Z)qq6Cb$I}e5>Py|d|t~Z%+(ug;!LCvnqdf=25xqTrhz~Zy#SNU0=Fa z8&J(_>LVhkwQ<*mwI&m1S}V?tyY{9-#|~0j?RK{**SV8?L>@Gj+6X0|D*gg$uQnV? zA)({CkvA$XaJ*N5NL~0yzrgegKj9Hm?1;KAPl8~xN(1Dh=mT2H-?z<9K`_fHlmzCm z#~iiDirVN%j-TG6+BZzpI^;YiRAYQ=BOz_{Wdks)H@Bt?cPxyd7)i*$EiGICRSG-T zZpU_ac8%B?aW*s_KEyb3U?oK^yz$^fSXg{dZnM5)7?uVo)qJFHv9jgSv+~d*Fwo;2 zKxS+gl|9?GUNGIWM4WvIbKnru74mbT6S|Te;bk5Hl!@-i#DaE7eEM5KO zGv*05G#?4O6EO0$TF6Us9~q{?lFw)jO)O?6&5-LdwvQi|j#1f7RuL0-bvGx)Y=33~ zQv!ewOVHd#Y_`TAn!r+`3QRn4fjI~$a|F-@uIz2#3rGl%TNkYi#jDLM8W1L zF69lX?5X-Y)N{pOc4>9znXKteud?Gf&O@$N3^5}ij1&=(Oo9@`mN7xQ=p^77KoIzJ z5(m!)y=v+SZyc|zwwwkRXoRXww(sEAm*|gX783PQJ82p|t8D&yb|sVI;oB>bw@E>* zb9>=l98IfD{V1$Sd79M$5>qag{v}pJdjeFEL}N?L1*)mbAiLHz*&Y-nzi?;Ogb~n5Lg|@pDMTuoim1RgI@|8FV zUZdZ&UWQ1Ce&z5b$b0gAhwMn9;MfnlMrVF{P`&{u$ZLHMlgHa?^?Zf>&2jB&4X-p{ z004N{f9Lq0*#+t!9RHnK{IklTuwpgC3(s|;fdfPxuP$Ml1DcvIAK8sn?gx}FFDF=# z|C7SSE}eL7SS#(WnZg?s5h4_v+b5cTw7F0YIvM<;%y>M7ow4O*=b+&NVA*6&wwDkK zv`lHTID1GIkwKiPNAF{h%Sk3ZuG3kVKPuzZNFI<(JSk4J%V=N4of@E#$ktck{kU(v+R*6AmgpqI zJ1gBx1`n-0Ha%Z4=5N5)@4n#<L8V$1oauGIs8w=d+UnujS;}&g}Pe1MIuyM}~z) zrMNZDfl50CdKwdGLRP54-C?M30ZDcBSKX#ph?r;RUniD$mNWANeTgS&l{RO0Mh7buBO^&dI=Rs6!&$+~UVh z$T`slkzemP>XJ+OYjhiC&Z;!TEVq2W{m^V4ac$PoOVQF?_0F&zm0R4}&^xjH?Qjwbf`>h$(>0n&WS z8;@?cYW=8HvW?uRAW%64Ch67*a6?aQnDtl89MgAH#_ySjGbUw5vkzaO^=#6yS>``$ zuk~wIGiL|0mWih`Pfr75z0|nTv0_@7#bzKD9JwIa#?KKfRF%yRR&SQP1 zqMxXB6gD#$^+E;HS>=L{D7fBJg3oux_o5nKVS6_va{yZ=AFW;ap|65qRfQ+fY-O?9 z0y}DgTgc)o>#8yp4nE8S{20n|{zlpj?MzwTP0$M-D7)gRCbEF15LrK&s|5}Za zK1};BUs~Ecfv}d+kt5@(1&Dj}_vnSPQ>2b1N=WU=qRmUYVH;Hgfsi4oQq_N~!yChV zrQcJ{ZGbPdULI>{+x9iRJN|!2oYUQrZExO>8XP7s6pHmrTCpJ4A zOFAUQKlsrex7+BH$Ty<%g>ByR{oJ|e#0jcDYYB)iP3V}8R-6!QO}c^bnjZ^X<}|Q; z#*t>GM7HL3|Mlu5p%*&=>vb%Mya30Zzx0+q=^#C?4lWI7V=sG*Q-ea#naw+|Cu9EH z(@@dmmGRUbv$?aUub?_n2;mIBGa4#Y<{4L7mM6Lg$N3=ht7XlAkPBK+zaxk}3H806(a)*AE~`hF3jx}JNf5e4|H!0q9?!=p zn)PTj5{YGv8yk~mP}HeLDK*YHJS6`Lrk~v4yvu6z3CQNpf}OmJiEf-f__a6Q%g z=sMbpT|bh_(5Q`c;1=2YbpTd#$E=5HmF^*=qn__6E=WpmpZ`i3Z~2C{gFeAb`nML^ zpE^nKKj@^qp}mc@mA&CV^fFRjQv&OA4g%>$PXA{irn-8$QjQcsS{7=y=%McN8j6yjQ?CxdP_~vtf!Hs#Q+LhjjPxj129LN^1ZM{qisZEg3x^ zN|e?T9VMOA*GeN9j-@;{$n;K)2gytc+8DP(91{_N>I+a*_fRK_e0`KsFWwe4EYb`H z4pf&kdYaa7y31#AxNol7chcS2NV1~KwsE~odyJaJ zXAX!?Nhcq8qQWx92;Gv$m!C5#bT6anR%7+oXA_U_(>MIj zZ2Y5IPiP*v&t3Xd}X|_b6pdQYXc^|?GXQc)Qi2wB= zLmv@wGsgs4KE!il&2!^GA~&<}G}4GSeh3k~i3SEwsI7RwzC41k(m`lphy!gXV#Jld zKrxD=!r(eK+&aRyZUPH7PXaN%>8l~dSMa0tP%p({&BR|t+ulby@OOhg8YgMm$^6OL z^Ra;p0pi50O%znR6bnG}y}D}hIVbT4#9x&mlO5NS^HBM!Qp~16=xxcsJrQ@2i}Jt)XH6$xR1VaP>e~sN= z)E!PdPULuosE4PiNOzafra?%zf9h1xJ!Qk~KcWx3jTfj}i(PUe;WC!uw5hu0uq?B( zGM!Ds9=lXJAQtsnmAbHg0aOlb12&M{ek7a{J_2V1_dlUd?4b;*V3xCPkgG>mTm z`U62cDn0_Z;tXQ_9q2b4nLt0}ct7<>^grfpxc?0t|E@)W|Fp7c=1B6(@-)=9K(&(^ z`Iv#MYM`K^#Im#EVoFMvyKEB832iJVj!N%PMDU1kpA%Vu$&RpMP@h)T?Jp}^^YS*Z zU=5IJ691z|8B$d-yck8!n9Tm5_u`7qj=4wtVV1jQqTGI>4vhax`S-IOW1J*+jbof3 zdF_b&a>70g+yY)_{j9xZJA=DAM7!D8>-zZi`npTQLD?4U@%OX3 zC@xmW)g5bcY3XHLax!O<_@oGG7>i)+a8fmJ87c{T+K~9g`?*1aL@&G;d*LhRAF>|F z1yMdZRh0RY)Ike(NU$O{a8gb zN9?8Jv0ClgjOWCBIGo$vri^2>Fp$kx0AnPZ@=811x7CD{%OT&U*vAGM>*xo%N){78 zapbRLd~hX%zQNRA$B(E}J2@dEH^@bZ%MH^PpC+Hz1o z5hnE?(>I*|gs^`ZTugfSHo_}BVfSJHp%znjN<0Ef(>XFFqCwwMdSJGz<%%=duf5)t zJc)*^1@gJ#n)!xjDXcg9V~b~r1h=7O2>Dt?sP;-G^VSW^)QOZO)Zb!_t0kP-WzZz4 zW>(Uk4j>1x1J6Fjf+6s!e@TWpWZqzjPbCMpb+ZEIdjaPgF!jw*0xFQ7tqhYbJ!;RN z)TvMU`(mzfK*&l*_$JKq1|Yv^pn?^Tq72}ufJ^v4Kwekz9gH-sGW-G)U`<9+F|EEg z=p@Ux=$rI$^lG%12$w*UR{>R|7&`R?+~|=Ynix#6L1|w!o+T-I0NNrQuW0M- z#t|>tnns zWoN5wM59K)0`S=->GHGMg%xhHK>lnaDKaLXhuoE1RZufwl&pw5CH6m+fzoYJHq=Z$ zjb(7`Q61t_Cf97Mb~1m}3*(H`kMVk;Z+cmdwCXwq^}#0^LLsA`YtzbgI`M}-$OM@f zu2mmER7u-}(iShyr%PtzQKDkY+w+)@!Kq_6e8C^Ap82gWETi;(U6Di1_J@>Qv1ds-znMSfo@Ndc`Uf)g09dch>k6x zZ=iJ+9Tf>tB&3Xr_hMIa&AeQ5pK)#q_KFnBT6gs_Ab~jcE<_;2G(=b}2X@tvXukB3 zaHLvIoE$`x6c6oy<@eM=U!L$SU|h(cp?Chyp>pFlo~fy_I|D!QjP|eFe29B?d}u3szTr!w^$Sgm(e1fdv4M@`c|n?aV$}z+3@BBsG>3 zsARWiYd>&-t*YFocr>ar4!#h!ulCtRswU{}l9W8HGzdRs?N+mWvk?}U*L6OiX2CGa z^Ss&(TZ-T`y0LE@S|eh(IgbI~kg28!0 z(ALDtf5@(Jhp@?`ArsD3vubHosaSrNPs3v3(CJ+Kf=0%a1rdH!_<`n!^j@F%*p4EEbR*77*6v3O^ejI()1D|m_E1_5ey%{g zd{4`^P1{9-6FPABaFPn%4!Khah-M&8u?FBnDuz&UZQXayzUA7K`6Cvy^{ydgDSf=c zsNj+f(1I}?RtbB)LE=ysm2F@mZZKQt&88J43WUUMzCo_jbLS-SfC3NE3=muP*XvIM z!5kc%eDZA)4m}atpwssU)pVXfn0tIT)0|JDPv_P3U$siuar}jbPYRg*Eou03l;uxJ z{~HBg8m1f3?MzXBe9@uw^-4V35zH)Bh3_-S1+_PLg0Dw zWM>;&6DJomJ`e?Giw9kSq@EbM<3;Xe?*m`RiXluL5PBs-EJ3sHP$nR2#E_d|zRB%? zc|#iPtngZ+cMg9Ho*w>WfNcPI-be^B&=XadfXdgBZjGIcz}0cyry%?^Bo3kOEWUuL zfSnRBe?b`T6nJ=13Lcf>f&g9|kph+zZOP*06eM;+MOOq}!1!vL!!&O^{w1-TL!eU< z3M=m#Qe#x}ov%cs?G-qYzkD)lQpGU5?^>Tc&c}IL#HrSc^75kB*XH&HWB5`qz(?g+W%U9|^y9OU5!^06Aknyu|JZq> z){GIHvI`+z=lNl@J#s~!lT3S3m=*(nY&e6HJ#%n0KPB1Z{Zt2#XO~Bx?85h8{OJQE$PY- zh6T&Ksb4qs_>BiR6t+a80h>*{c3Cgq>unTjB&Hvi+E(m+Dr{u@Bx-S#BUU_^RA!aW z?5$d{uNjPK@Jx!CTA7B!OF|u;h^GG;yzQJ=H%b_8>ZUBOIhH1VA*Yu3<5Ow$_34EF z=+H|Nx`=R>XFTzRLBI;&&#Zd0(At`Fgy2v&XsJ=XQea_@&b{feoogQ8FAQ5u+F0Kt zA#yo~`X8Xs2yzXyVEOs+s;w#|>Mgbk5>%h^D->c_4GqA{C5NAX$vPbxYbw1T&g~5( z?+gYdL3KT&1?zzd za9p8~*JiQg#V zY&mV6h1MH*!P1XVEvh<;U5b*7A|*wNa=KV^C`($qbs1w?d@>}paZwa~PKUU~+R z3UQ<36S&{8=!b=&BKN0}RQX#2>d#n2@<(pFF%ORGWMsUb?mp3E z@9h2l{0RyNhbv@a|L@8noy_ha9D2Jw>QgN&SNWRMBA)U5ZwRDJycvLi0-}b?wW!S)| zEu;Nq=b!44q}53Mr5uZsl*tr+C6bX6t|lnY3uq{byGJM|cCGe}ZeNgZgm*^;VdBcC zrz0YS;;bL))o)H%Pyqo&)TW1L*`3pcArT(5dFi!8)8pJ@yvB(7M^d36q2JO-5U)Y` zTbNoU$k-CCdYf;7^20*0dr_B(vAU4YUR=R0?q!DrVkpH9NY?qupCkUVazvm3r`m04FP zY11c*9XL$Rq6ID&k0AAQ;)ES7^jUa;%hVO~6BlXj_>_ez_-ZUBus8(1)4AlSCRlU{vp_Qn@QT3CkMdi;>gimzPeet5&9Emq)DM*o7V+wzC0z8N3*aZXZnQi|q49ctUG^BO6JZJAoFk!&urd$nzlyl* z@UI(1{&CAvYRc%NXrTocudRv8<>`~84B$j_*jR(t{J*?f=B$2EB@JhbR1=xEjk+Gr$*qq{1QaW9lU%KXUJ&#rw@Wr(v(7e4XRu{~2Y4|2E>IPCoY1Z{oD0 zGZuoc2$cuHtTF>?Ah;7O)3%P`b(o=_4PBBHUjrheiD`-6hFEfIvr^u;V%Z>z275hK zS04U*!cmbzFaSAC5*1S}We5hf2 zMo@QpaNnF@1u`@|U^Le*Bi!IG3KluApxtvwy=~Ji_JA9*xZpK=V^GosBEHmJ$eE2HS}~GD*MIMI=xN3I zZ6MzA>^KYUz)WP7`}=v_Z;CC5mZ`U)q-3w8X!d1`np@Wa$=DwF zWCrl(dC31N0XqNTApY!?iT!OPu{{37YDN@!AX;L%aE%ujglyr=37T4#!Bn>)9;hWy zD@2jTjEHwzfH_4nuEauSo^iaJ8xzmP$Fms4_%s5C(-+m0vY^`Y{or*xedP6JZi8mJ0L*B=;$Q9tMk_ODoIBE+SQx!In@5>i#PoM}YQqv^tLfyxnL|N$e z&L9$sC`GQ3nm8DMTkR@@+DqD#!xed3B6BiN7-KyLfrZR|8+53Tm107~FQ4s}ozU#^ z)U?KL9rMJ6xL-E9=q%REbYtk^f&4Bn^F|yp z)-ZTW1F=AQbR^t_u;Xl53A%OkHwJ0$o-(d%G1tli-$#nO# zbRGZ13o@0o)b)Wy0?+46M2hKspM zH#ICcE3<*nWNoHAnhg|der?(jGy;96KUW2AMFnriU4nN9_QLHS$2g%y<+QHqP&?(f z=qYBUcIwhOpuSfoP{Hn|5n}0G58~`uY)P4+!8+v%FDD7cM^$HDGz>2%_Dg_hv7_j# z=&#>>^E!X?E$_F^`+4O~QqCMVFOW9x#_wq`qsD4lzEsPC*tL^m7O%I0{*A8({aa)w z>(vq5s}KqD8)Vwy)hRGC`ZwdMKAp6#@$bKbA(#rdJxRBCBt3x8icp9tjF2KLf_kGPlTE6Zl64#7ZC9k7jl!z?KiV1N>t&&9p>18i z`Zn30uQDF2HUZ{zgaC&?gHvAm$yV){6{zWIbq4ZJ7zk=z-GukTO}2nB@4oH4_FV|V zTX!wv3{EORqqck%j^KB?o3po#e)5#`$fC?ef4Is!Z~~Op9JWoSK;hxXEa?T2OYkq1A?WM|61R)7BXg4R@NBC<#O%9j8UOUyBQh9p5 z!yGcgmtw5#BVeSqE6Qa|3Y1!EbGJwp?UK4V-u5r_r5V-^gDr&3N(;Q?adizV>x{CF ze8t;(5u|s_@O!xT=qMW3zTNT*`v{>~sr7BaSx%Nze01B@JX3whKImY`GU)n>!o<55 z4E(1^LSzpKlM?n#4_9%XK742dBD02V-$I-i+8poO08V-KrQ z84dKt9gh#Kr8N1XP851YKRYnsIco4&Sv_I)M^xVwiCKDqq^ie9n)mI*SJNbg`piuQ zfuaG8mVu-@kIDVzB#N&(i&fCF;*up*$VWxg=F<^wPQ(Wn4LntYiu4#Pfm(WB4phz&?v>a%|%^M=tUuYn{a70xkWC*4*?PFSbj`aFc zRa`R-jO;#X7gy#am6$EH(9#LAS6ESzGEksby94LK0FL!opoNg*J*JW5$X9ek+c0*# zaG8FR2R!VYly01fl*ZZ2!yB%~t6#Dm%1=fFQW1pE&p5r$9Vsloqy zto`$-z`qXI|7&>QzdLmP-BMvk5!tI-0!uHj4ipvYw3~*KnhIn=$w6IC9FR{dpUOJd zX@)6YCv}!+O|@TU{Be$Fv+{Ben2}-UaS3nF#VWPEz;tTq2gdmj`$N+N*F(C!%yh^5 z`x_j9j4bLUyf)}noevF34Uk*12maU2d?FuX22x%fc~p2khK*owSwA+k$!H)28b8^T zR)Zc^J`+jQrEGBBOVKM)Xmp{_0n}(5TnyacZ&Ch_ED&)$f=*KHbPQoi3=R^uStF?# zYa5zNsylS`p5$%uTA`I;sl^gP-D1@Q=NHrZemx#e0#hgo)d`jY!{1fE)q~Y@j$5U< zm1rd$P^%it3J*D*h)EAh>r&HheRcz2rk$}6S8mVvof;s#8;l z{49{K|L(9>MXXM2%s%RNl)qf&B0sCKT}xm-+MxDiAEL47bd;h3I}8L3kAf~BE5-zt zvk)7Jh>@4!_ulB~Tf0vD#h5;rN=7vXc8!I236=VZpIkgK*|WOwQE`-pCKT#Sw=JHT zS!64lQMI1J`uL#VlKt`MLtmyHm2t#qkro&3eGC+{7_D^1n~d2^DCq6{RK;A}tSyu| zsAiU0H@zJ+_M5~n;Jdw(vMK4LrJ_*97JTsc)_Ziz_RdJp9|B|>`Cl4ZmONs&wU08o zedSmT1J8tVmPa%xs@tSf7)MJ%ojATQW?0J!lgoY?D;0#WcahZ0QxGZm9^jms>#6Qm zB2nk>Qkd$#m7PV2+l{YAm+?5Bf7g2OVg~Fd+QX`3D z`9ffnrhpU8l37SDC-vpK5u1S?j@B7$n}bpuRcT&Mce2jKB1Tr>*-U>losc#e+>tt& z4;eH$myqf$Hv7(SGUZN1x}yOPo3bd=cpQsREa4KTJM1}{+h!Fn;Y$S&!W}#$I6^p$ zN9-xg_(t~0E#?}}f-(qpi|7vLt?#_wIlem{WvcutGyF(qj1z;^&Z76(EeHYxkk?|RB)6F)w{SUc;r=rx zEjSLXhex?IoVIn{*%pJuM>rfDo-%p7x;$LlVgavN9;bY6qgm2hq}^JliT0w>-uExobZ(eYK?4=^?^s|O zmfcg`6;2aVV47#`d9Y2(`FU%Ob>t#gB^xVbPv8+V#97%_xEY7sYrbL>rR3N5&;tjI z1IA8Kw7%YdS&J8@u%z72Mw`Ol3POKYX8&wX{9W#TCmVC$f4gmDFSuQv5bh>oGD8?J z^Y6>$XNQY{%M;wM(%-b}e#lJ1!2ld!^&U)9R~u6&5&>E<6sV^Q?-#-m+rQ z6U{+jC88BM}Wv^_rO-sgm7hi+_m&phE1<@~F^ky-2!i|$A5F`bux#=mtB)6wYDsfek9t*c(OQ4Yi5#)p0*Z@|7=q>q>f!4ay0(le*sx62m_&#xX4-|Hb z70avB*)uJ!PeqeV9>?Ohpszc23oB9ivj2FLs;7h8MX za#@k_VYpXrqq6utmu#hRTe;ma{=hKv|7+*E!?EoCxV=}DL@8wJK_YvUkgV`f_6$9E zG9!Cur;HGVM~KHBmAw)f*_4cAM0Q5z@4kD-Gv4a=zSsNj`*pdlwc%<+nX?E5kN(O$)nRa-&IbuGe8IOZDoP0;QZ=}#! zA+LAeQ1Ps!X5bNaCT(Y#YfhN%Xkf_J8{IHsa4DEygHPAonI(pJ`Uu}Ty;ENC<@4T4 zoFw*6CM;2tRI#miyc;r9(V*Y>oPLn%nwgUY zTY2{V7DfrZP$|eRS5avgi@z6dyTpKO?z_mo1s&lXrS+RveCC<;XOWRoW%%Xq%)%F! z)VT8~XSbw}8!=f{+?(5L-D|^9OJ;(feXncESn#l3rzv${-(k~4udSg5DHQ#oeFQE5 z4e_%2p3Y*wnj9MRY zqLF^cxG_1?yDDW|F^Mb-^@tW6xKc7DvvT(R49k$pzz6m_eks?qw3qIWyURS^f4pPn zs^xwyDd`MtrLa_$zRp-ZJrid<;=tQXc+sV!-ZIfzriy;)VP!|rR-~{<&$PAqb-w~1 z@Z>bq`2l$VoSYf}Iwq8t0{i5IZAvis1irKN1VsZ>4stYsu#a6yTLB6*UO3S=>M~OC z99U>r84nj!!>oiHyyH`@x0bjs<9c#ACmt#WJM4ZXI|BfX!&P^vHS_N@4x*0{?aKKP@j=C1_q`3jS$xei zC`^O-<+C?RH<-7qum)}`x79thXA-`p%1*cqayGnxwcnlTn_K4hp3@SaSYi%-;2>Rd zjPw!5XwsR38n#;xtu-GYKiL(1I{OF*@5HVOG1Hg_o&MFG?%^oi>7oEgM#zWnXH6)H zap^SR&y)nxyHG2JZG5rAVi+q1+Fq}YdNO}m8sCY^aS6UuGP4aM0zw{=L-GWMoXO5G zE7$8S%PT^&BYQJDx79r-3FthYi@m@PBe>)uH{P~CveERM#)6Tx+@k#HEOhdn9($Cz zBaNn2cpQtmO1g`ZK@YxSfz!^QG}Rb`TEbphPVzH@>ES9jQ^gx16EpDDFZkfIzqDV- z>jTUr1NcSF1cv3I0*evA6SMK}$7Tq?l?A!&WMMmX%@CdpklGZK9{9TP2ity7?6Y_` zVDqfcuIFV)H8jFs^YN^toIU#4jG3`I;IZ=RUpCKVFPUoh_ zRmoZLJxZNVYZ7l<63H`y!Jqg;k-xcS{WepH*}$bHRFb3TU? zJVM>_%1P68g=A%#o7oo1-mtXNdN11K@!MQ8q-;#&E+z=d$~XeV0uB3x+M3Z39h>>) zoS`GqmWXlxu{XZUeX>SRte@%!EUVBzR0>~viNCZyz>)3dF_OH&~0uQN>z4x#_YGrSwR2YSxm{i`Ja%d{ct*oB0_;X+~LM{D@`M z=a=iAUFDx=$#bw5tuJ<@g6WJ!TARGvv%{mUk-vJ^-lqOm13=89e()~VDa(5)zoaVGc-{Y{i?eo=>Q(ZS`$5K}Eo8?zNmXq) z(k?w|goY(WQl zTecxvCKGWl_6Zc<&ygeu74#-S;{?k@43VbKLZ#N_&mPD|j4g^OsCpx+JC?g6o$ACF zF3Jf#yYp4_xy}RpLi;uS5IPRu%ePol6|ExF>*%$K4>nn(MB<# z0CQi0$LHL>**G3HI(atcJjZq z1w*P$cb4;{hzK$6{+P1LeyF*KxvHh)s9UD*>%e-!P&!VUh0s!_8HBUi?6tv@X^A5H z2XYlu^DA_5~tCB!|_@a060bWsNcmS+~0lKdgGY9Nf!!|2*@e z09@MfxG0H=y%)VRQctA6e?76w(Wu9p#INIM;m*y|*Bw~8Tl^2wf_O%d`rUfv{fTDr zR{Wjqch}>XEVjO9w&Gt}v|9x}7_3KsWi)_$_;;fLROJ6>FaEO^|JjTG?8Ptb1r=Z~ zevf>q*qA}woGg%Tv!0Akah{CvYYyRcej6d{tFR!vLc}+Lt zo#QmE+oFi%pT#R`WeBI1&JlGqr4)w<6xny?_kNAfy#3`WpY01;Ix+G&vU3cc#cDFL z9r{6phUEsWdKWH{I-V!?oM7~9B;4&_%O5%^^5rGuv%TvsF2Md2%OuBGe5hEBGtd6; z*WPHNyQCY0XJRtGay1Y2iO{n3Hx^T}*VBiMiyZClsUqusX~O(6LfPb5P9IGV;krMO z>s{PKX0l;Zjq-uH=*a>E&N4nNK*dkov;4S_#M zp&5MD?d%jY@jX?9TvVsyEO0Q52Lg{jKhm8BR@?fPImFJ!+!5{szu^oqhucBECydyb zYgszF+L&8{&!GBhHTVohW88?}NH~y@hb6hn72?Ek;paN=hq50aHZn=OUe&R!kQq!W z9eImOH1tLN_Sjf;ZB0i)fUqqw%grTa={Js@b=xBfI{hiN~mnwrje!!`nmj9?g7Hk^Jx>Uvcb_ra*a@V4`W%S7m9zd_5A{ zoWOGl9G8oP1te=q1=2{P3m398@wXC(ZdPbMBmWdOr*bw{phusH?J?z^ptHrv&=;RP z6e#*ctv)_st09jZ($!)Uy?h`riNF5EFi@uLj(ikkpZ|03sM~V$_YY#-Yg<_sV9CdR zx#ax7lK)Nti?!?kv8xb7Pyhm~yN#)>%^iT13~mpueoB0+Jy6aTyhON7<*(+7YZrP# zLg9FtAFN5%08vhUINRe1yE2Dt4CJ!AO$_IJT6CW-SD8Cuj>u8FwLO`Tiw+2xTJN!M z?+KV-uSL@l@H^!&#(MkwZ`kwmE(@&d$8Rc7&$3CBMl(j6xIX+s-OoMBiRV3CN zdn4A25%yQzwjgt%HreX9t zrrUa`J9I5uIgC40_#JB=txwxVtb*YysACO6CBf~OZkwgGat-gPW6X&f-6rarQTLAoU)PcldEH1@XHu>r zH((K&H*Zi?+!-2vllUp$Qt!(?stAs1DeZ)hV%MJVena|4Fu;7ZT071hybz=wqfGKP zk2jQTBX?&!n)PZVzU8Tm-L`72a&ECQ&9NAqtm8=2DJvZMLP>({_YhbETU4vT>UC80l?K zbftV!_Ez~a&+$!!-jlYrE>g;__b9)hbK?Ap`-syg&x7rSWj8x#2SVv5C2LVo*vM;48XwwbH~D9uNMQG~$!PIgTf1KX6EOK)y*5q3 zcuW{-b}aK1Q5rqrWf|gaF3Lb19yh$x5Axt*I=THOWslW1gB!1Yn=(7AdWRsFHw-C# z4!H&}JH5T`#?W^k;TT_~?HuW>K{Xb;)YqU|&_`gE&IMlQoi|;{C5%X4XqQcByS#&vAD%-L}r* zhn=kRPavSQXyt3uMZKNK3-ab7Ik(g+OgZqYq($X;_olnv zGW9K!FMH>fCo6WjR4T5|vfV#`#Anoctgdy&XRO4YHa(?1Q|@qJ=JL&`$MNfTXF&Ck zL|7?c#_Yc*yyM~>#=+$L2KK^t0Xe@hbMtiQ2DV z{vi7PIT#xX3224?f3V+(zfpkLRIVWPH%i+79-t*U5jg6ZgV^Z2%5o@Rpv3^}qMt6{ zZ!-s#MZ?AnT6}jkqHi(K?S{@*D~mDQ6tGqQ&2XTf4t+Fma_AJTn4|3iZ_Ym(4Z|t; z!?~f8pUPm&?KWVT|HWw7Qv>-_(YY%zpIbQaI{vf4F!?HfI5%{DKg^XB1L9i$X1G5l z_lFt5c4vc}fhY+CoE6|`f20MVKXH)d2c6>!OpEJy>L)lqQU|^0niZuB(2@ac=8x3D%!|iX3%zQV z1p`kONND~g-jCEnFOdWTDk$mV{43nARYNaN149ic5#;#=7PeYo4FP(Y52jkUXE34A zD++$Rr_d`EFx4Uu_yyLF)Iv`z2TL1J5-Id^s9&!ddP**sl8zE?k-ve7ttObui=Og_ z`3hVV!-V`Z&F_cC5Iutl^A!*Q4oc{I?N1zRbwDeJo*967=qQlIg!vmER`l2)=FUjH z^eeC*DTW?3!^HZ0858UOe-zQB=v#u+;)DGw9xIOd~i2K>aZ6g>EIVAwah` zN*Fc%>IBE`jqb1konR;VfRJ%Jb*48lst$2JqHgqBKoZl^jM&TSN9+LFR;PU jZy4ak5hb{KmrN5`q7~4g3TE-|JO<@UQ;?2SFBG literal 26708 zcmc$_1yo#Hv+tWgaCe8`?i$<)?hsrXg1cLAcXw%|gLHyBB)AjYAviSd4wvlxz4Ol9 z$?ulmaMJ-J4ZKXD^^DnGaD020JD|7g#(M3t%-|EXxy+I zv>3XSLw|q9tte%L{}=hG-)h={eCY5PC{asU)g1ft@g^-Y=XNZQZ$#t{wJ44&rEq%N z-5~zH9qrIfJz`;TKfc;95X?{80nHV+ku-e^50?S+*nIkvjIxRiNsYZp!|#7(H#g9K z(9VL1dp1N)()oSZQ7=Z|uVILj6+YV{D)!+3W{h^QHi;1kC_Jn!HqsO(5Mso$-P0|w z8T=l9db{a~A?`;#M-E5-T{NGYsDa!gmf$Q$m*lxu+0U8wai!alW2~PSh$U(aEi&_S z)?-Z?*HVN*!0EvI^84_7_cPv~h*2+C!|c4qL-6f?j+pL0B8K~qh)J1!{=Xunwq!pg zik>^VLjG$~yr2Yc(RmQY6npg}4)*(0T`6p8y7J#vn@odR*Nc^Nns=VU~EFnr&{RWaQa5bRbmqA7$8~^oBo=N zlU6nL`sW7(i#_;kA-=dQ8{gz-*Dp4xDU zsW}O_@HS7!GS3F3319aiw>y1_4FT9}qmxjXt z%`2`M!C%V@STZ#W(s|Cj*jYZ6UBwl7A3Df~xA>JeHOB`N_>DN_Xg;*StP>+qmTp>rG+tab zA>vt)U$(fh9cQ;O&B?=|f;`_2&lErRL^*Ce7g)WGxD_!^d)M9&M9JIx#A*`HW+nZGR`yC!t z1;(J>qkLw$_a>1>Op0rdT1?R^t{CjhdB8q}9S3Geo&Q3wWa%j@OgzPNeKx5zp zH>@T|j0EemGIXBr8_f3)>LVt`7ifQg-FzvpHh2YA0p{NU`_F~uPuct@sCo{VV%Wmn zxj09P)m5qG8pBdL!48wgDpsbo)v(A`msX#oGb|j&#(1ubtcuvrevfl@m zS(}=gQI*_ibbc=^W%|i*H`r}1{XPCIo-Mk}+!s;E7Xf`9gdX{A(jvnq=u$D_^ADfG zQJ@%MJ?0O79CMzfna;hNMVTwsibn(=CmV~$@x@i!Jq`yPK0p!%7xIuwI!p6zT1gQ; zL7Z`A7DvS})j+%B2S;f|Tho`yMdA}2NBaw{T=Uh z?ofFU(4mL zh_E#n&l04NfQprVxE$O4AcSOo9EpEvAJ3D5kQ1;8b@v`@4X~sw=8viJ>1MkQ>2b zzBg9+83FY(zS5hE7P}Y(Rac|we9E(Ih(r>5ilAo@`DVpP}@zjfKGqICG>RP zKDSca`SSP(^Ty%lkVKfMVu+tSyGVri9KVn|Y!~SVuK`RD>VAYS>9*g2y2k*qRKc=k zPN+sTrVXkqS3`z_)q1oqqf5@0t;qb#zaIF=Fp6a&THhS6aLyv`x6nIWpTv_F zzM?2hI{ju+&VHuuNUV9AF`uYLFnr2oSkmrPlTBzp`&lmQX4paLTIE-el5(GZ>eP>W zCetK_1qwuxYmA5P5^8bg75Ko|%Sv0^IQ?)F_0V@2l%mFOFVland1E*y1PV%%2;!aU zr>F$^U=Do`nWzat)S#~X!Jt(o3(8z>2|;O!|I*U2I1Pe>J#|F(e5W_?VDT2F5#`J* znW#TD^H!D^SViLLy);{!Qe|Lg!&+T0qGdhzx=yuMG8zAE)g=B0nG$A>{}Y?38f)rU+W11eg|_h7UsQj5 z2`gxzd8?yZc@CULH;rX_ix9@|=a{wyWy9N=xq>p;arN!2enWv%-ICw$m~7^LWfU`r zrq1u<_493q%b3Tp$B9wE%QM^;pIbxmFDBD9XxQm<5EMOa=Tz?w=g+Be44C)$;I`Sg zII#RP>cZfHv zi8c4}bUmVW9-h@lC!me5kq!QFxxJR#MZs?u&X6?5Fnh=`q6Awi3+Lr_B||zoAmZj7 zvPs7JdEvnSo{Li9d@zOnRENF6MOyJFuPaZF5P=Q0U$Dgx|uIGDQm= z=A+R@L&!J$Fah@fXLwm@L@Vc*B_2RylAHWOkwW@;vz8vBNtOw9S*Glib8?ZZ0q14D z*QC(apmjw`F?!N+W0h`Ac%Og@)kxBU0iF3W&PGYgCk}=6ZXp7r0;4WLiK3(KFpEPy z_gL-0gh!{)IfE4rf-sGhtzK!n_$7hGJh2sA^{Oa~6mC5{mjL$p?&YojSIhM)+df{kx{Z5$bk)k! z?+ZoKTZ!t}Obx=KQ251@8UPC{-J8=eG_G7$W50+k=~t?2ns2hS-<^myfhoR_yF>RXfwzip!MsW;xml6iAj(j8#n!rLWUbi+SN$SM@k#y%g1 zfA)JP-?7KUjxYh8xsMgYUHuqG^EO`a&<_5)fE^}cPopQYCy;4^9nHQsoDn_eRAESA z-1Tj%Jc0}9ry87D*koTec3tYBFK|BAM^IAH?LS8lc3KW{%1)rsbnQd$e<6RURFz!S zGxHShJRy$pX+rZ`hF@3e$>TXYR2F=yk6p&Bn+zm8Qw<=WHf5dG?8GQyp5CY7Y5gI5 zz{b6JO&(>J@>%2y3F~vH47)fZU{Vg7-JHbPVeaRt%%7TaTC?^M@pYvWhyTw??4K<^ z**|KEx~qw+m5ZyDne2b`{ITjsO0PYG(3J9LJTY`^3=AyPkIRyE?{MB=7J znfCo0ZURe(N*HT$Sh0~JzHi8eJS|({tA_jY@0wi3nk~l;pPw%-@V@MNrpZK^%%bTw z;O5%1Cb%oQFiSA6l;8i}O*F~)d|_tqqhEj6F0I#;Mb4^G%OVg|c$hJT^-#RIps2Jw zZeT*z;p7fAaSlB=LvsT^5}ZD5*;&R_jcQIulsB(3#5?MXg9_m)wqAT(`|3A;W__Hv zcgi1`tR(F;?IzWGA3k_Y{x&~S;({_G8Z-~CF{}~ zh*YSuE!QVV#YuL#P*jxI*kmjL;+y9vv!tZ0%Pm{o$aw zwq$UbVlt=4e{q()`(CXAx@-S|v&0eQ{JxO8yTF(w;2vcT$7B!gY}4qh@N$Bkr`2G^ z*^raTU@UUN40>nJd*#Q;F^nRHaiV>0sR&JMj2HIewv~3V*Ea6D=rn)nwS3o6HXgY_xTD4M;Fi zMl6X?k0TAp)WRtrL#i~!QMQs_`$>4%_%VDS zj4tf^Gt?hk&!@atOkbD4pntmr{0+MsI`c$bC{s-2+ywO^NKa*j&kR<%69TN=obRY>t|rJL zlUpVzQ4LPBZn<2^1(V7KY?6bAK#Qs1^M&(j*sZx5{k9++p6y^vQ0MX z2s`2hdf`i6AM*M~lqQ)L6yI*I;ksJ?26VA@SS{S>%xnY}PU{ zF8#9j4-U5F0T0y--oc{&t3O8lv;EyO6>U^)$$sBpOj*_bsArq&IM!$y9r0Gum}u-( z=)1s_OdS#4@wA`$j9A1*-;Ez*mMuS0?4S>nJGyx{jBVGzRdj-t9eJX~))!AOE2P!9i6(ww)_~UMrW;a$1iccDe;){pf7zv{-eFYW$(~i2hr6_7S(G$#Vy?m5Kk4 zvuL{z{(}93KBZ4NL@r)dd|J?U7c$Ehw^ z&%q@;P~x$zsJ5H~F^lo!Xf!abe!#BjWXX`BciJpM$AZJsW_QAW4<)NF^BxBJHcvby zMqrM3x$XGJdt@tk!sj=X_=*pwKrvtb2<6|Tt75*ZqQy}Tm2eviCu~mZvI^_9<46pS zSozLaZ>AiFA2>&T*y7zWj`$%Yz;FbbR;^iJLp&fd_*Aho|{s^Od5+GX$!icazKet)Fg_-H47 zj9!G=bH)_~-4F_oEb;*TXEuHOuEGih{pO7?+<&F`E1Oya%v_~S%v>Fuz5bp~xtey` zSla0REDi`Z8Htm8nZ~RUGTiTRKD7V-c50N zeEXy-l$YVz{!$%qy|)pHEu#vL~^kDK#B~ zty*jZ$SC$q@cAZItz^|}qwH^8X7(CrW=NqAHW&M&lbW@rl}@ev}`BIC-N4P zlXB)|`-07xW#iP&bQ46gRwc0bOGdl69$e|WwnuDw^r^z;+}ag)HfrApXdI@;xUE== z&IbvLqDx(;z9V~N77DPd8}I24U;Gko>E~0U!F&zjbx9 zq?ruuvW!G6i&$hFnwJ`@{`xA$&oIQpwe?KU?Z{Xkq!GN-XMxaSH=VQ;Gj0de71M1Z zL29X*BkK-MFwM5w8-VWSR}fY{G1pQw+(?seoawZ~W*)8L!#29+T>n~d$I(o@Q2q(5 zx&Z^URe4*&JnYUrS71zF@pN35#nY_LA=Iw}&ZcP4rB&OHbbv(H*ym3YI;0Pz7dw!+ zy~|bvRuMJ_2{uS&cAC!1)n%HZSQ@g|J2zJqEE36^PG5FRjYQd2i%x>D4sICAfQOO+ zODdZ%(e*s+U$?M)GEp0aW`0uDr(^KqJ7_;S;I~|J6vle9=Mx+^9&h|sF!fCOY`Tn# zqw0?0*Ueuepy{~&VybTENP*NS448IYV_e+o6Jf~y@L9ut2}fp^!p?P5G1%3xM{!){ z!GB>x>RiSQkJk$9F*UUs-Q+2`$H=mZ(k$Ixzov)NY)ElO-2;CEbL209*5mL*obEC6 zR#T|EzLV|nXv3Lz=g59wrMR(`+CzQy7`#mV{9fB2Bh@v?Hf6Ps{XRbV5SG*o$_D?Z zkQEG~2?%#ULN}9d;E>>WZiR006jjPgyUSFQa)gqeMDT}pUNB4zcFW!eT=((Qs}pWA zKQ-aGFY&Xd@u!ODogZ&${U3oUkLpY?XY^gH4`<`zXKNd+?}Zg_aYX#NvGb|Dc&Rn# z!J9t1-;!N}&BuqEqR58uC6)S-WD}{iDRQBA2Tqhl}RhH^6*5OX$d#>m}x6nZ^?TW?2@PIVk~&*+rLf;62D{! zio6O@9^`*li~g+aZuVBLt^gNTR&{`jiI#DFQ zWb`n1$@=*rcVQvC#!eOc_+Z(k^J3*Br}^b}&gTT0FRW9hTDBXSdg6DIY7yGLl7h0&u+UyU$EVf6h$Ynl*m0lC&W!$Eb? zzLz!$@A$DX*!ZlHmYa*ZwUk>@I=3y#gfksiu0gxSdZFsqcPSZ8UDNr}Lcdwp)crec zu=ib#!w|%sL{(>{u+VPu@C0w|;f5@|#DL%Qb761{pdxZ|GRC=VBvbs$!S#J8rYkr0153@;G4T90A;dV=Biurw) z-x)WXT)x6MB@-eX${MnQojl_k2w2KF?-!>;AsGZ;b!>P-DNBhJ+Ew-P9ws6h^`nPz?^&?% zKlu(aowg`FIYa=qc{4D60X2fmLsHcdOuR`>r})R~+P4TC`^M11!Rr{&z z$)N4b{GtnJJW10a-W-rT6I(Sn+QR6kr<u!BGgV)W?lYfL2Bp$H$?!;m9lO~-ytOD8`NuG zn+MUsNzq`N5ix%nx}Ne%lbhu&lboa&tb613wRd@?q9!+Ty9it3+LbdXzkz$O+a}2= z-&o2v!E|%;oFHN-HoqagceKpSSK3;-HFMl$$eF|^GQ9Ux2V%?>HeT(ei)=J`#?kRZ zSD6BW+|F;6?pu*S$k~49Vv#ucOi^EQ2q3>=sM_7|#4(E7sF!n}$v*HTF*0FuDN2VP zgpKUuS`o9MNAy@6LbTBo$6F%W zSyK2RQ)xJTlfQ$Kb8S1-v6SP+kHldUj!<{MeLx}K)cwX*0kWV$Le8wH1;3l@>%u7`+wsUpKfD7y z{@EUHy{gOb3idV`A>CDwm2!(5GfptmeQjLl?A=I)bt?ycK=n&ro^|6%6IYh$PtMJw~(SYZ=RSON}?_E@C9 zji51}R}>w5->-|={$zY@=>-j*FTGDh$h9|9NJgV4TFSdLUvV@7{$X{@iR zG9C2HGdtNvW%{a@I7+V^HdqyShH*9!_IC-Pw=vsqnV1#2(6Lp-7GVzo`g?JR~ zQGmsxefHIU6J}G&O8e~2rH@hi#DuawiWMRJ8$K&3k0BkJ{kt0M6g1VOA8*DgBFGArLVj+G21(Ogb{rAHnln~UIb&_kUII*^2L#&&!Qa0 z#+Xs<9#Ue}jGt7iRZ@x~+HY2U$c90ipefgY&XZUt;>_C3!yF->u@+0k^W&$j7sKb5 z{^6yQLE-Z!I{~TUY^Kqam=LZ{HK3*<3Ijt`wz}^{jvr;6yj6R9968mw$eS;a(s6N9 zuvxP7*xY9yT~(#TYlf!)@>2jaM7&ZgHOpybV{s{+v!doF%%u9_$9})rjjr=^Knb9> zJN+qIE~?w$C^f;n^*R}|NJ7rCthQKMyquNUPy_q8;i9cqYKDru-noY=mAW2F%|*#X zr{#N_>3z-lf)q}ulOC@O$0iS}@8)x;kWXKCqxFmsm~iW3T5;D~X&hF$c%2$YtrlC; z^-4_A&sM4?gT-An8=kGs8IW=4p|oPI(Zs$a5>k!cwvF=;F2XD2F}d5b^4_!GUFRD` zzx!BqG*sKzguXVl@ew=!Dv~O}3B~CxiSA-|mPt(;WzHZ&)A-S7AzR@HcQ$NmMQO)L zEkbS(C5MO0#KgkD$jq9nu8OWCD&{rOc6mrmySFrw7T9BN@jCCjtV?lR3^${_L1vU*w0S5 z_vhbD3ANO2Iz~c-O%31GANSHgg{)P=``)pOGVjec^p}2Sf?5$CeIVW%=_O z6JMGyaF2~6kcU$W5%y1q)iVqYQw&G2f?RkH`?EjP#3Q4JmBA&}s3NmGzAMh#meS9r9uk`m({^ ztvqLi*Z*i~NlVO1*)I5440JyOh5%6fgC;_w@4|EFvAQxV@3j}01u-^a$xD#%!r?UX zsMlASpKA|r^O0OOUEB>lzpo?kb9bQ5M0jeP<+x51N}U-aVNPBdJ)LbfqC~ExF<$^o zd{K0;^J^&|ts41cP!nrT$AN+dXPmhShDXoa>iSm(PvxXX@glmns;#6V$?Ns(ZIxl)YBrGQ@@sE%2!yqh4}X`3>pgYv-ikE4IrGSm z@;7IfDCK%*mpu2e4JU-Hn~_YMR$K7tR-GC&ubahjnKG{X5NVTqeeWCBUxTVwGN`g$mO?BM9ppZn4Uk{8n@pj<$XD0&T3Pv zey_E(z{t43=#tB2t-;J%>+?;cU+^F=eUZjb>3a`CW@Ot)Tjg-TZNY^Isl_+9Nl#b4 z+uwFIC;VS=I*DB9!AsCU7bX<52qRH4ZR+RYhIm78N zl5Ced)?H18UhoU)|8neL7`L(cAk{Y<;warJZ^F0wcD*__1%rd$Hx>DYT@n>p4<$R0 zL#H(4K$RFgqLGOU?t+|NX0UK}c~qjzZM^@$=gZAWTw6Ae#vxzBNu5X^nmHNvg7S?b z(o>J>B>a@p{FcWbzs9IE224uYRcT zJBJ?e54dOU!%Yr2H&qLbCi!GHcAH1;PHV!)0^d&tI@Fgv;u>3f{KS?|es(ZE*gLHW ztsZ0C2yJ%YJ**x+^gQLAxvw>y;N3hepc!{+FQ1S&pv63hIf-OEp3!O3BJ1{NdU)FO*KZRNKBnz?lDvldo{xP4*SD0s=`Xje3=oNZ zx@^kFa3Fgf?0-_Y4n4H&^;2yV5;&f65($6OzrNV$;9JcjyFuFM2ze5}j^60tS~VoT z3GeYEcyPYPaq6U6H6*+l-thnMAhAG(dlTNjB-8Vh=oEnc0Nm_oAT~SOtp0j?)--Z^ zc3XLS7NRdr+rp3F#sO4UDJxQPacimIRI%jH4dh31Yp6&CYZZ=}xUyJtLj<*VTU*|^ zkprVu@PI5%ZeJ^gRc!F9qzvL(x@J3T5O#ZAas2uP&DTV(I-R$GAr zijCnZmf@Kd@Uhs+@SgDW69`UUXb(a@ z-5o59`t5fC z2Y8u)B@O|Fu+zJqawBubVw{)ot&vlkZT9`dJ!&B=n-Xp5xXZCm41OHKi9*Rp#SZ6Y z`(-XAo&I#tm07N}whK#;0nuTke4@ekHZ;LiCCK%t93%YU;|2h-1Lg-^BLWjMfJinI zrJe3AKQplEQ(uS-$1G~P(|Te|W3qWrE)A9);1-~D6+NzX$J*hjoZ5NY^`!Bx-|0qU~^rocZN`; zXO23au<(*;IdGUSB2oTwi@bnO8gOvx|9i+0>gg++?0HxJR}+3AL2`?aYmQy8A>+Ya zRz##qO9Q7i0pfhn$z8i&UjwoeqUQo=9!WOqZjHt2nqxE%tV~LBoDN-YSFrMAb%9TJ z_4V{=skq???y7!lADJ${;oz)T9mdvdPuDTLGTbSD9XJzr$9W=O?(Os^?@nJYJcdvl zgW4jNUUu=$+%w5m$8A%SnAPq({iGaHP&Bn&tv$6F)}JhFba26Y=Z;cnDB7-GdpT zm~H)A%9kp@5J-82uCABnu9m?}sHV1?(~PE2HKg4Baa&UeqHQ>HZeTFuuJ=^FL#8gE zdD3`O+}Te1bR@Lza3cF6(n%}T9_pPvApr7FJ!$q9Nnd~?6!DLEisNZ*Lm*bRk19?Ec8hYAC`t>qy#?u%x2r~If!r)dvKSK`UklqF%PGf4z8@yhhv~;C|uuZRn;~d?n zAav3)z&J6I0|=jXKTyfol>$OFJqT8Ea$|sSNtXe~M05A8Ln~@kEID-}bwm04XPUuU zz%esdVF=W8D450BjU9q1onFKuQRP%WJF^X9#5ag+L3FFHu+guQFc{wBpS}WJf$bgL zC?Pb`yg;4;o|eTeYfcERbYoFNK|{;pjf-Z7o?nisj`e|+So>XL@ zz3rCfIGVL1@}U~-yJy0k#C-UQ@P@}N9fVyv9{5^d_967z%D_C6OQt^s25jhfMFF9f zW(B?$7zl)0`x|i8_>u;~JiP>7b-H4K2uYs+g+=}LAe7oz+dtm!h)xW3;pX3LEoXIzMg1OR`4v_GRzki!b4vLY~ARvfIQU!e0AlPBp zX244A1rah3X|8C-RlKqjV_oR1T5mApq=}~)uS!}jTpm~v27YCS(>lmHYH?JPQ~Q-2 zPU}GHNbBwL`ifU}r0rCXRE`YX9A_|QB2_Il@H7G|g!Et8F`Fitfu5PtWYvCU2mdG% z5)Iic@2q%b2mdIRFoJN)`g_GIJ27E}*J3Ch_1`L9*};#Mj1`Y{=kA+%WhbVuun$Pn zl(h$WWk(vWhz3~Nlm)SVWd}$A3RZz@&Dt+V=Z;pzu;yVnvW}~GWhW*|^+FX%Keg$V zogNT&J-%B+1&8)4JJRwh@~Xr7%pPv9>_~?L<3vgJA#~cW?3lPRLHMT6z)Fs8uk1+E z0+qyaArLO@S9XkDX{=!&Oxl*Muk7^h5l=URX24@EZm;Y};}x-p8;nFd^ifx`0{jRL zxGU%G#aMQGc{ihOH?p0muNiQ)IXhun$Byd#!{-XYmUX0V&=6^D-sTp9`oIb4X_{#Z z?Z&1SochoSt!bWVckRaJ7Lxkl2@+5)NWfra8)82#6mu-K65g^l0}UpX6zbVCnWhBE z7zph^oTjm2@+5^qy%%RV!Ff_b{d->1NFY3e_ALltnlZ*usy)nmWrhg6D%swA`5I?=&M1b z38y(HbEUss2;sE;VjW?}Qqx8?xSgT8{S zz@@EOf&38@KS7xwaqU`toI(puIp9vgPD|EqIX-v(1e6AXbzy}RSWY#XfFy`PBDJ;L zvHo3s$^^%>^K{|sY(_Kl<2#`IL^gO&Co(YcIuIYp+A(NW-Cxa@cZV>KwUW2x;mHBP zmVT8r61m3^WNphLEw)!#!(&}ip$Q%n%N_pwDr=_iz$}h#u+p!xMttSaI=CVhq!{xmYs6L{*3lJJAiJ1X zStGG>Y#m-9pdvu2cy5N$&QrklGTpsrS!k7KMr3TS+A~3 z{+C>ZvN8S-9(A7t?B3FX<%S1rRlO-Vc5};T{8wIk{v?w0Plo^G^)-h={$Kn5w*HE1 z{Ga6hE5ew67D}!mxG}H|0dU(ytZ3i*4cKQ8zDlh=ep1f ze(m4rAso`Lg-$iSwWSN^KXULI{`fz6`Bx4||D*(?(-!(Qv;W7^^ZyMLsTBStf`2_D zjOaJCqi+BG02xN7TF*C)7^9c)=jEDFk2{>ZVgJX?wjM-!%tTEN^|8eMtz}78o!n21 zyMV2MI|BLbpcv(?t}Uo$y1Q!qN|$ZSCl!|ZI(>_ip{!{poosJCmT|#P-~nF=@JJT9 zHlUqBTRWR!PQyoM7C=TfXCcBmrn@_4=a5LtTF0ktXsaV* zXx*%4XrIdXtxlKxTLYNRojcIO6!ZHGSa`2S&1O5BU7nf&M$8t>nkmbE{{%JEoU6cY*=Vx87;Ki6Sx`$l99~kK5;N z&lBgP$^pMJ0%Bgo%$mZ7MAT9G!H=9Xjy*#npOO2k9)tTFFaMY~s&{a)>!6ogxY)aH z|7|iZtqJD?m9Yol*7Z``2(e}Aa6Zp9lI{bswr;QJT#4!Fw1hwtFN)C!V7?I z7v&?>f9*MR`L3~fxWJ-0!J<3P0ST68NQL#h6i-BoN^R!TCFh~xWR+*cpd&>+)*Lz1 z5txh(;To#@V^K@6W!FKL35dv@qYVSuN0W;E(92~|41kCP$jw)JVwM}T?Z@{!vVKYj2hwnwM|{?Y@{cJ$~Q8K^&AAcMpn(| zlW|+B`AYGi#SvTZz4OH0!w41kSqv%c8dx?H>-Nkj#?ukLu&1Cvr>b4!1PwW1F#Px~GEoo1$gDp#b|rJlFvj2+dp_snqN|e=MfGiym_Bz# zF}jeu+OJm7Tza5N^8;ov5zRF=UWd&Ea`!?{+~ns0H{52uX1qXPUtMOcTNiow{;n9o z$3b`)R&2ky=_KjZg&&>h@ca=bFcQdR`6PP1dLJ=mCbLU@Uc-giAv@DhC@l{^hj?OeGYz|ghE?As@r{(@LaD*Z`!O>1I+1X~M|kIsn?GGKwqrUMwS*tID6#0Wz2Sa@Idt)2bz#SVGnY zu7|aEs~LQ2KYi^B$+7oY2e@II$8#Z!%xrh--ySDIBFp*P-GJN)N zke%gRN&2UyYgL61A45k%bBpqr_Is9n_ddkcbJc8L6ut9B&xi>@5Y;)L56U!dpWvJ*@~eq8}Z%ho&7bah11+UUO%C`-yb9ggu|&en`Ys z?Jyxmnc7!}2IoZg$p^!Zd}pq%B5d&!*W?rD;@pI+;;=2G&{i(uMo?GEZyfkwV~#`Z z+x&vgAKbumIwy_s#V=g?TBzs{u1?)2Rp3wISa_l6uS$`D)YK;*0dUs)&VDi_g1{!Z&nNHk$#TxQZv}lw5Vk? zAL~Tb9`jpC-{O%O7l+7G7nA;8sZMh};a}D3{qe~Gq1J<)cggvQXU8gmJ}})FGh5Sj zNYmz^ytcXpmyJJ&4+nPvbz&Qg)RdnFH)KCmU1`Sp07EiOYVLt<>EV>}B=^Fz45Zx^ z4qI@z#sz?`<$vAM{Dk=5s=*w8 z*Wgt36(uZH^ye}AVR0Svz^Km{x^$m(jjJi1F<9S!{-~>1@RN}>?I@9S{y6Q4-1`Lj z7SYg2QJnp(3+|NM7ZW(9L&!ZZIlpx{l9`)-lAZZ+2KKh zT5sl_ya1pez?!Y`*C_Nm-;AWUJ}jehU$P;;RNG5|ZI1YJ3TbU4-gipgF|1$;o9qeI zNHQ^vIG@`Z8N-l zl@Nwz?h6drh?k{DdeB8JN)1LPdohoc|*#d z+b{p0VN@5vS7T=8B|m*zk%pBC;VrBfMbJC=$ai9jZ%};LB0sX>qaUz&AwVZ* z@^K;*1w}NutG703Ix$wxuHy{@jPrm zcqh{qT4PFXhkYdX%6Mm_(YXU_lCFaUGo^62G;$0#8>}Iiu0t3fE2dJm49%X&CwGB3(z((>%7>5CmYXQ3`hBQoXm?_h$XFb) zP&o~z9sN>)WXfpcJuAE_LaHHgv@AajVkrzo6`<;;C>LflSO4&ABg~L#;FX2C&p=FC z?;*i(S_4d)YCUXRxA`%*MPGVrITO?Iw`+P7>mYjAQkwgGS;i1%#w{37UsH3J;I~{N zjGPp~Rl}96td2Br&g4t#`!eBq%@p(%M<=@Ys4;EG%ea=@&ZNv+l5hyw+2!5UO(MhvXVTbZs|B8|9<{#lCovgGIvx`&2Eql@Q9okC4E?*d^`N&NhQJh`=9f(VLIal>V@*nTaT z%>%giYcu6Ot%0bvMGfK>O;T=voC+8CdY-e+yLVS9!Zm$T zajYEWK^2bkVgW?32Z1q?2Ds|MF0A;YVv63-QIk;wIBHZXYCEHGdYb|?E-^mWq(0qp zz00icSK?k`-@_5g#a{ISyxOV*4gen6tf@BoWl@8Id9s77FCCW^xGwF^ZE&ZEdOjeH zwBw129du&xlE{(WT*iub{|dp;Jv5|KNQ=wjj!ZDGKtSaS%ZJtQlczBGT585CYj*S# zzt;vmb+cwzGH1 z3tQWsBD~dd!VF2^V{XZ?f$UxkywS;Njp$@J@O;^#gm%sQO;uZ`M0@}F&4(s8rE+^) zpeNp`#&5iZhNGZ;g^rJdR}=F-iViJK;-^#!?I2gVt_J^;)?$E@PzQz&ZXmyksCYV5 zk@4c$!iIP!)Kj6}g61RT07k*DGcK6>>?HCKTB#=dFV~wtg>RI)1iA@&16EBev^?0= ztKST7lvn!sEH4E*-DcsuoIpuJAypYm1r-$FSezpCL)jku!uA3}(NWR($?hPlPYU=W zQF^|0^hzkL{VM^XNs3@=qg)^X%J%aRHwv)425EGSN<8g;e0@D#?gn3*kPo}X+NDAs z{s>$meDn`?j6%tTjq#i|ZOj$1kTysyHvop4`%5GL}J5u{oRp&ad$FkCSH;p=sQ01C3 zy*DXvh{BBS$9~6Xl}J{x{(cvcdVY;$Mp_mumXG2h+13-RT(DX^|KT}{&c?9*6|j5Y zH;?&evi$DC9K08d$NZBYSMFlIs(wqwR!OEmHO>U0;3Zwv5J1Io$1ViV`n9!;*`wlr zyD}S{uX;#o(DgYccyFHDaICSb)PH1MBEvLCkhtW;ba&ANaN+?~ z`7RMcqM3$4emFlGLUQ7Q)f5~j2?FuYDKsByoowP(%Jprx@xqf?D+g6cfHZPjb2B1x^q ztO}8W%?%++b-$vRW1a+n5aZ|;`__ZC$<(0aHAQvJr_+@8$1w1Perame-4nr{s{9{w zFYUDYFIEB~6=?VR*(X7PRHkoE5zF0^OrXBZiqBhR;lV+)aV@HFkliaH1Ih_WVJp?Dt-&V{uUAhm;o@GcdaIh+gUPsxe2u4ZX0uLbZ!?nsUnfZy_d3g8 zoKcav6$;G%u-b)!QDo1Xj8{<0=ILsR-g$-S+1Xu1vxca|&MY4Tg%1+T#&iu#mL_uE z=8=wLBMEW{V)8N?Bv9eoN0Xgv>Lzkt21IBqiSs}|)bSI{82P;IRv^?OGLJ4%qxT$+ z2^lXaHn|?Kc6$$bI}X-~;wmzv-aseB3aXngM&{0*i70Yn46Q6Grc(=ZM3zmMKQOKW z=;YJ_ik-irpFRsL@|GsXcYS-ptrVT7r{oIt5>=?A#naWru7QXmr~#)C7>oJrc=;Sf+ z!AOALO1%m{O2l(o0oJvy6RZYg zdCsb=OV$MJn}~0^-h-tbeep1-&)dxvadJlw3fPRz8Ju4W_1I~RdGUMBfD~SR?#ThR z$VePwwmV&N>>}jO%}}SQ5?YL`pL@m0gy+`Ar-Zi9UXP2a-#4C6yJoa)Lt%H!L#&L_9^n+clssb$F{$w|5h%OC;f>tExa)vEv9wzy1EzE%O*Q{0i8-C- zN8AA#W7{#uxT1~i)s{i*zAZbR6g4(SMlLH+r(x*G@JS_Epto*1+V3QmZ}wHa`sNAk z*Pd4RNAm1e3!xArKt*NySPBeESDeXsPzPvMT$nI7a^p_(id|8uBLIc6sTyBc)%?sR z^nEz*p3B#Q6bYE7yhx5pyPfRRuTADE5QbFknB|cug?9htasBnla>JKaSs-aA3DmLi zmGFtnhN*0sDsMtV(y~+;5tEgR1im@J&Z6i_F_?{&FIf}%5(>G>v`NqFc!^Z?h1W$` zh=eD5<#+wXZodb)ken&u?(Tdm1-K3PUF{14Gd5@vS6lQiI{|oc0(-C4Hltl(0WL)% z2JH760I-h~ZAnCSRF}MTz>qmySCk!Pf*^y2hSK>;!Q%4Fq?AXfzRP!Rq5%uEPKWYf z^86{5MmoWYG|Kh;)^4EmbifS|`y83bVE+&nEm_2`VxdYq7meGMYr!2@^?t%`|LXvo zN}jP}=AOP3TT|cHZ=%ta*I$U(O2Xd8m*TR_=|IgvBbq1dX={UaP>wE*G(dZbp{9gM z3Xil!6nTT(C=pJ9qfyaJC3}V2gq+g+%tpZstHVsb?z4h-R3kdQx zPl_e-aCX*pyNoirAjy}otORVHZq1h0rGYYM=@*SxE#_*6cP^;0ZDc{hHit8nC~S-h zpD7fYKPVtQrwwqLi3J4l1TD@9+}XZ9p@Y`jF={neE^&mvUAQT(^a@Q0c+E*se!EUv%D$}yQ+L9Q1?}#AB`|GvO)%2)Kf9wbDdDRj$ z9BatqOh*r~#5Q3vEr(wqm9{e3GT!;_QoPnpe4z~#sr^8;0#Dl&3B~5>v!5qFn;ukI zpxU)78mJ8u0Y9Pvo-YrB89mnzW-zD$w$gZf++Y9^oMEkzIoxjoB9CjDSaSPdrSPpVWAFvxP(a2); z@bE3$yhGsG6HfI81PLD2;47b8Qb=+xgfDO?f=W=9idB@))Tw_T zmR8*SGP~OTCF==l#b(-TONvhzROr3tZK)=bpGlMbGLwkuc!YKV^))Oj0&v z@eWht-h2-|BX&)27^pb#?f|s~jr#=!oHL}O8`lPGMv?EIA<~e9{ zIIUK77DqH)?0;xHmM}MG-(KN1m(-El&o1mLD6|%x>8j1>y7VS>Y00=nv;6^1ipb|) zF~jU(QxDoK#~q?J+aVHD0_ey*_@OvvCX`itWQe(9^6p|}m3}2lODTPF6 zWqxV7;X)?(^liSkV)E?0nxHerJ;}r`axHJ)SC;tUq|nX2`QOpgr(LLB0{Th!Jo>-F zDLT@&X{d%&`sJlq4joFfbvn|7Ih_eAL zF3SQ=3*?b-aSCrVJVeU6(+>I=FytiiT|tyX?s$u|a0o`OBC387C&$r;3Otf99FA)k z%Jsy#-f&_IUw1jxYUm4OY!BTWql8#5X>Jnhz0&!A!Sh_5OY<(i5o?hkzV$2YN~M?< z$ilUG<$EYU*bsj~qIvXD@&;vf{yGAaRQ*ah?`&A0ZvlS@|hFvn}^9AUnU=eci z$mbvnv`z@h`E0!F{V)Y(N7&sO{OB+1#8la+V;xjnOisDZ8e=BiD7FY<&HcCmR!vw#p{IlQ} zb_sQI?d{|OFegv6sHt%-NdjJE#mjbz!J?2%?}(~=RC-2v+j8T|(?OD%<*4}|uaIHc za1d{fYJp$-D0CzplhM<8UP*e0=Ms15BRB7|AWDElu=Mx^96&ain>@PEQGWQR2u`!zS*Q0d~45l&IKdK>T;Xh|AU^D9!a%~x16ADkL%Ts&vtq$ZSzyX zDmXx@V*VkW_d4o2`)xb8uT|xK2P81AqBMrrm)F+|6j%Qann)CG-3d3-r$j3zxj&T1 zS1P?^*Ux?yN5adwx@Sa}(Z+4hdXn=ZNHI)-^|j$THg-=Tchpp&qDW`*&|1?cTLl4c z-9U2<>28Kr`wwdJ(S$h!T1NOl@Ysrbhc!%6bnW{x$%i7e;y)>mAZ6%?o23KYLuiQSmRuWb%`kG@BSS7D(|! z7&M!hG#L-Su&~47r98ZZN!v?d2`jM)E1?LFxd-RHY5viBWYXNACA0=s<)hK(dv7Q} zZgmm$9{l~pA0?4myPR*u-#7#%F_iE#!NQU9PH=uUQ8`~cJOgO{XnZR;f3zJ@jyfNq zZ)((k-4%ghiC^8E2eI6!e{dGA-2_amp_s(sxn)&ze&h6JOPZL$5tG}kjtle_TlPR- zBIy$tZN&)7&Ys`S{<)p~D?4ZqcU>s=jAWX&bebilERZbIvdgTIv)fpm5n>prEm+e+ z^t=x9b+5{WzjkEV$sK2Bs7Lqj^SIB4V2e~eIfFBX1DTxxU<2idJG74Jr2)_x!!UZ!R*VY6fdJ}WjyPkjY5@o? zOwA7==kr=@5a$KLNi0de*-oq!=`Fj=`4pdS7R#w2|7_$3?WovZF2-pttlbPu3Vr=N&?Qh zyTJy$!G=l1a&UB_7EA1u!AuywJ)uKldJ?@0vu+)@brbER_jE1caM&<|TD3U@*XJUJe(QUGmYeI=_3`M$;}M2YWSDW&-n-FHFY{D!ezP%I8$An_3MXLp0RsEZ(Ru^u(&nHjbgKe zUO_Dmp|_xLk(!Y1&kTY8Y#uEFFdDr^r)@@_rdIx*FFT z8TOfOriOz1C`7GS#Np~RkU_7%W(!M@X5{^fL1yzv#X7oDofXb>Nk=CQ9~ zj#<~h*pc(>k4zqOAu=(!8* zyBCElu}nvBHom1GHv9sdTx|tMO^wyVF{HexA0x&;m*HCMu5Q!|Y@DI=DYl^?S@N1! zT1uj=_GMPuQ+r;PDLs%*rzaJ0jMQ?qrr-_PI3R7ns*@o&LIAz zJns;NLMvEOdM}o=9&jJ4J)Pu*lF9}DE|`$(E}7GMUg&ryz@sqe6Yx?E;yIq1nfIFxtsb&U?jWRNHVe(FDGI_$M)Ac_!;uqG((E^$dka5W zh%<>}+Ps}Us{n}{j;iKV_>qs~nev0$IjIo^F#Yk9lis1z!Co{ewINzfZfQ9F-QIoz zn^|Dz3yHZOC010Ez@NW?KaBRt`$wxWEVNkE8j{rKf+=Sy3nqY7)u5r?vt8|e<+>!E zj@F3iOotTCAClS?>44vqlM6*XA^Q$j>c4W$JKHQxDRhC-sj??3EodW2zFPNdwAWYv z2?LcB;x_sD;L17|d1@I53HRZDSQ`DGc<>WE`>!=oTYX2<^f+CMHfHRO46bPx8aEqg zJxlO(7#J;nKu`<8BW`Z(>$ZXBiP*0>rcbQ+sp!q?8+Y~xJQD7=1Ck;Z?5do+lt@jK zugn(_3t!VFCo&xawgncn&ud>;XxaA3Yu_ptq|b=zDu&0?XvCV!v*TXX(!3+1FC@(ZHHQsVE6|!Isyk#09^oqCX_a|3_R*73IZ&h}m%h`b~M_$Bo&29tb`J+cT#a@mvo`><^pDE9>wif3wwLFDXc1VTavb1<+|mVTUJah3ix)DjINQLJIm z?<$7WzwhgKx__-O4#88Jx94(`l0-)Z!(hKr0^)AAU+!%jIl9IY?J4E1qxd%o!KBdd zs)7zla2UFbK6QrZ((z{~U}}4#8GX(!N1`l>J)aDdW)|;rr*ln|#qqB(ci0n377xfz z1iP~cb=R_TyG!gN<~YNsLNR==uv$f!n`j!V3#~?-<)MX&9;$e z+v;OVV|`7uA9lTmisBNeN;FkyWQ@E^6DmTzE@kG)r0}Fyqw>4-N)nKbi?h%w--{TB zkxZ#j$+Sq8Z56V$7@2NSaWcjXucKqX&#>>osjy75b9rMjh?;tluvQDEsCx^Lf;&Jx zjnkkIWwqa2kq~dx(NA9$D?bxS4gH88UahsFRvW8uZNNE5f*(*HoST+dE<9ZF;$h29 zig--qcuSkZVQO5P-uwQSVT-jjH1eQ2kDgKST4GF4Yvc{2M*OTZ<42Pbm{{jq2=x+p zp1EAHMa*D-bn7Kw6>v};?QSLtc0PB6P@Toq7=>@`*cC+4+*%^KUv0UNTur$6pG2Z5 z|7y72hx{|4Jm&xT3+!kAG~9UFDdVx>#-H(jwcmKE^5|%I+CActZ1hj)KYacFdu%+_ z(tOZ*+5_OR-^4!wewf2ktw$R0e?1fa)_96#f9w|UPvAdH@u|jBqT-)O_P;fs;DiYKIKt9 zLQ?+;WsE=(^CqSNh-ido1Eli_c>b|0iDRJuT@^|NpTx lJ$-0BmZpEg=HZ$0--SwE3hv?Nd-m+r!)NI6);4@R`VSpr2KE2| From 68547d7f5777e946e6072cee513b7148f8268c03 Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Mon, 18 Jun 2012 10:57:28 +0800 Subject: [PATCH 15/23] correct makecert command line, wrong begin/end date --- tools/createcert.cmd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 + From 6048a6bf37677ca39d9d9e39783fd4bed761b609 Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Tue, 17 Jul 2012 13:51:42 +0800 Subject: [PATCH 16/23] Update to enable tracing Update client library so that Java requests carries message id end to end. --- sample/CcpEchoSvc/JavaEchoSvc.config | 361 +-- .../hpc/scheduler/session/BrokerClient.java | 1769 +++++++-------- .../scheduler/session/CxfBrokerClient.java | 723 +++--- .../session/CxfBrokerControllerClient.java | 376 ++-- .../hpc/scheduler/session/DurableSession.java | 376 ++-- .../hpc/scheduler/session/SessionBase.java | 1129 +++++----- .../scheduler/session/SessionStartInfo.java | 1957 +++++++++-------- .../servicecontext/ServiceContext.java | 402 ++-- .../servicecontext/ServiceRegistration.java | 532 ++--- .../hpc/servicehost/HpcControllerSvc.java | 383 ++-- .../servicehost/HpcServiceHostWrapper.java | 1617 +++++++------- .../hpc/servicehost/ServiceRegistration.java | 500 ++--- .../microsoft/hpc/servicehost/Utility.java | 320 +-- 13 files changed, 5262 insertions(+), 5183 deletions(-) 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/src/com/microsoft/hpc/scheduler/session/BrokerClient.java b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java index 9808871..d6172fb 100644 --- a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java @@ -1,879 +1,890 @@ -//------------------------------------------------------------------------------ -// -/* -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.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; + + + // 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, ""); + } + + /** + * 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); + } +} diff --git a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java index 5931d1f..c5ce9cb 100644 --- a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java @@ -1,362 +1,361 @@ -//------------------------------------------------------------------------------ -// -// 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 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(true)); + 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; + } +} 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 80bf5a9..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(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; - - 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 413bf2f..b3bed17 100644 --- a/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java +++ b/src/com/microsoft/hpc/scheduler/session/SessionStartInfo.java @@ -1,976 +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 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(); - } - - /** - * 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); - } -} +//------------------------------------------------------------------------------ +// +// 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/ServiceContext.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java index bfce949..b7511f8 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java @@ -1,201 +1,201 @@ -// ------------------------------------------------------------------------------ -// -// 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); + } + } + + /** + * @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..4ada808 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java @@ -1,247 +1,285 @@ -// ------------------------------------------------------------------------------ -// -// 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']"; + public Node serviceConfigNode = null; + public String serviceAssemblyFullPath = null; + public String traceLevel = "OFF"; + private boolean includeFaultedException; + private boolean enableWSAddressing = false; + + + 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()); + } + } + } + } + } + + /** + * @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/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..435aac5 100644 --- a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java +++ b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java @@ -1,803 +1,814 @@ -// ------------------------------------------------------------------------------ -// -// 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.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()); + + // 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); + + 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/ServiceRegistration.java b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java index 014d0cb..9809068 100644 --- a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java +++ b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java @@ -1,249 +1,251 @@ -// ------------------------------------------------------------------------------ -// -// 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"; + 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; + } + +} diff --git a/src/com/microsoft/hpc/servicehost/Utility.java b/src/com/microsoft/hpc/servicehost/Utility.java index 3319668..18d7c0c 100644 --- a/src/com/microsoft/hpc/servicehost/Utility.java +++ b/src/com/microsoft/hpc/servicehost/Utility.java @@ -1,160 +1,160 @@ -// ------------------------------------------------------------------------------ -// -// 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); + + } 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; + } + +} From 0235c2e75683b6407e759214560ff7f731ab529f Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Mon, 23 Jul 2012 10:04:17 -0700 Subject: [PATCH 17/23] fix the endorsed dir setting parameter after enabling wsaddressing fix the endorsed dir setting parameter after enabling wsaddressing. --- sample/helloworld/RunTest.cmd | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) 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 +) + + From 371196b7f516dd28be202497085abab77165c6ca Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Wed, 5 Sep 2012 15:58:02 +0800 Subject: [PATCH 18/23] Add setResponseHandler validation logic to prevent multiple setting. Overload setRequest method to support message id. Overload setReqe id Add setResponseHandler validation logic to prevent multiple setting Overload setRequest method to support message id --- .../hpc/scheduler/session/BrokerClient.java | 211 +++++++++++++----- .../scheduler/session/CxfBrokerClient.java | 52 ++++- 2 files changed, 194 insertions(+), 69 deletions(-) diff --git a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java index d6172fb..b6e8cad 100644 --- a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java @@ -61,6 +61,7 @@ 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; @@ -142,6 +143,13 @@ public class BrokerClient * 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 @@ -308,9 +316,28 @@ private CxfBrokerControllerClient CreateControllerClient(SessionBase session) { */ public void sendRequest(TMessage request) throws SessionException, SocketTimeoutException { - sendRequest(request, ""); + 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 * @@ -327,7 +354,28 @@ public void sendRequest(TMessage request) */ public void sendRequest(Object request, Object userData) throws SessionException, SocketTimeoutException { - sendRequest(request, userData, defaultSendTimeout); + 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); } /** @@ -348,8 +396,32 @@ public void sendRequest(Object request, Object userData) */ 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")); } @@ -361,7 +433,7 @@ public void sendRequest(Object request, Object userData, int timeout) } try { - client.SendMessage(request, this.clientId, userData, timeout); + client.SendMessage(request, this.clientId, userData, timeout, messageId); sendCount.incrementAndGet(); uncommitCount.incrementAndGet(); } catch (WebServiceException we) { @@ -391,9 +463,32 @@ public void sendRequest(Object request, Object userData, int timeout) */ public void sendRequest(Object request, Object userData, String action) throws SessionException, SocketTimeoutException { - sendRequest(request, userData, action, defaultSendTimeout); + 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 * @@ -414,9 +509,35 @@ public void sendRequest(Object request, Object userData, String action) */ 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")); } @@ -429,7 +550,7 @@ public void sendRequest(Object request, Object userData, String action, try { client.SendMessage(request, this.clientId, userData, action, - timeout); + timeout, messageId); sendCount.incrementAndGet(); uncommitCount.incrementAndGet(); } catch (WebServiceException we) { @@ -533,32 +654,7 @@ public Iterable> getResponses(int timeoutMilliseconds) */ 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(); + setResponseHandler(message, responselistener, 0); } /** @@ -599,8 +695,16 @@ public void run() { } } }; - Thread thread = new Thread(runnable); - thread.start(); + synchronized (this.isHandlerSet) { + if (this.isHandlerSet == true) { + throw new UnsupportedOperationException( + SR.v("OneResponseEnumerationPerBrokerClient")); + } + + Thread thread = new Thread(runnable); + thread.start(); + this.isHandlerSet = true; + } } /** @@ -612,32 +716,7 @@ public void run() { */ 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(); + setResponseHandler(responselistener, 0); } /** @@ -678,8 +757,16 @@ public void run() { } } }; - Thread thread = new Thread(runnable); - thread.start(); + synchronized (this.isHandlerSet) { + if (this.isHandlerSet == true) { + throw new UnsupportedOperationException( + SR.v("OneResponseEnumerationPerBrokerClient")); + } + + Thread thread = new Thread(runnable); + thread.start(); + this.isHandlerSet = true; + } } /** diff --git a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java index c5ce9cb..09193a6 100644 --- a/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java +++ b/src/com/microsoft/hpc/scheduler/session/CxfBrokerClient.java @@ -69,6 +69,8 @@ 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; @@ -90,6 +92,11 @@ 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; /** @@ -108,6 +115,7 @@ class CxfBrokerClient extends CxfClientBase javax.xml.ws.Service soaService; String EPR; Client client; + ObjectFactory wsaObjectFactory; public CxfBrokerClient(String username, String password, String epr, Class service) { @@ -126,6 +134,7 @@ public CxfBrokerClient(String username, String password, String epr, client = ClientProxy.getClient(serviceObj); this.dispatchMap = new HashMap>(); + wsaObjectFactory = new ObjectFactory(); } private QName GetServiceName(Class service) { @@ -215,15 +224,24 @@ private Dispatch getSOAPDispatch(String action) { 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; } } @@ -244,13 +262,15 @@ private Dispatch getSOAPDispatch(String action) { * @return */ private SOAPMessage createSOAPMessage(Dispatch dispatch, - Object payload, String clientid, Object userData) + 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); @@ -270,6 +290,22 @@ private SOAPMessage createSOAPMessage(Dispatch dispatch, 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 @@ -313,10 +349,11 @@ private static void generateUserDataHeader(Object userData, SOAPMessage msg) * * @param payload * @param userData + * @param messageId * @throws SessionException */ public void SendMessage(Object payload, String clientId, Object userData, - int timeout) throws SessionException { + int timeout, UUID messageId) throws SessionException { // find out the action name String className = payload.getClass().getName(); if (!actionMap.containsKey(className) @@ -326,17 +363,18 @@ public void SendMessage(Object payload, String clientId, Object userData, } String Action = actionMap.get(className); - SendMessage(payload, clientId, userData, Action, timeout); + SendMessage(payload, clientId, userData, Action, timeout, messageId); } public void SendMessage(Object payload, String clientId, Object userData, - String action, int timeout) throws SessionException { + 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); + msg = createSOAPMessage(dispatch, payload, clientId, userData, messageId); setClientTimeout(((DispatchImpl) dispatch).getClient(), timeout); From c75b09f13095ff00eb39c9e5971224a57a4356e0 Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Tue, 11 Sep 2012 15:47:04 +0800 Subject: [PATCH 19/23] Add SOA tracing sample code and Java ETW trace helper library Add SOA tracing sample code Add Java ETW trace helper library --- .../src/org/tempuri/IEchoSvcImpl.java | 343 +-- sample/helloworld/HelloWorld.java | 115 +- .../microsoft/hpc/properties/ErrorCode.java | 1978 +++++++++-------- .../hpc/scheduler/session/Constant.java | 664 +++--- .../servicecontext/etw/ETWTraceEvent.java | 170 ++ .../session/servicecontext/etw/UserEvent.java | 137 ++ src/tracehelper/RuntimeEvents.h | 239 ++ src/tracehelper/RuntimeEvents.man | Bin 0 -> 76938 bytes src/tracehelper/TraceHelper.suo | Bin 0 -> 13824 bytes ...r_session_servicecontext_etw_UserEvent.cpp | 31 + ...ler_session_servicecontext_etw_UserEvent.h | 21 + src/tracehelper/eventwriter.cpp | 74 + src/tracehelper/eventwriter.h | 35 + src/tracehelper/tracehelper.vcxproj | 169 ++ 14 files changed, 2469 insertions(+), 1507 deletions(-) create mode 100644 src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java create mode 100644 src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java create mode 100644 src/tracehelper/RuntimeEvents.h create mode 100644 src/tracehelper/RuntimeEvents.man create mode 100644 src/tracehelper/TraceHelper.suo create mode 100644 src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.cpp create mode 100644 src/tracehelper/com_microsoft_hpc_scheduler_session_servicecontext_etw_UserEvent.h create mode 100644 src/tracehelper/eventwriter.cpp create mode 100644 src/tracehelper/eventwriter.h create mode 100644 src/tracehelper/tracehelper.vcxproj diff --git a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java index 8371494..4811f6a 100644 --- a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java +++ b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java @@ -1,170 +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.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 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); - - 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; - } - -} +/** + * 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.TraceInfo(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/HelloWorld.java b/sample/helloworld/HelloWorld.java index 6088c26..ad98335 100644 --- a/sample/helloworld/HelloWorld.java +++ b/sample/helloworld/HelloWorld.java @@ -8,11 +8,11 @@ //------------------------------------------------------------------------------ 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 @@ -32,6 +32,7 @@ public static void main(String[] args) nerrs += RunBasicTest(); nerrs += RunCommonDataTest(); nerrs += RunResponseHandlerTest(); + nerrs += RunSoaTracingTest(); } catch(Exception e) { nerrs++; @@ -46,7 +47,6 @@ 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; @@ -76,11 +76,10 @@ else if (arg.equals("/nrequests")) { return nerrs; } - private static int RunBasicTest() { int nerrs = 0; - SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); + SessionStartInfo info = new SessionStartInfo(headnode, serviceName, username, password); System.out.printf("Creating a session for %s...\n", serviceName); try @@ -190,6 +189,7 @@ private static int RunCommonDataTest() } + private static int RunResponseHandlerTest() { int nerrs = 0; @@ -203,36 +203,36 @@ private static int RunResponseHandlerTest() BrokerClient client = new BrokerClient(session, CcpEchoSvc.class); - client.setResponseHandler(EchoResponse.class, - new ResponseListener() { - int fetchedCount = 0; + client.setResponseHandler(EchoResponse.class, + new ResponseListener() { + int fetchedCount = 0; - @Override - public void endOfMessage() { - synchronized(session) { - session.notify(); - } - } + @Override + public void endOfMessage() { + synchronized(session) { + session.notify(); + } + } - @Override - public void raiseError(Exception e) { - e.printStackTrace(); - } + @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(); - } + @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++) @@ -241,6 +241,8 @@ public void responseReturned(BrokerResponse response) { Echo request = of.createEcho(); request.setInput(of.createEchoInput("hello world!")); client.sendRequest(request, i); + + } System.out.println("call endRequests() ..."); client.endRequests(); @@ -261,5 +263,58 @@ public void responseReturned(BrokerResponse response) { 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/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/Constant.java b/src/com/microsoft/hpc/scheduler/session/Constant.java index cfc0602..429baa1 100644 --- a/src/com/microsoft/hpc/scheduler/session/Constant.java +++ b/src/com/microsoft/hpc/scheduler/session/Constant.java @@ -1,323 +1,341 @@ -//------------------------------------------------------------------------------ -// -// 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 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/servicecontext/etw/ETWTraceEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java new file mode 100644 index 0000000..a06ac82 --- /dev/null +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java @@ -0,0 +1,170 @@ +/* +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; + +/** + * @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; + + /** + * @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) && + name.getNamespaceURI().equals(Constant.HpcActionHeaderNS)) + { + 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)); + } + + /** + * @param message + */ + public int TraceCritical(String msg) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Critical, sessionid, messageid, dispatchid, msg); + } + + /** + * @param message + */ + public int TraceError(String msg) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Error, sessionid, messageid, dispatchid, msg); + } + + /** + * @param message + */ + public int TraceWarning(String msg) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Warning, sessionid, messageid, dispatchid, msg); + } + + /** + * @param message + */ + public int TraceInfo(String msg) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, msg); + } + + /** + * @param message + */ + public int TraceVerbose(String msg) + { + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Verbose, sessionid, messageid, dispatchid, msg); + } +} 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..0572628 --- /dev/null +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java @@ -0,0 +1,137 @@ +/* +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; + +/** + * @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; + + //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/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 0000000000000000000000000000000000000000..938440227b3f6a3bd76ee5436a6883224fb41fa9 GIT binary patch literal 76938 zcmeHQ`)?dKlJ1`mxc^};*kJd7^Fw}Y5<|BOS+Qd;;@Gg2^8t%PU}268mfg#U}O&06TVzKzoe{5ENu0B=A)loI6ey#SaS#?$&R;SfT z^`F%j)kbx*x{cQfemSZ3@ck6Oo>T|!*ALZs^|rc!R)0jBKUaUM{V0@1G0RQh*@9^z0T6~YO_JXGf%{#O{uim5OE&K~x zp8?Ke^s$FAPw~qsdOyc^g!mY3KjOC&yxzfVZddp4?soMx{@-_VCVXdZj>G^z5rPvu zPspZj{(_?ue10(RErv**@-yoSl|VZM>>n|ng_5)gVG-QLuzbX`A2EZE)m{953cMU# z%zp##{=0ex9KQ-Me#7C26ye#3twT<=zsc|K9q0cF8cspE8J;=;PAPqy*Rx1AZd6aI7u7bT_a&s1Jb&m~ z6DJ4whW+r#zd=sEslLMBqv~<>5OQ5NBCbf$pO9#`DcRf-#LzWhhGkXoe5^O?=&)BMf#`s zb{Eu|IGhrPqQAGmH&5~HJBODkV4zjl#~U_G$TG2R(ek4E_tRGshpKB)Rcd zjB^AY5Ki6z2gr!bLI<$Ll6wYYGX%>O~6S6Uik?&PBF7T$BD-v9+I$+l_1F{v5P zs$U%6ev9XJ0o6fed6pb<3>$TXwtP>>Ug6ygeUeV>hur!bXh5wzMUQNw^Vi;dYsE8r3 z)ho$M&1>Lr1`2tusY}hB4m65;UDKr?y5Ku)kvt?^xgA;eZghGATfYbUD>hd=B(>q)UsY$no>h}f6rl! zR$T+;eGH9|=L$kh*sqkUifl!&^e{SVdE z>2-2w+q{G>_CHo3BEdPFg5OhCjQbI({S5IxV!v=rr31u>hlm@!f~R{1Dlw`kJ1KQ- z_|=+LF1GArc9#|7d+9hp_Uuwp_4S%kgHy`K(DPPI?HnWIGpwB%t!CW+9rPjN!u4ps z?^B~C;cGd<_+;KEdESEmsAO~yg-L_5f71tc)m0_&0+ePcS zKKGc?IT4oB>fCBVwo2RPc-7k^RXj|H@v{#K5bv#-8FZSVgfoJL^Ss%Cc++`(D z_TayT2BZhbEDKr{%Jvp0I=!H4$%1+RBh+fCK4WQ>Y|9}$`#8s@sn6brU%@;xPc!Ss zQyep`jL@nV!K2)^*p*#Z3qwlI#JE9nHS6O4D|48;|XMqIUigf zi>J%HueOq1ic~*#{gcZcf!C&PHSWhJm-MwZzw1`!LrAdCq_gt#B7r;ddTO2S@gUmM z_S94(bX&#yv769fS#6LStC3LiV}x?NobC>7z14*|t(v0x5OIkn zR1fiB=}wLwn$qFubt;S@*^F1p>4tJNUHDMi^h59Vk&nf(+(q=Z^!0N6$$2jCVeKW8 zE>HQcF^*XNyyv7c9@3(J+Lt&j9J!?HEr<4}@rQ`4EaC;uCB#Wn-e4p_d|#e~_zf{W zo)pr(jkLb#k847REj6ZY??GjGS^jD2eKh5q{`JQY5uli7JRTPN`rm=0c&>-1wvMny z3Ul!LAmF@#1*jp=n5dGTlb?YR}x6jE^nT}pf~?{kX$qf@+lb`cG_3@y_( zuK8xZ z+eb?fpA_x3!@4?pCP%4dc_;R;LyK7VmH1iwx95nPip^H<-&*cmwA=PbKI>y$wCJo# zU))p1mi2`_uKKrEWjHL3L$A9;waen9@8R+Alo#XUvZB--%&~cBh=^*efy%VI`aG1T zSO47OJszHlJ9qUWG$$m-8GWypHU`PYYQhtK_Ld{^x@3qrs>OW2G!EB&^gv`KE?I!o zU_PfYM{TR;`m-gM5mRlBjr5whAL=)QVp%?Dx7ylr($7o?u8NsG?JH1RuFo+}EY@R- z7^v?bTkX&sS7|Ql8gcV5`pAmcV3gA^%FztUak(ty{CX5>Z2dD%T-VcVF<+IibD5l! zgKJsdu|C=pXdFr&XG&fUS4d4GxkK5iapJiaA6Dmd*$=XMyUTuWQ<@CN38LwER^!lF zCW+NPp6_c+FIF>tf9$e(Wt>Rv)#jDus5T@w)pt`bn_I?-;$C%bDN&_gZfMV$&*2O2 z!8@M8CS69Pe*-lnx$62A;}03L?VCrsdbt*kW$9(PC!e=k$}P1JrSiPFqsVini#Vk3 z$O*H_$L9@tS$^GN{giywh(otQC>=iqzSRMEJZ@Eeh0kcxlK;{dzs=KQ}h`k z&-;4Or#TLnrIzJZRy1eT-ZOVDPdx4vg@)KaxLy=0<84@~Jajsr{>~ZRJ%@(=3*>AU zlEx?=&stHN=czYDRDYGI*A%~FQ+WrHc?`-julRhv_6Sd-iw819Z2dY@*J6zpsjlVv zrK7DdR+7UZBHP!QQZeR+rc6^w&v`0C#G6-(f=w|zKBcW*$WeHR81Z$cu*Dj+>CjU9 z5?&2GQfks4ku#H{)DV%{zA5F`LiDrc_LZ?#-gP|oD{=MSbp<2UA!Zq>4U^T{H`T~- zmqn#I9xc@vC0iUR+eQ55)YWw1JzR3nkK9nTT!bvV>*_T|n9axd5xmXYlbAoP=YCkd zkJ+!xf{i8key7;kbBwT!l`2;~a&HoQ4zsOu5K6mLgw5mRf1!!f94PuDXZ&kAO#>X|~nw(+*{ z=*OGgzIFOyIQ^TWo5iBH+_ujYm6$e(}E3kkV(Vs4$I3L$%)= zk=`=r>Ti5Hto{$unX`v&<8s&f15a^BI8 zZp|_a?qiHI*sV4Frhylf)`M}+-Oht~&pC!Z=QD*CO?REG-@tR;e7gU8CSxe=$d(I2 ze@Ne#{i3*k)m5>~3iZmqP?~z$XL^@)P00i3$o?rA>!_48mVKi%J>#C&G#rM8cDjSZpY`-@u#x~&kTf&q-v{~JPo@J&hPobS_ zL??{6aJeUG;&K6b zp9ZsZzrZ|7w|-mryWUHG3;XW%`T*REC2w#9omtu^uirM_?7pX;Fy;$4!Z}v+9Gy7H z!$C^EadphO`e56)_sy&Cu_T%8y-y2rPrT=By@F3gO zFXz~`u$sGBIud~#ad#QV5s{C@(;@fcQFfD$^+&BO@Vgqysd>*?`kp#(k(xa8%Wbb3?_-}kfv5TrP@Gf`TnzlY zx;w8tBYHY)_X!r@fom&!#W~!09HyaC{`mnga|J~OJbhk*D&&sU@e1s$R*AFi%wnEa&+>YCajZSa zNQ9kTSGrkGbT$0ky7rLxepd{I=ecuwNIB^#tn3(TlpS~;XUL2g6P`X-B0kC^F*_UA zuoh{x)+u3(ZxQu|*Gna9XQ_~bwST|hviPi7^~E(e4j1dViriR&X>}t-ZS?bZ@I|<{ z!u&^DA#{~2?pkjzid2>)g&EYWFyL!GuFm=?u0Q4Xb*v3tE!%M!K4^)@EUvGoztWtS zG&-fXh^~^ZU2_)sT>fn$qk)-L^}VzD8h1Q?FUcS&H=Ac}@OC!IX`^>=x%$2Yv*aT9 zdd18toVo}LYffD*+nWTnjVyU75KU-X6u>wGVS{Sj)@jB`@S5#?b3G_vYkftO#+;wX15$%2K>ubLI1p zR^5V?IQ}~1aCEU&-hR_6O`Yexwn?9tO-k{=s_cHZkqK{`*H++jvjU#>p?98_f$zw0ZR+gf1UoVLw#V3OVm>4*5!^<9x94{&9lHqc8GhwyV*dKO>JMn?vtDmz zdM#HDBChInsbUPU)qBJSS zq1NG{n<3*J2Z%&-EY9_Bs9DdO+HY51;op5|mm6sN5Z~OxyL+&CD_rGg0j~)bC{UHViJ$hwc5_{q<*UVM%56`YFh9jn{?4QI{Px9wT^~5`CkepP%2P{(WgXf3HnLKOB zv+xtpmnVyOH=Wqr1AG^bBxl>n5%2H|YjI34t9?Aj*)bD~c{WpgyNj5#oQn5%=WL-8 z$WwgFS}ZfP+QT@E5lun+8wuXzOzX3a`9S3|t|ym1)hZQN&Hz2JK?=y7crsWenYxiw{^+DQGxzEb89^dv1fD@4VzGen)ZbnPc*0I7%L zY4&+(u|>7tHsH+&m1qlN`x4uYQU$TJHS#b>?HP`@I<#5r!92RC_16F0nZ9pEZ|TPz zy3ta1lCeSt|FxsHmz>xRrRg1eA1PnKL#`1N>$_6d$14y2RDHh7+I`>iLwMkCFTBG% zCd*zxEIH#~@&)YV2S{=_3sSrtcEhLX>n@Aku)o*PG>mhQE2I`c-Exyl%hr25?1qpx z#bfx4oo%0Zlzdj|RIW=%C6R2NDfxiUlpvA$vdxWgnYO2CX^;J|l(dH!Q4USV-<$Ah z*jtPRi{r)mc?ats`YYr}R%7J)a=D7+T=|eHjM0RBrz+4h*3e!nx1o@(WYSfyQ`Aa9 z-Gnard0U$38aaF|*9T|Mr&w*KAhX&-@Yz;3UtN5rW?jZ6V`%#qK1V(tY2`lGPFBpT zRA1IcDc1F6Ln&lcGs_oUBdfQ92ovoRd(|jw$rGxtDobs{+Ni!AN26ykMnzuAn#EU6 zj(nxbTnmvjT^U)t``Ov`YaUy+oz;=utD<@@xmiWjMeQwIwi>GCOZnunXz^q1LT*Qd z(WB5F`*s$N%GFWWP%)jj&n+eWm7;Xs8eSzYGv#UIJokDQS+1R6%I0R(S682N z#u;(GpN*$&R+6d2xCwK&=yS_n>I7MJ$A~DOU^nIgq7l3$;}khV{Ji0!^Y8G@Iii{m zFv2Z-%SZx!Z0=j%#A`i^?WP;!7;VLiz2!31n2~l1G32lDe+VaStcQTR0ey{kA0shK zjFyHm3*I@!22nB zsrh`FB}bDml51JtMd*GLoYbC*Y0G6tXRU<^c$YO~K0&)MFMv9UFz_2&Rg9M$E-EQnqq|J8jRf9K>2U~dm+2PV$jq2Iy#%Cq+QI1Gol5gOnEOSET+B z-}&=!ler(j+^lZ8MdvA2yv}XZZ>+gXezTI!Ow{${>bmaH@0;nJIyO@) zvSlgRtXAXl)~4Aw-ZbNKT!X)PAvoFlpl<3nhvXjZnVmgLsUIUvE*{_<}5uAA7OojPr377L&%_qg|VzUG+Z|;JR*gmmS`e{q_ZD` z>t%`Zdx`f_sxe-DZN6p+>B`YUDE;WnDC54sIsA9AqvLsc9tt_fByjjxA0Z*GJd7y} zHPd5ys<^8jQ|$QL6Y>>khnE)WvvK{pa76XaW`?V}TBJp?Kn{qpFCGT(A@55UTHUAi zD;{}y>OKMW7};X%jxrERYKZ4?Y*jd-QkJy|6vCLUvf9sk-AWPFS^C;ccZJw_0% z;eUXxJV*TqjSa@s31@Rv@YjA8V`8{Y$E%3J{b-kISPZqN*mKxd+4CCDezu1)+?$iA z$w#-tMomQ7r?01xT3MM(?Hu|J^jSq0_{ghY=c&xMx5jPmx$2^OegA?lYFs}9ehNLK zHaeqzAC-D1cbwN^?MWQl^>FPwEtm2oX<oXF4 z%UeWb=lim;6T({OMTuo|FNmj=$ObUVMl5tz zu`0W9)Es_R)HU4krygO9k8xyXvy6*v**hk8Umct?dx;vCd@0d0%6VJfCU*IpdXJ2u z%1Pro-;>)7%Zzo#A!UTWBkd@#wl-^p)T3OzW$Byo6bbc@I+K#?*-%gOx5h za@P!xlC}(crELf!;`G{BOK}gY5o%)ka_!^KwpV{XK&)ge3%0$@Mq-wPx3098^c`gd zB{d#HEyH{w_MgXeIxoRO;2}=0C~a$nH)Z2KIEzmVzlCqiEGI_v_nh~j^XLX~C_Ovi zmk?$PUySeYS>^8#rg*1>Ihozyw6L&>=?VVMTvkiU|F-QFx8mh8n=5>J2#6knxBN=x zIq3EmV0RbzU6l9N2J+O3DeqOD0j4nD?Pmv(?rag-FuSl1tn2{O#~4+zfyrOXQI30Q z>`!!?WEe}Fle;$kQ}vZwiE{sl`m~J{3#Xk$&-a1V7^-2oEr$O3@mq|mSdWz?uEcRM ze)^#9OUNO)hurofR(Va~jqL_^V6`V^|G$UL7|Pbwp;p@)D>%*fyft$1MAX(B?dc-cZWR2SAOBD%vbkd{>Ad^G2b5}bLBmk9cU;-n= ziKcSeDKFtj#BGR6-96FQ91r0wNI~bAPw6?$BacvfkU~8MkwkvF_tFqYU ze{|MQ>%j_UB)&_lMJ=nR(wINq9y7AP7s67;3~A7X>%tKvE1s*Yd~MdSeI7fKYaRAP zsTd0nso0cqkVIz}X*$wSy&KY2&N|Z@kduBpSk=?Nk?O0d3aP#=^>El)d?w<<)`F_b z6?brG5p?xSuSvXPS~l51@$*paqOUnEL%34aIb%7{mgB?EGxKMFQz@_mtn(b?e&YN+ owXZ!1@6WHZAMOZ}55>MR5+x^crPboo`P`SLm8NYXO!D0S15r3wGXMYp literal 0 HcmV?d00001 diff --git a/src/tracehelper/TraceHelper.suo b/src/tracehelper/TraceHelper.suo new file mode 100644 index 0000000000000000000000000000000000000000..299e7350d178e0d9064b6a220de0da02a09e1397 GIT binary patch literal 13824 zcmeHOTWlOx89vUf&8-&_LK1S>Hc1l_@3Qv#l1trWFV5Ae9oumNEH$&cV|(KD&N4IW zi;_q{A9w%?ytIM}B+?)xs2ci$kSdVK6Fi_GcqobxY7i9ZAmy2bt@+Ra7lb#S_5i)$f zb^G>ht567JKc7SkTB%zeEMTF5=JbKll};@Tw*3Q6c`%@K^#FB%Q$`t`JoSL11IUYdfMdwMQwMPWvo80)^PLvtsT(!| zTpODJPWu*MD-Z&n0y=?hz;=M&eFo`HU>EQiyX<+S&33-mP8~k2c#Z*WKs(R@q=3D^ zK43qX0{VdgU=%nF z3;}$97O4t+-hNIa{UY!JFbsSNkbn%31#*B4i~#)p7*Yi|2aE%GU;-!rd|yQRWjoJx z%CftqnfFh<{;NIb55Jr^Z-mDWT|qN_L0t!mX=(5REkNDn9LlGOG+n|tfuPfh!Gi5^pcbxFiJT^jhG^g%GzvZP*wA1 zltNCO(jzI!kOq~a9_dpG1u2u4&4=!3LoVn_M#(G2Or(#J>L|&|dwR@_tnqsThN{Wz z=gP7_#l8n1c7p3Gg;k!$D%7x&(pa$)G>0U@rd~Bn?V>`@giSq{K`jZGK~3tIj3{C4 zj+(X3;EjPc#_+^7=+8aRR>)$^IIl9stWmPJ!klIr zDVx)f$3v6Hd#~3k#BQjwCF1R-)cz>`&c{3BvG&&F-f%S0+8%D}h_{9liC8?`8S6+! zV{M%+sd(bz1(?aKJSOLhwe`;o)?@~|hF(W)qW+^krQhgR|IklyTCC)M5;HmhuCz{P zuxksLV^vIHhgPR%@F!n~s@IxZN_{#?H z?Tuxh3#P^@YdR+~lCjneXe-(x)|_h*_Xp7bbH`sr`z4II)v~*%ec;KMq@E>=+T%}~ z;mus|5bSDm%qFJw6oMCP9Lpt9zm~1QA(TWys5^W zG0CDP+H;ni7X$c$jDdbK{E27lU4#$bN=KaILyvm0dm zb`m|!oBgDb>wQqauNPJ92HX&2i+z zC`q7B9Jx-U9jF;a+J>hV%zGSfFNz5E_mpX+%Y1uH@5{}V(Pnkotlh!7kHQxdVm@U% zU`C7c*Idh!XLrhB?fV$!%}bU8 z^D4`L*uL_k_?~b5=IEQ(e|l}rkIy{bBOd$R#{7rNxAlJK_SZkScJ(qta>OnFSi9qo zSGH|C@{4zGT-=$NXk#f?#om#%S8rY2(sTI-xi?O4!Y)bcvYGC}{Ee94mrFOIAcSmm4+byOBWVB{Q zx0r?%zwLkRCp%VNI{emtJ-_(K=ASw3RHoJHaT*E6^Yf{xyJ~3aN||_;@wW!{|8{75 zp1_a81EU2T$80c$jpDBbx|pB!=C>NMT9l?-TbAOHO~hJ*cbM z&G(|ejQ<(w5Th>5mqLkC&#rz)Lj7kd9{b~t3RMciC_8HVpOvf6uikZ<-4tN_Blz+z zy8-8(#kqeOfd4}qz%xjWjF$#P|L=PKKMUSY{51p)gW$+0fYI(W#-EyZ5@YXm_Qo#I z|E729%mK^1D2fX7*-7>0pEj}n?&qD!qNXR%4yV)a`lAQ;Dli{})A7mdbWu~!T}bUu z4`|u+acNQtA1fHLrWV6JN=B2knY4}gZ!xPS_`|wyXJFI8N7kx5V3%9pOZ*eP6h(yR9X>FVPVV z$6_7r`&wI*t?|~@iN^Au$7zdKL-J85ut~ak9?VL8@ekgALwWV3)z0>F)PUcuD71x^e@txr>V~DK-u~x?r@lE-_@$TriD4G% zQ4ss{92$JZZq$o^Ydz+8=kVWzyx&2OqwX>qZIBm#JIu5ySNSA=-f8o^*e`#cJv#c= zi$CwP>k;_R+8)3B&!E9YcK^Hn^)5{jzv`xXEa$v?r|DiT;4G~11n$WvOiS#(;~9pJ zP{c+YhV8a)Ds%7^c&ehAWxOZixg}3bS;uY9*{XGp%5&FY5yW`)mkNe5A)AIsUl1)H zL`t_M$`*@$?IqTQy)=Y!DCn(1K;yY^UcnNPdNBIt-b`Ncue+|3x9pl0!*IeqlK6y#84^3deKCgUBpWhUbv(haNL8a^nixPCApckI&{NT%+8Qf4@0zM ziCX@=bAFt63q3ypO|B!Zlit}Oo^V$uKfm$vI^V4o>QHksu=#6M%{d>O@4tOwANkvb zduN+!jjk0)I^I_GU*~zxT%-PPJ^ei<{`{vO?(P5I-#2e<{@(g;?0oSiN6M|YO*4hE z;6%em9J!m*qv?*ebibUJC0$Ot_newJM@g1FTPWr8j556`iu)G+C2=$D_cl7{sRe(l zRBJV;=I;PjoBwO!Ep@p@qw=4H$CStUw{;63;q*mDOzij9k5>H6-*fXG#P4e0nYL8! SLc=-tifp*C01Z6M{QnPu=0n;5 literal 0 HcmV?d00001 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 + + + + + + + + + + From 2592f2773b21f4094a7b7a5a21afe683c6a3d669 Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Tue, 11 Sep 2012 15:54:51 +0800 Subject: [PATCH 20/23] Add Java SoaDiagServiceClient library for testing purpose Add Java SoaDiagServiceClient library for testing purpose --- .../com/microsoft/hpc/ArrayOfRequestData.java | 69 +++++ .../hpc/ArrayOfRequestFootprint.java | 69 +++++ .../microsoft/hpc/ArrayOfTraceEventItem.java | 69 +++++ .../com/microsoft/hpc/CleanupTrace.java | 64 ++++ .../microsoft/hpc/CleanupTraceResponse.java | 34 +++ .../com/microsoft/hpc/ObjectFactory.java | 258 ++++++++++++++++ .../hpc/RequestContinuationToken.java | 90 ++++++ .../com/microsoft/hpc/RequestData.java | 205 +++++++++++++ .../com/microsoft/hpc/RequestFootprint.java | 288 ++++++++++++++++++ .../com/microsoft/hpc/RequestState.java | 78 +++++ .../com/microsoft/hpc/ResponseType.java | 75 +++++ .../com/microsoft/hpc/TraceEventItem.java | 206 +++++++++++++ .../com/microsoft/hpc/package-info.java | 2 + .../scheduler/session/CxfSoaDiagClient.java | 170 +++++++++++ .../microsoft/hpc/session/ObjectFactory.java | 74 +++++ .../microsoft/hpc/session/SessionFault.java | 121 ++++++++ .../microsoft/hpc/session/SoaDiagClient.java | 2 + .../microsoft/hpc/session/package-info.java | 2 + .../hpc/soadiagservice/CleanupTrace.java | 62 ++++ .../soadiagservice/CleanupTraceResponse.java | 34 +++ .../hpc/soadiagservice/DumpTrace.java | 62 ++++ .../hpc/soadiagservice/DumpTraceResponse.java | 62 ++++ .../hpc/soadiagservice/ISoaDiagService.java | 78 +++++ ...nupTraceSessionFaultFaultFaultMessage.java | 45 +++ ...umpTraceSessionFaultFaultFaultMessage.java | 45 +++ ...rRequestSessionFaultFaultFaultMessage.java | 45 +++ ...ionTraceSessionFaultFaultFaultMessage.java | 45 +++ ...yRequestSessionFaultFaultFaultMessage.java | 45 +++ .../hpc/soadiagservice/ObjectFactory.java | 157 ++++++++++ .../hpc/soadiagservice/QueryForRequest.java | 118 +++++++ .../QueryForRequestResponse.java | 94 ++++++ .../hpc/soadiagservice/QuerySessionTrace.java | 62 ++++ .../QuerySessionTraceResponse.java | 66 ++++ .../QueryUserTraceByRequest.java | 93 ++++++ .../QueryUserTraceByRequestResponse.java | 66 ++++ .../hpc/soadiagservice/SoaDiagService.java | 100 ++++++ .../hpc/soadiagservice/package-info.java | 2 + .../_10/serialization/ObjectFactory.java | 249 +++++++++++++++ .../serialization/arrays/ArrayOfanyType.java | 69 +++++ .../serialization/arrays/ArrayOfstring.java | 69 +++++ .../serialization/arrays/ObjectFactory.java | 71 +++++ .../serialization/arrays/package-info.java | 2 + .../hpc.microsoft.com.SoaDiagService.wsdl | 155 ++++++++++ .../hpc.microsoft.com.SoaDiagService.xsd | 77 +++++ .../hpc.microsoft.com.session.xsd | 12 + .../hpc.microsoft.com.wsdl | 42 +++ .../hpc.microsoft.com.xsd | 15 + .../hpc.microsoft.com1.xsd | 102 +++++++ ...osoft.com.2003.10.Serialization.Arrays.xsd | 15 + ...as.microsoft.com.2003.10.Serialization.xsd | 42 +++ .../schemas.microsoft.com.Message.xsd | 6 + ...temp_hpc.microsoft.com.SoaDiagService.wsdl | 155 ++++++++++ 52 files changed, 4238 insertions(+) create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestData.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTraceResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/ObjectFactory.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/RequestContinuationToken.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/RequestData.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/RequestFootprint.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/RequestState.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/ResponseType.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/TraceEventItem.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/session/SoaDiagClient.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/session/package-info.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTrace.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/CleanupTraceResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTrace.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/DumpTraceResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagService.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/ObjectFactory.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequest.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryForRequestResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTrace.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QuerySessionTraceResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequest.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/QueryUserTraceByRequestResponse.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/SoaDiagService.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/hpc/soadiagservice/package-info.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfanyType.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java create mode 100644 test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.xsd create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com.session.xsd create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com.wsdl create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com.xsd create mode 100644 test/SoaDiagServiceClient/hpc.microsoft.com1.xsd create mode 100644 test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd create mode 100644 test/SoaDiagServiceClient/schemas.microsoft.com.2003.10.Serialization.xsd create mode 100644 test/SoaDiagServiceClient/schemas.microsoft.com.Message.xsd create mode 100644 test/SoaDiagServiceClient/temp_hpc.microsoft.com.SoaDiagService.wsdl 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e889a46eb2a6bb0aafa6567c8da3b3f9321f21b9 Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Fri, 28 Sep 2012 17:23:11 +0800 Subject: [PATCH 21/23] Fix bug for SOA tracing & Implement trace interface JavaSvcHost: Fix bug for SOA tracing JavaTestService: Implement trace interface --- .../src/org/tempuri/IEchoSvcImpl.java | 2 +- .../hpc/scheduler/session/Constant.java | 5 + .../JavaTraceLevelConverterEnum.java | 210 +- .../servicecontext/ServiceContext.java | 18 + .../servicecontext/ServiceRegistration.java | 12 + .../servicecontext/etw/ETWTraceEvent.java | 84 +- .../session/servicecontext/etw/UserEvent.java | 5 + .../servicehost/AddHeaderOutInterceptor.java | 262 +- .../servicehost/HpcServiceHostWrapper.java | 16 +- .../hpc/servicehost/InterceptorUtility.java | 374 ++- src/com/microsoft/hpc/servicehost/Main.java | 630 ++-- .../MessagePreemptionOutInterceptor.java | 310 +- .../hpc/servicehost/ServiceRegistration.java | 13 + .../microsoft/hpc/servicehost/Utility.java | 1 + .../hpc/session/RetryOperationError.java | 188 +- test/TestService/System.xsd | 2168 ++++++------- .../hpc/session/AuthenticationFailure.java | 63 + .../microsoft/hpc/session/ObjectFactory.java | 91 + .../hpc/session/RetryOperationError.java | 117 + .../microsoft/hpc/session/package-info.java | 2 + .../_10/serialization/ObjectFactory.java | 498 +-- .../arrays/ArrayOfKeyValueOfstringstring.java | 326 +- .../serialization/arrays/ArrayOfstring.java | 69 + .../serialization/arrays/ObjectFactory.java | 140 +- .../TestService/hpc.microsoft.com.session.xsd | 32 +- .../_2004/_07/services/ComputerInfo.java | 735 +++-- .../_2004/_07/services/ObjectFactory.java | 602 ++-- .../_2004/_07/system/ObjectFactory.java | 400 +-- .../_2004/_07/system/SystemException.java | 76 +- .../org/tempuri/CheckACLOnAzure.java | 34 + .../org/tempuri/CheckACLOnAzureResponse.java | 65 + .../TestService/org/tempuri/ITestService.java | 768 ++--- ...uthenticationFailureFaultFaultMessage.java | 90 +- ...rgumentNullExceptionFaultFaultMessage.java | 90 +- ...ivideByZeroExceptionFaultFaultMessage.java | 90 +- ...ceEchoFaultExceptionFaultFaultMessage.java | 90 +- ...OutOfMemoryExceptionFaultFaultMessage.java | 90 +- ...rgumentNullExceptionFaultFaultMessage.java | 90 +- ...ivideByZeroExceptionFaultFaultMessage.java | 90 +- ...ultWithNameExceptionFaultFaultMessage.java | 90 +- ...OutOfMemoryExceptionFaultFaultMessage.java | 90 +- ...oRetryOperationErrorFaultFaultMessage.java | 90 +- ...uthenticationFailureFaultFaultMessage.java | 90 +- ...yRetryOperationErrorFaultFaultMessage.java | 90 +- ...uthenticationFailureFaultFaultMessage.java | 90 +- ...lRetryOperationErrorFaultFaultMessage.java | 90 +- ...nDataCommonDataErrorFaultFaultMessage.java | 90 +- .../org/tempuri/ITestServiceImpl.java | 2874 +++++++++-------- ...OutOfMemoryExceptionFaultFaultMessage.java | 45 + ...eRetryOperationErrorFaultFaultMessage.java | 45 + ...ice_DefaultBindingITestService_Server.java | 60 +- .../org/tempuri/ITestService_Service.java | 199 +- .../org/tempuri/JavaAITestSvcLib.java | 100 + .../org/tempuri/ObjectFactory.java | 1946 +++++------ test/TestService/org/tempuri/Trace.java | 244 +- .../org/tempuri/TraceResponse.java | 131 +- .../org/tempuri/TracingTestActionId.java | 45 + test/TestService/org/tempuri/TracingType.java | 22 + test/TestService/org/tempuri/Utility.java | 151 +- ...osoft.com.2003.10.Serialization.Arrays.xsd | 46 +- test/TestService/services.xsd | 207 +- test/TestService/tempuri.org.wsdl | 1395 ++++---- test/TestService/tempuri.org.xsd | 894 ++--- 63 files changed, 9695 insertions(+), 8375 deletions(-) create mode 100644 test/TestService/com/microsoft/hpc/session/AuthenticationFailure.java create mode 100644 test/TestService/com/microsoft/hpc/session/ObjectFactory.java create mode 100644 test/TestService/com/microsoft/hpc/session/RetryOperationError.java create mode 100644 test/TestService/com/microsoft/hpc/session/package-info.java create mode 100644 test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java create mode 100644 test/TestService/org/tempuri/CheckACLOnAzure.java create mode 100644 test/TestService/org/tempuri/CheckACLOnAzureResponse.java create mode 100644 test/TestService/org/tempuri/ITestServiceTraceOutOfMemoryExceptionFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/ITestServiceTraceRetryOperationErrorFaultFaultMessage.java create mode 100644 test/TestService/org/tempuri/JavaAITestSvcLib.java create mode 100644 test/TestService/org/tempuri/TracingTestActionId.java create mode 100644 test/TestService/org/tempuri/TracingType.java diff --git a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java index 4811f6a..c24d94d 100644 --- a/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java +++ b/sample/CcpEchoSvc/src/org/tempuri/IEchoSvcImpl.java @@ -137,7 +137,7 @@ public java.lang.String echo(java.lang.String input) { ServiceContext.Logger.traceEvent(Level.ALL, input); ServiceContext.Logger.traceEvent(Level.INFO, "Start to use ETW tracing..."); ETWTraceEvent etw =new ETWTraceEvent(wsContext); - etw.TraceInfo(input); + etw.TraceInformation(input); String userData = getUserData(); ServiceContext.Logger.traceEvent(Level.INFO, "UserData : " + userData); diff --git a/src/com/microsoft/hpc/scheduler/session/Constant.java b/src/com/microsoft/hpc/scheduler/session/Constant.java index 429baa1..2939d88 100644 --- a/src/com/microsoft/hpc/scheduler/session/Constant.java +++ b/src/com/microsoft/hpc/scheduler/session/Constant.java @@ -305,6 +305,11 @@ public class Constant * @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 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 b7511f8..0fd2036 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java @@ -84,6 +84,7 @@ public final class ServiceContext * @field the instance of logger to do the service tracing */ public static LoggerContext Logger; + /** * @field lock object for bDataServerInfoInitialized @@ -116,6 +117,23 @@ public static void setTraceLevel(String traceLevel) 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 diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java index 4ada808..f0827f6 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java @@ -96,11 +96,13 @@ public class ServiceRegistration 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() @@ -207,6 +209,16 @@ public void setserviceConfigNode(NodeList nodelist) { 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()); + } } } } diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java index a06ac82..3426500 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java @@ -71,6 +71,7 @@ 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 @@ -84,6 +85,7 @@ public class ETWTraceEvent { private UUID messageid; private UUID dispatchid; private int sessionid; + private JavaTraceLevelConverterEnum traceLevel; /** * @description get messageid dispatchid sessionid from headers @@ -110,8 +112,7 @@ public ETWTraceEvent(WebServiceContext wsContext) dispatchid = null; } } - if (name.getLocalPart().equals(Constant.MESSAGEIDLOCALPART) && - name.getNamespaceURI().equals(Constant.HpcActionHeaderNS)) + if (name.getLocalPart().equals(Constant.MESSAGEIDLOCALPART)) { Element e = (Element) h.getObject(); //cause the format is urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx @@ -126,45 +127,74 @@ public ETWTraceEvent(WebServiceContext wsContext) //getsessionid sessionid = Integer.parseInt(Environment.getEnvironmentVariable(Constant.JobIDEnvVar)); + traceLevel = ServiceContext.getSoaDiagTraceLevel(); } - /** - * @param message - */ - public int TraceCritical(String msg) + /** + * @param TraceLevel + * @param id + * @param message + */ + public int TraceEvent(JavaTraceLevelConverterEnum TraceLevel, int id, String message) { - return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Critical, sessionid, messageid, dispatchid, msg); + return UserEvent.WriteUserEvent(TraceLevel, sessionid, messageid, dispatchid, message); } - /** - * @param message - */ - public int TraceError(String msg) + /** + * + */ + public void Flush() { - return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Error, sessionid, messageid, dispatchid, msg); + return ; } - /** - * @param message - */ - public int TraceWarning(String msg) + /** + * @param message + */ + public int TraceInformation(String message) { - return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Warning, sessionid, messageid, dispatchid, msg); + return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, message); } - /** - * @param message - */ - public int TraceInfo(String msg) + /** + * @param TraceLevel + * @param id + * @param data + */ + public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object data) { - return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, msg); + return TraceData(TraceLevel, id, new Object[]{data}); } - /** - * @param message - */ - public int TraceVerbose(String msg) + /** + * @param TraceLevel + * @param id + * @param data + */ + public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object[] data) { - return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Verbose, sessionid, messageid, dispatchid, msg); + 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 index 0572628..51f8d66 100644 --- a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java +++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java @@ -61,6 +61,7 @@ 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 @@ -102,6 +103,10 @@ static public int WriteUserEvent(JavaTraceLevelConverterEnum level, int SessionI //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) 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/HpcServiceHostWrapper.java b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java index 435aac5..7406e45 100644 --- a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java +++ b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java @@ -78,6 +78,7 @@ 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; @@ -500,10 +501,15 @@ else if (serviceRegistration.getServiceContractName() != null) host.setAddress(listenUri); host.setServiceBean(userclass.newInstance()); + LoggingInInterceptor login = new LoggingInInterceptor(); + LoggingOutInterceptor logout = new LoggingOutInterceptor(); // log the in/out bound message - host.getInInterceptors().add(new LoggingInInterceptor()); - host.getOutInterceptors().add(new LoggingOutInterceptor()); - + 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 @@ -535,10 +541,8 @@ else if (serviceRegistration.getServiceContractName() != null) 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 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 9809068..b399dcc 100644 --- a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java +++ b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java @@ -90,9 +90,12 @@ public class ServiceRegistration 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() @@ -192,6 +195,16 @@ public void setserviceConfigNode(NodeList nodelist) { 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()); + } } } } diff --git a/src/com/microsoft/hpc/servicehost/Utility.java b/src/com/microsoft/hpc/servicehost/Utility.java index 18d7c0c..1243e27 100644 --- a/src/com/microsoft/hpc/servicehost/Utility.java +++ b/src/com/microsoft/hpc/servicehost/Utility.java @@ -124,6 +124,7 @@ public static ServiceRegistration getServiceRegistration(String serviceConfigNam } TraceHelper.traceInformation("Trace Level is "+serviceRegistration.traceLevel); ServiceContext.setTraceLevel(serviceRegistration.traceLevel); + ServiceContext.setSoaDiagTraceLevel(serviceRegistration.soaDiagTraceLevel); } catch (Exception e) { 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/test/TestService/System.xsd b/test/TestService/System.xsd index 0f80570..44a1898 100644 --- a/test/TestService/System.xsd +++ b/test/TestService/System.xsd @@ -1,1085 +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 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/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 index 7309e3d..a31cc62 100644 --- a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java @@ -1,249 +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); - } - -} + +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 index 47d554c..e0291b7 100644 --- a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfKeyValueOfstringstring.java @@ -1,163 +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", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays") - 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", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", required = true, nillable = true) - protected String key; - @XmlElement(name = "Value", namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", 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; - } - - } - -} + +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 index 995e47d..33e8d97 100644 --- a/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java +++ b/test/TestService/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java @@ -1,61 +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 _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 ArrayOfKeyValueOfstringstring.KeyValueOfstringstring } - * - */ - public ArrayOfKeyValueOfstringstring.KeyValueOfstringstring createArrayOfKeyValueOfstringstringKeyValueOfstringstring() { - return new ArrayOfKeyValueOfstringstring.KeyValueOfstringstring(); - } - - /** - * 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); - } - -} + +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/hpc.microsoft.com.session.xsd b/test/TestService/hpc.microsoft.com.session.xsd index 8ec251a..86e2479 100644 --- a/test/TestService/hpc.microsoft.com.session.xsd +++ b/test/TestService/hpc.microsoft.com.session.xsd @@ -1,17 +1,17 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java index 945e85f..1eeaa9d 100644 --- a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java @@ -1,354 +1,381 @@ - -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="called" 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="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", - "called", - "envs", - "jobID", - "onExitCalled", - "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; - @XmlSchemaType(name = "dateTime") - @XmlElement(name="called", namespace="http://schemas.datacontract.org/2004/07/services") - protected XMLGregorianCalendar called; - @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 = "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 called property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getCalled() { - return called; - } - - /** - * Sets the value of the called property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setCalled(XMLGregorianCalendar value) { - this.called = 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 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; - } - -} + +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="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", + "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 = "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 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/ObjectFactory.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java index 5fc21bd..141f8c9 100644 --- a/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ObjectFactory.java @@ -1,301 +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 _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 _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 _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 _ClassStrStr_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "str"); - private final static QName _ClassFooS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "s"); - private final static QName _SubSubS_QNAME = new QName("http://schemas.datacontract.org/2004/07/services", "sub_s"); - - /** - * 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 = "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 = "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 = "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 = "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(_ClassFooS_QNAME, String.class, ClassFoo.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 = "s", scope = TestStruct.class) - public JAXBElement createTestStructS(String value) { - return new JAXBElement(_ClassFooS_QNAME, String.class, TestStruct.class, value); - } - -} + +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/system/ObjectFactory.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java index aadb44b..a28518e 100644 --- a/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/ObjectFactory.java @@ -1,200 +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 ArgumentException } - * - */ - public ArgumentException createArgumentException() { - return new ArgumentException(); - } - - /** - * Create an instance of {@link SystemException } - * - */ - public SystemException createSystemException() { - return new SystemException(); - } - - /** - * Create an instance of {@link Exception } - * - */ - public Exception createException() { - return new Exception(); - } - - /** - * 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 ArithmeticException } - * - */ - public ArithmeticException createArithmeticException() { - return new ArithmeticException(); - } - - /** - * Create an instance of {@link OutOfMemoryException } - * - */ - public OutOfMemoryException createOutOfMemoryException() { - return new OutOfMemoryException(); - } - - /** - * 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); - } - -} + +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/SystemException.java b/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java index 47b1a83..226a0ad 100644 --- a/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java +++ b/test/TestService/org/datacontract/schemas/_2004/_07/system/SystemException.java @@ -1,38 +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, - ArithmeticException.class, - OutOfMemoryException.class -}) -public class SystemException - extends Exception -{ - - -} + +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/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/ITestService.java b/test/TestService/org/tempuri/ITestService.java index 58f85e9..7d24994 100644 --- a/test/TestService/org/tempuri/ITestService.java +++ b/test/TestService/org/tempuri/ITestService.java @@ -1,380 +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 - * 2011-06-14T10:42:20.346+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.aitestsvclib.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") - @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 java.lang.String trace( - @WebParam(name = "msg", targetNamespace = "http://tempuri.org/") - java.lang.String msg - ); - - @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 - ); -} +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 index b752521..008a340 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoAuthenticationFailureFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.570+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoAuthenticationFailureFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { - super(message); - this.authenticationFailure = authenticationFailure; - } - - public ITestServiceEchoAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { - super(message, cause); - this.authenticationFailure = authenticationFailure; - } - - public com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure getFaultInfo() { - return this.authenticationFailure; - } -} + +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 index 1779194..4f07a1c 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.431+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultArgumentNullExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index d61c641..ecf0a61 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.495+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultDivideByZeroExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index 55cfc8b..21cfe47 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.423+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultExceptionFaultFaultMessage extends java.lang.Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index e14ec38..7af4a54 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.441+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultOutOfMemoryExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index 5048878..5021b48 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.363+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "ArgumentNullException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultWithNameArgumentNullExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index b98c4bc..1fc6bbe 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.385+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "DivideByZeroException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultWithNameDivideByZeroExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index 26d7323..45adf17 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.354+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "Exception", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultWithNameExceptionFaultFaultMessage extends java.lang.Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index e8f7f5b..c8adf2f 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.374+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "OutOfMemoryException", targetNamespace = "http://schemas.datacontract.org/2004/07/System") -public class ITestServiceEchoFaultWithNameOutOfMemoryExceptionFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index 5301ea2..cc4fc9e 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoRetryOperationErrorFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.603+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoRetryOperationErrorFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { - super(message); - this.retryOperationError = retryOperationError; - } - - public ITestServiceEchoRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { - super(message, cause); - this.retryOperationError = retryOperationError; - } - - public com.microsoft.hpc.aitestsvclib.session.RetryOperationError getFaultInfo() { - return this.retryOperationError; - } -} + +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 index b293afc..ece9fd3 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.504+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { - super(message); - this.authenticationFailure = authenticationFailure; - } - - public ITestServiceEchoWithDelayAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { - super(message, cause); - this.authenticationFailure = authenticationFailure; - } - - public com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure getFaultInfo() { - return this.authenticationFailure; - } -} + +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 index e975014..4eb819d 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.512+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { - super(message); - this.retryOperationError = retryOperationError; - } - - public ITestServiceEchoWithDelayRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { - super(message, cause); - this.retryOperationError = retryOperationError; - } - - public com.microsoft.hpc.aitestsvclib.session.RetryOperationError getFaultInfo() { - return this.retryOperationError; - } -} + +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 index 8016f6b..6b99fd3 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.394+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "AuthenticationFailure", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.AuthenticationFailure authenticationFailure) { - super(message); - this.authenticationFailure = authenticationFailure; - } - - public ITestServiceEchoWithFailAuthenticationFailureFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure authenticationFailure, Throwable cause) { - super(message, cause); - this.authenticationFailure = authenticationFailure; - } - - public com.microsoft.hpc.aitestsvclib.session.AuthenticationFailure getFaultInfo() { - return this.authenticationFailure; - } -} + +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 index 65dbda9..c8081e1 100644 --- a/test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.405+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "RetryOperationError", targetNamespace = "http://hpc.microsoft.com/session/") -public class ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - private com.microsoft.hpc.aitestsvclib.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.aitestsvclib.session.RetryOperationError retryOperationError) { - super(message); - this.retryOperationError = retryOperationError; - } - - public ITestServiceEchoWithFailRetryOperationErrorFaultFaultMessage(String message, com.microsoft.hpc.aitestsvclib.session.RetryOperationError retryOperationError, Throwable cause) { - super(message, cause); - this.retryOperationError = retryOperationError; - } - - public com.microsoft.hpc.aitestsvclib.session.RetryOperationError getFaultInfo() { - return this.retryOperationError; - } -} + +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 index 8876eb2..01beb04 100644 --- a/test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java +++ b/test/TestService/org/tempuri/ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage.java @@ -1,45 +1,45 @@ - -package org.tempuri; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.259+08:00 - * Generated source version: 2.3.3 - * - */ - -@WebFault(name = "CommonDataError", targetNamespace = "http://schemas.datacontract.org/2004/07/AITestLib.Helper") -public class ITestServiceGetCommonDataCommonDataErrorFaultFaultMessage extends Exception { - public static final long serialVersionUID = 20110414160810L; - - 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; - } -} + +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 index 1e16e3b..441d3d9 100644 --- a/test/TestService/org/tempuri/ITestServiceImpl.java +++ b/test/TestService/org/tempuri/ITestServiceImpl.java @@ -1,1372 +1,1502 @@ -//----------------------------------------------------------------------- -// -// 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.net.InetAddress; -import java.net.UnknownHostException; -import java.security.MessageDigest; -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 javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.Duration; - -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 com.microsoft.hpc.scheduler.session.DataClient; -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.aitestsvclib.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 -{ - - 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(); - - 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(); - } - } - - 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.setCalled(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.setCalled(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); - } - } - - // In the Java version of AITestServiceLib, trace() takes a string of format - // "LEVEL:MSG" - // It records the trace message with the specified level, and then returns - // the expected trace file path. - // The path is later used by client to pull the trace file. - public java.lang.String trace(java.lang.String msg) - { - ServiceContext.Logger.traceEvent(Level.ALL, "Executing operation trace"); - try - { - String level = msg.substring(0, msg.indexOf(':')); - msg = msg.substring(msg.indexOf(':') + 1); - - if (level.equals("ALL")) - ServiceContext.Logger.traceEvent(Level.ALL, msg); - else if (level.equals("CONFIG")) - ServiceContext.Logger.traceEvent(Level.CONFIG, msg); - else if (level.equals("FINE")) - ServiceContext.Logger.traceEvent(Level.FINE, msg); - else if (level.equals("FINER")) - ServiceContext.Logger.traceEvent(Level.FINER, msg); - else if (level.equals("FINEST")) - ServiceContext.Logger.traceEvent(Level.FINEST, msg); - else if (level.equals("INFO")) - ServiceContext.Logger.traceEvent(Level.INFO, msg); - else if (level.equals("OFF")) - ServiceContext.Logger.traceEvent(Level.OFF, msg); - else if (level.equals("SEVERE")) - ServiceContext.Logger.traceEvent(Level.SEVERE, msg); - else if (level.equals("WARNING")) - ServiceContext.Logger.traceEvent(Level.WARNING, msg); - else - return "Fail"; - String machineName; - try - { - machineName = InetAddress.getLocalHost().getHostName(); - } - catch (UnknownHostException e) - { - machineName = ""; - } - String fileName = String.format("%d_%s.%s_trace.svclog", jobid, - System.getenv(EnvVarNames.CCP_TASKID), - System.getenv(EnvVarNames.CCP_TASKINSTANCEID)); - String tracePath = String.format("%sSoaTrace\\", System.getenv("CCP_DATA")); - tracePath = tracePath.replace(':', '$'); - return String.format("\\\\%s\\%s%s", machineName, tracePath, fileName); - } - catch (java.lang.Exception ex) - { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - } - - /* - * (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.setCalled(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 = info.getEnvs().getValue() - .getKeyValueOfstringstring(); - 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; - - // throw new - // ITestServiceEchoAuthenticationFailureFaultFaultMessage("ITestService_Echo_AuthenticationFailureFault_FaultMessage..."); - // throw new - // ITestServiceEchoRetryOperationErrorFaultFaultMessage("ITestService_Echo_RetryOperationErrorFault_FaultMessage..."); - } - - /* - * (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; - } -} +//----------------------------------------------------------------------- +// +// 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.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(); + + 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(); + } + } + + 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)); + + 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 index 21cada1..be19f05 100644 --- a/test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java +++ b/test/TestService/org/tempuri/ITestService_DefaultBindingITestService_Server.java @@ -1,30 +1,30 @@ - -package org.tempuri; - -import javax.xml.ws.Endpoint; - -/** - * This class was generated by Apache CXF 2.3.3 - * 2011-04-14T16:08:10.724+08:00 - * Generated source version: 2.3.3 - * - */ - -public class ITestService_DefaultBindingITestService_Server{ - - protected ITestService_DefaultBindingITestService_Server() throws Exception { - System.out.println("Starting Server"); - Object implementor = new ITestServiceImpl(); - String address = "http://localhost:9200/Broker"; - Endpoint.publish(address, implementor); - } - - public static void main(String args[]) throws Exception { - new ITestService_DefaultBindingITestService_Server(); - System.out.println("Server ready..."); - - Thread.sleep(50 * 60 * 1000); - System.out.println("Server exiting"); - System.exit(0); - } -} + +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 index 36050b7..878df8c 100644 --- a/test/TestService/org/tempuri/ITestService_Service.java +++ b/test/TestService/org/tempuri/ITestService_Service.java @@ -1,99 +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.3.3 - * 2011-04-14T16:08:10.733+08:00 - * Generated source version: 2.3.3 - * - */ - - -@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) { - System.err.println("Can not initialize the default wsdl from file:tempuri.org.wsdl"); - // e.printStackTrace(); - } - 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); - } - -} + +/* + * + */ + +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/ObjectFactory.java b/test/TestService/org/tempuri/ObjectFactory.java index 6191748..0a88519 100644 --- a/test/TestService/org/tempuri/ObjectFactory.java +++ b/test/TestService/org/tempuri/ObjectFactory.java @@ -1,960 +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 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 _EchoObjectResponseEchoObjectResult_QNAME = new QName("http://tempuri.org/", "EchoObjectResult"); - private final static QName _EchoObject3ResponseEchoObject3Result_QNAME = new QName("http://tempuri.org/", "EchoObject3Result"); - private final static QName _EchoObject4Obj_QNAME = new QName("http://tempuri.org/", "obj"); - private final static QName _EchoFaultResponseEchoFaultResult_QNAME = new QName("http://tempuri.org/", "EchoFaultResult"); - private final static QName _EchoObject2ResponseEchoObject2Result_QNAME = new QName("http://tempuri.org/", "EchoObject2Result"); - private final static QName _EchoResponseEchoResult_QNAME = new QName("http://tempuri.org/", "EchoResult"); - private final static QName _EchoWithDelayResponseEchoWithDelayResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayResult"); - private final static QName _GenerateLoadWithInputFileResponseGenerateLoadWithInputFileResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithInputFileResult"); - private final static QName _EchoWithOnExitLogPath_QNAME = new QName("http://tempuri.org/", "logPath"); - private final static QName _EchoClassCls_QNAME = new QName("http://tempuri.org/", "cls"); - private final static QName _EchoWithOnExitResponseEchoWithOnExitResult_QNAME = new QName("http://tempuri.org/", "EchoWithOnExitResult"); - private final static QName _ConsumeCPUResponseConsumeCPUResult_QNAME = new QName("http://tempuri.org/", "ConsumeCPUResult"); - private final static QName _EchoFaultWithNameExceptionName_QNAME = new QName("http://tempuri.org/", "exceptionName"); - private final static QName _EchoFaultEx_QNAME = new QName("http://tempuri.org/", "ex"); - private final static QName _GenerateLoadCommonDataPath_QNAME = new QName("http://tempuri.org/", "common_data_path"); - private final static QName _GenerateLoadInputData_QNAME = new QName("http://tempuri.org/", "input_data"); - 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 _EchoWithDelayOnSelectedNodeSelectedNode_QNAME = new QName("http://tempuri.org/", "selectedNode"); - private final static QName _GetCommonDataResponseGetCommonDataResult_QNAME = new QName("http://tempuri.org/", "GetCommonDataResult"); - private final static QName _EchoClassResponseEchoClassResult_QNAME = new QName("http://tempuri.org/", "EchoClassResult"); - private final static QName _EchoObject3Type_QNAME = new QName("http://tempuri.org/", "type"); - private final static QName _EchoObject3O_QNAME = new QName("http://tempuri.org/", "o"); - private final static QName _EchoWithDelayOnSelectedNodeResponseEchoWithDelayOnSelectedNodeResult_QNAME = new QName("http://tempuri.org/", "EchoWithDelayOnSelectedNodeResult"); - private final static QName _TraceMsg_QNAME = new QName("http://tempuri.org/", "msg"); - private final static QName _EchoAppSettingsResponseEchoAppSettingsResult_QNAME = new QName("http://tempuri.org/", "EchoAppSettingsResult"); - private final static QName _CheckACLOnAzureResponseCheckACLOnAzureResult_QNAME = new QName("http://tempuri.org/", "CheckACLOnAzureResult"); - private final static QName _GenerateLoadResponseGenerateLoadResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadResult"); - private final static QName _EchoStructResponseEchoStructResult_QNAME = new QName("http://tempuri.org/", "EchoStructResult"); - private final static QName _ServiceSideAsyncEchoResponseServiceSideAsyncEchoResult_QNAME = new QName("http://tempuri.org/", "ServiceSideAsyncEchoResult"); - private final static QName _TraceResponseTraceResult_QNAME = new QName("http://tempuri.org/", "TraceResult"); - private final static QName _SerializationTestStream_QNAME = new QName("http://tempuri.org/", "stream"); - 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 _EchoExceptionResponseEchoExceptionResult_QNAME = new QName("http://tempuri.org/", "EchoExceptionResult"); - private final static QName _RunInprocSoaJobResponseRunInprocSoaJobResult_QNAME = new QName("http://tempuri.org/", "RunInprocSoaJobResult"); - 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 _GenerateLoadWithInputFileInputDataPath_QNAME = new QName("http://tempuri.org/", "input_data_path"); - private final static QName _EchoWithFailResponseEchoWithFailResult_QNAME = new QName("http://tempuri.org/", "EchoWithFailResult"); - private final static QName _GenerateLoadWithResponseDataResponseGenerateLoadWithResponseDataResult_QNAME = new QName("http://tempuri.org/", "GenerateLoadWithResponseDataResult"); - - /** - * 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 EchoAppSettings } - * - */ - public EchoAppSettings createEchoAppSettings() { - return new EchoAppSettings(); - } - - /** - * Create an instance of {@link EchoFaultWithNameResponse } - * - */ - public EchoFaultWithNameResponse createEchoFaultWithNameResponse() { - return new EchoFaultWithNameResponse(); - } - - /** - * 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 GetCommonDataResponse } - * - */ - public GetCommonDataResponse createGetCommonDataResponse() { - return new GetCommonDataResponse(); - } - - /** - * Create an instance of {@link ServiceSideAsyncEchoResponse } - * - */ - public ServiceSideAsyncEchoResponse createServiceSideAsyncEchoResponse() { - return new ServiceSideAsyncEchoResponse(); - } - - /** - * 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 EchoDoubleResponse } - * - */ - public EchoDoubleResponse createEchoDoubleResponse() { - return new EchoDoubleResponse(); - } - - /** - * Create an instance of {@link GenerateLoad } - * - */ - public GenerateLoad createGenerateLoad() { - return new GenerateLoad(); - } - - /** - * 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 EchoWithDelayOnSelectedNodeResponse } - * - */ - public EchoWithDelayOnSelectedNodeResponse createEchoWithDelayOnSelectedNodeResponse() { - return new EchoWithDelayOnSelectedNodeResponse(); - } - - /** - * Create an instance of {@link GenerateLoadWithResponseData } - * - */ - public GenerateLoadWithResponseData createGenerateLoadWithResponseData() { - return new GenerateLoadWithResponseData(); - } - - /** - * Create an instance of {@link RunInprocSoaJob } - * - */ - public RunInprocSoaJob createRunInprocSoaJob() { - return new RunInprocSoaJob(); - } - - /** - * 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 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 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 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 = "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 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 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 = "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 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 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 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 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 = "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 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 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 String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "common_data_path", scope = GenerateLoad.class) - public JAXBElement createGenerateLoadCommonDataPath(String value) { - return new JAXBElement(_GenerateLoadCommonDataPath_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(_GenerateLoadInputData_QNAME, byte[].class, GenerateLoad.class, ((byte[]) 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 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 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 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 = "type", scope = EchoObject3 .class) - public JAXBElement createEchoObject3Type(String value) { - return new JAXBElement(_EchoObject3Type_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(_EchoObject3O_QNAME, Object.class, EchoObject3 .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 String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "msg", scope = Trace.class) - public JAXBElement createTraceMsg(String value) { - return new JAXBElement(_TraceMsg_QNAME, String.class, Trace.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 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 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 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 String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "TraceResult", scope = TraceResponse.class) - public JAXBElement createTraceResponseTraceResult(String value) { - return new JAXBElement(_TraceResponseTraceResult_QNAME, String.class, TraceResponse.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 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 byte[]}{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "input_data", scope = GenerateLoadWithResponseData.class) - public JAXBElement createGenerateLoadWithResponseDataInputData(byte[] value) { - return new JAXBElement(_GenerateLoadInputData_QNAME, byte[].class, GenerateLoadWithResponseData.class, ((byte[]) 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 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 String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://tempuri.org/", name = "type", scope = EchoObject.class) - public JAXBElement createEchoObjectType(String value) { - return new JAXBElement(_EchoObject3Type_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(_EchoObject3O_QNAME, Object.class, EchoObject.class, 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 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 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 = GenerateLoadWithInputFile.class) - public JAXBElement createGenerateLoadWithInputFileCommonDataPath(String value) { - return new JAXBElement(_GenerateLoadCommonDataPath_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 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 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); - } - -} + +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/Trace.java b/test/TestService/org/tempuri/Trace.java index 90df2d8..a29c73f 100644 --- a/test/TestService/org/tempuri/Trace.java +++ b/test/TestService/org/tempuri/Trace.java @@ -1,65 +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.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="msg" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "msg" -}) -@XmlRootElement(name = "Trace") -public class Trace { - - @XmlElementRef(name = "msg", namespace = "http://tempuri.org/", type = JAXBElement.class, required = false) - protected JAXBElement msg; - - /** - * Gets the value of the msg property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public JAXBElement getMsg() { - return msg; - } - - /** - * Sets the value of the msg property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setMsg(JAXBElement value) { - this.msg = ((JAXBElement ) value); - } - -} + +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 index fb7aa5f..9e26ef1 100644 --- a/test/TestService/org/tempuri/TraceResponse.java +++ b/test/TestService/org/tempuri/TraceResponse.java @@ -1,65 +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; - - -/** - *

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://www.w3.org/2001/XMLSchema}string" 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 String }{@code >} - * - */ - public JAXBElement getTraceResult() { - return traceResult; - } - - /** - * Sets the value of the traceResult property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * - */ - public void setTraceResult(JAXBElement value) { - this.traceResult = ((JAXBElement ) value); - } - -} + +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 index a67d703..40bb2af 100644 --- a/test/TestService/org/tempuri/Utility.java +++ b/test/TestService/org/tempuri/Utility.java @@ -1,68 +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 javax.xml.bind.JAXBElement; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - -import com.microsoft.hpc.aitestsvclib.session.RetryOperationError; - -class Utility { - private static com.microsoft.schemas._2003._10.serialization.ObjectFactory fact - = new com.microsoft.schemas._2003._10.serialization.ObjectFactory(); - - 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; - } -} +//----------------------------------------------------------------------- +// +// 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/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd b/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd index 2b13a22..0f6f60b 100644 --- a/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd +++ b/test/TestService/schemas.microsoft.com.2003.10.Serialization.Arrays.xsd @@ -1,21 +1,27 @@ - - - - - - true - - - - - - - - - - - - - - + + + + + + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/services.xsd b/test/TestService/services.xsd index 9d6ec18..09a4b4c 100644 --- a/test/TestService/services.xsd +++ b/test/TestService/services.xsd @@ -1,104 +1,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 256 - - - - - - - 16 - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 256 + + + + + + + 16 + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestService/tempuri.org.wsdl b/test/TestService/tempuri.org.wsdl index 2b63cb8..7e6e8ca 100644 --- a/test/TestService/tempuri.org.wsdl +++ b/test/TestService/tempuri.org.wsdl @@ -1,681 +1,714 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestService/tempuri.org.xsd b/test/TestService/tempuri.org.xsd index ce2a636..e65420b 100644 --- a/test/TestService/tempuri.org.xsd +++ b/test/TestService/tempuri.org.xsd @@ -1,440 +1,456 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 767b626f9fce7255da693597f38a6d3b14ae0abe Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Mon, 15 Oct 2012 13:48:10 +0800 Subject: [PATCH 22/23] Update java test service Update java test service --- .../_2004/_07/services/ComputerInfo.java | 28 +++++++++++++++++ .../org/tempuri/ITestServiceImpl.java | 11 +++++-- test/TestService/services.xsd | 2 ++ test/TestService/tempuri.org.xsd | 30 ++++++++++++++----- 4 files changed, 62 insertions(+), 9 deletions(-) diff --git a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java index 1eeaa9d..536d326 100644 --- a/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java +++ b/test/TestService/org/datacontract/schemas/_2004/_07/services/ComputerInfo.java @@ -28,6 +28,7 @@ * <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"/> @@ -50,6 +51,7 @@ "envs", "jobID", "onExitCalled", + "processId", "refID", "runAsUser", "scheduler", @@ -71,6 +73,8 @@ public class ComputerInfo { 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) @@ -233,6 +237,30 @@ public Boolean isOnExitCalled() { 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. diff --git a/test/TestService/org/tempuri/ITestServiceImpl.java b/test/TestService/org/tempuri/ITestServiceImpl.java index 441d3d9..5a541f2 100644 --- a/test/TestService/org/tempuri/ITestServiceImpl.java +++ b/test/TestService/org/tempuri/ITestServiceImpl.java @@ -16,6 +16,7 @@ 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; @@ -105,7 +106,8 @@ public class ITestServiceImpl implements ITestService private String logfile; private Object log = new Object(); - + private static int processId = -1; + static { String dummy = System.getenv(EnvVarNames.CCP_TASKSYSTEMID); @@ -182,6 +184,10 @@ public class ITestServiceImpl implements ITestService { e.printStackTrace(); } + + String pid = ManagementFactory.getRuntimeMXBean().getName(); + int index = pid.indexOf("@"); + processId = Integer.parseInt(pid.substring(0, index)); } public ITestServiceImpl() @@ -198,6 +204,7 @@ public ITestServiceImpl() e.printStackTrace(); } } + } private synchronized void writeLog(String logDir, int refID, String msg, Object... args) @@ -1473,7 +1480,7 @@ private ComputerInfo buildComputerInfo(int refID) info.setJobID(jobid); info.setTaskID(taskid); info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); - + info.setProcessId(this.processId); try { info.setCallIn(Utility.getXMLCurrentTime()); diff --git a/test/TestService/services.xsd b/test/TestService/services.xsd index 09a4b4c..d6166a9 100644 --- a/test/TestService/services.xsd +++ b/test/TestService/services.xsd @@ -10,6 +10,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/test/TestService/tempuri.org.xsd b/test/TestService/tempuri.org.xsd index e65420b..a520b69 100644 --- a/test/TestService/tempuri.org.xsd +++ b/test/TestService/tempuri.org.xsd @@ -4,6 +4,18 @@ + + + + + + + + + + + + @@ -427,29 +439,33 @@ - + + + - + - + - + - + + + - + - + From bad1bb1098fe0f93793b5214f8ee148a800b618b Mon Sep 17 00:00:00 2001 From: Microsoft HPC Group Date: Thu, 10 Jan 2013 18:30:20 +0800 Subject: [PATCH 23/23] update broker client contract. update broker client contract. --- .../BrokerInitializationResult.java | 547 +++++++++--------- 1 file changed, 286 insertions(+), 261 deletions(-) diff --git a/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java b/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java index b7c3be5..5b8afbc 100644 --- a/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java +++ b/src/com/microsoft/hpc/brokerlauncher/BrokerInitializationResult.java @@ -1,261 +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="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"/>
- *       </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" -}) -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; - - /** - * 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; - } - -} + +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; + } + +}