private ComputerInfo buildComputerInfo(int refID) { TestStruct ts = new TestStruct(); ts.setD((double) 2); ts.setF((float) 3); ts.setI64((long) 4); ts.setI321(1); ts.setI322(2); ts.setS(svcObjFact.createTestStructS("")); ComputerInfo info = new ComputerInfo(); info.setRefID(refID); String machineName; try { machineName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { machineName = ""; } info.setName(svcObjFact.createComputerInfoName(machineName)); info.setJobID(jobid); info.setTaskID(taskid); info.setScheduler(svcObjFact.createComputerInfoScheduler(scheduler)); info.setProcessId(this.processId); try { info.setCallIn(Utility.getXMLCurrentTime()); } catch (DatatypeConfigurationException e1) { e1.printStackTrace(); System.exit(1); } info.setTs(ts); return info; }
/* * (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#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#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<String, String> envMap = System.getenv(); List<KeyValueOfstringstring> envList = new ArrayList<KeyValueOfstringstring>(); 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; }