org.apache.tools.ant.util.DateUtils Java Examples
The following examples show how to use
org.apache.tools.ant.util.DateUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JUnitXmlResultWriter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void write(TestClassResult result, OutputStream output) { String className = result.getClassName(); long classId = result.getId(); try { SimpleXmlWriter writer = new SimpleXmlWriter(output, " "); writer.startElement("testsuite") .attribute("name", className) .attribute("tests", String.valueOf(result.getTestsCount())) .attribute("skipped", String.valueOf(result.getSkippedCount())) .attribute("failures", String.valueOf(result.getFailuresCount())) .attribute("errors", "0") .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN)) .attribute("hostname", hostName) .attribute("time", String.valueOf(result.getDuration() / 1000.0)); writer.startElement("properties"); writer.endElement(); writeTests(writer, result.getResults(), className, classId); writer.startElement("system-out"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut); writer.endElement(); writer.startElement("system-err"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr); writer.endElement(); writer.endElement(); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #2
Source File: JUnitXmlResultWriter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void write(TestClassResult result, OutputStream output) { String className = result.getClassName(); long classId = result.getId(); try { SimpleXmlWriter writer = new SimpleXmlWriter(output, " "); writer.startElement("testsuite") .attribute("name", className) .attribute("tests", String.valueOf(result.getTestsCount())) .attribute("skipped", String.valueOf(result.getSkippedCount())) .attribute("failures", String.valueOf(result.getFailuresCount())) .attribute("errors", "0") .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN)) .attribute("hostname", hostName) .attribute("time", String.valueOf(result.getDuration() / 1000.0)); writer.startElement("properties"); writer.endElement(); writeTests(writer, result.getResults(), className, classId); writer.startElement("system-out"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut); writer.endElement(); writer.startElement("system-err"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr); writer.endElement(); writer.endElement(); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #3
Source File: JUnitXmlResultWriter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void write(TestClassResult result, OutputStream output) { String className = result.getClassName(); long classId = result.getId(); try { SimpleXmlWriter writer = new SimpleXmlWriter(output, " "); writer.startElement("testsuite") .attribute("name", className) .attribute("tests", String.valueOf(result.getTestsCount())) .attribute("skipped", String.valueOf(result.getSkippedCount())) .attribute("failures", String.valueOf(result.getFailuresCount())) .attribute("errors", "0") .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN)) .attribute("hostname", hostName) .attribute("time", String.valueOf(result.getDuration() / 1000.0)); writer.startElement("properties"); writer.endElement(); writeTests(writer, result.getResults(), className, classId); writer.startElement("system-out"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut); writer.endElement(); writer.startElement("system-err"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr); writer.endElement(); writer.endElement(); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #4
Source File: JUnitXmlResultWriter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void write(TestClassResult result, OutputStream output) { String className = result.getClassName(); long classId = result.getId(); try { SimpleXmlWriter writer = new SimpleXmlWriter(output, " "); writer.startElement("testsuite") .attribute("name", className) .attribute("tests", String.valueOf(result.getTestsCount())) .attribute("skipped", String.valueOf(result.getSkippedCount())) .attribute("failures", String.valueOf(result.getFailuresCount())) .attribute("errors", "0") .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN)) .attribute("hostname", hostName) .attribute("time", String.valueOf(result.getDuration() / 1000.0)); writer.startElement("properties"); writer.endElement(); writeTests(writer, result.getResults(), className, classId); writer.startElement("system-out"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut); writer.endElement(); writer.startElement("system-err"); writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr); writer.endElement(); writer.endElement(); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #5
Source File: PublicPbrpcProtocol.java From brpc-java with Apache License 2.0 | 4 votes |
@Override public ByteBuf encodeRequest(Request request) throws Exception { // service method RpcMetaUtils.RpcMetaInfo rpcMetaInfo = RpcMetaUtils.parseRpcMeta(request.getTargetMethod()); int methodIndex; try { methodIndex = Integer.valueOf(rpcMetaInfo.getMethodName()); } catch (NumberFormatException ex) { String errorMsg = "methodName must be integer when using pbrpc, " + "it is equal to proto method sequence from 0"; log.warn(errorMsg); throw new RpcException(RpcException.SERIALIZATION_EXCEPTION, errorMsg, ex); } // build head RequestHead.Builder headBuilder = RequestHead.newBuilder(); headBuilder.setFromHost(InetAddress.getLocalHost().getHostAddress()); headBuilder.setContentType(CONTENT_TYPE); // todo short connection headBuilder.setConnection(false); headBuilder.setCharset(CHARSET); headBuilder.setCreateTime(DateUtils.format(Calendar.getInstance().getTime(), TIME_FORMAT)); headBuilder.setLogId(request.getLogId()); headBuilder.setCompressType(request.getCompressType()); // build body RequestBody.Builder bodyBuilder = RequestBody.newBuilder(); bodyBuilder.setVersion(VERSION); bodyBuilder.setCharset(CHARSET); bodyBuilder.setService(request.getServiceName()); bodyBuilder.setMethodId(methodIndex); bodyBuilder.setId(request.getCorrelationId()); Compress compress = compressManager.getCompress(request.getCompressType()); ByteBuf protoBuf = compress.compressInput(request.getArgs()[0], request.getRpcMethodInfo()); bodyBuilder.setSerializedRequest(ByteString.copyFrom(protoBuf.nioBuffer())); PublicPbrpcRequest pbreq = PublicPbrpcRequest.newBuilder() .setRequestHead(headBuilder.build()) .addRequestBody(bodyBuilder.build()) .build(); NSHead nsHead = new NSHead(); nsHead.logId = (int) request.getLogId(); nsHead.magicNumber = NSHead.NSHEAD_MAGIC_NUM; nsHead.provider = PROVIDER; nsHead.version = NSHEAD_VERSION; nsHead.bodyLength = pbreq.getSerializedSize(); byte[] nsHeadBytes = nsHead.toBytes(); return Unpooled.wrappedBuffer(nsHeadBytes, request.getRpcMethodInfo().inputEncode(pbreq)); }