List of usage examples for java.util Arrays deepToString
public static String deepToString(Object[] a)
From source file:de.kopis.glacier.parsers.GlacierUploaderOptionParserTest.java
@Test public void hasActionOptionUpload() { final String[] newArgs = Arrays.copyOf(args, args.length + 2); newArgs[newArgs.length - 2] = "--upload"; newArgs[newArgs.length - 1] = "/path/to/file"; final OptionSet optionSet = optionsParser.parse(newArgs); assertTrue("Option 'upload' not found in " + Arrays.deepToString(optionSet.specs().toArray()), optionSet.has("upload")); assertEquals("Value of option 'upload' not found in " + Arrays.deepToString(optionSet.specs().toArray()), new File("/path/to/file"), optionSet.valueOf("upload")); }
From source file:com.googlecode.noweco.calendar.test.CalendarClientTest.java
@Test @Ignore/* w ww. ja v a2 s . co m*/ public void test() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); // if (google || chandlerproject) { // HttpParams params = httpclient.getParams(); // ConnRouteParams.setDefaultProxy(params, new HttpHost("ecprox.bull.fr")); // } HttpEntityEnclosingRequestBase httpRequestBase = new HttpEntityEnclosingRequestBase() { @Override public String getMethod() { return "PROPFIND"; } }; BasicHttpEntity entity = new BasicHttpEntity(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(byteArrayOutputStream); // outputStreamWriter.write( "<?xml version=\"1.0\" encoding=\"utf-8\" ?><D:propfind xmlns:D=\"DAV:\"> <D:prop> <D:displayname/> <D:principal-collection-set/> <calendar-home-set xmlns=\"urn:ietf:params:xml:ns:caldav\"/> </D:prop> </D:propfind>"); outputStreamWriter.close(); entity.setContent(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())); httpRequestBase.setEntity(entity); httpRequestBase.setURI(new URI("/dav/collection/gael.lalire@bull.com/")); if (google) { httpRequestBase.setURI(new URI("/calendar/dav/gael.lalire@gmail.com/user/")); } if (chandlerproject) { httpRequestBase.setURI(new URI("/dav/collection/8de93530-8796-11e0-82b8-d279848d8f3e")); } if (apple) { httpRequestBase.setURI(new URI("/")); } HttpHost target = new HttpHost("localhost", 8080); if (google) { target = new HttpHost("www.google.com", 443, "https"); } if (chandlerproject) { target = new HttpHost("hub.chandlerproject.org", 443, "https"); } if (apple) { target = new HttpHost("localhost", 8008, "http"); } httpRequestBase.setHeader("Depth", "0"); String userpass = null; if (apple) { userpass = "admin:admin"; } httpRequestBase.setHeader("authorization", "Basic " + Base64.encodeBase64String(userpass.getBytes())); HttpResponse execute = httpclient.execute(target, httpRequestBase); System.out.println(Arrays.deepToString(execute.getAllHeaders())); System.out.println(execute.getStatusLine()); System.out.println(EntityUtils.toString(execute.getEntity())); }
From source file:Methods.CalculusSecant.java
private static void datasetPointsSecant() {// Method used to retrieve data from stack and copy it in an array uset for the dataset data = new double[2][(S.size())]; int i = (S.size() - 1); while (!S.isEmpty()) {//While used to retrieve data from stack data[0][i] = Double.parseDouble(S.popElement1().toString()); data[1][i] = Double.parseDouble(S.popElement2().toString()); i--;/*from w ww. j a v a2s . c o m*/ } System.out.println("TEST DEEP ARRAY SECANT: " + Arrays.deepToString(data)); datasetPoints.addSeries("Iteration points", data); }
From source file:org.apache.gora.goraci.Loop.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); options.addOption("c", "concurrent", false, "run generation and verification and concurrently"); GnuParser parser = new GnuParser(); CommandLine cmd = null;/*w ww. ja v a 2 s . c o m*/ try { cmd = parser.parse(options, args); if (cmd.getArgs().length != 5) { throw new ParseException("Did not see expected # of arguments, saw " + cmd.getArgs().length); } } catch (ParseException e) { LOG.error("Failed to parse command line {}", e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( getClass().getSimpleName() + " <num iterations> <num mappers> <num nodes per mapper> <output dir> <num reducers>", options); System.exit(-1); } LOG.info("Running Loop with args:" + Arrays.deepToString(cmd.getArgs())); boolean concurrent = cmd.hasOption("c"); int numIterations = Integer.parseInt(cmd.getArgs()[0]); int numMappers = Integer.parseInt(cmd.getArgs()[1]); long numNodes = Long.parseLong(cmd.getArgs()[2]); String outputDir = cmd.getArgs()[3]; int numReducers = Integer.parseInt(cmd.getArgs()[4]); if (numNodes % Generator.WRAP != 0) { throw new RuntimeException("Number of node per mapper is not a multiple of " + String.format(Locale.getDefault(), "%,d", Generator.WRAP)); } long expectedNumNodes = 0; if (numIterations < 0) { numIterations = Integer.MAX_VALUE; //run indefinitely (kind of) } Verify verify = null; long verifyNodes = 0; for (int i = 0; i < numIterations; i++) { LOG.info("Starting iteration = {}", i); runGenerator(numMappers, numNodes, concurrent); expectedNumNodes += numMappers * numNodes; if (concurrent) { if (verify != null) { if (verify.isComplete()) { checkSuccess(verify, verifyNodes); verify = startVerify(outputDir, numReducers, true); verifyNodes = expectedNumNodes; } } else { verify = startVerify(outputDir, numReducers, true); verifyNodes = expectedNumNodes; } } else { runVerify(outputDir, numReducers, expectedNumNodes); } } if (verify != null) { verify.waitForCompletion(); checkSuccess(verify, verifyNodes); if (verifyNodes != expectedNumNodes) runVerify(outputDir, numReducers, expectedNumNodes); } return 0; }
From source file:goraci.Loop.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); options.addOption("c", "concurrent", false, "run generation and verification and concurrently"); GnuParser parser = new GnuParser(); CommandLine cmd = null;//ww w . ja v a 2 s. c om try { cmd = parser.parse(options, args); if (cmd.getArgs().length != 5) { throw new ParseException("Did not see expected # of arguments, saw " + cmd.getArgs().length); } } catch (ParseException e) { System.err.println("Failed to parse command line " + e.getMessage()); System.err.println(); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( getClass().getSimpleName() + " <num iterations> <num mappers> <num nodes per mapper> <output dir> <num reducers>", options); System.exit(-1); } LOG.info("Running Loop with args:" + Arrays.deepToString(cmd.getArgs())); boolean concurrent = cmd.hasOption("c"); int numIterations = Integer.parseInt(cmd.getArgs()[0]); int numMappers = Integer.parseInt(cmd.getArgs()[1]); long numNodes = Long.parseLong(cmd.getArgs()[2]); String outputDir = cmd.getArgs()[3]; int numReducers = Integer.parseInt(cmd.getArgs()[4]); if (numNodes % Generator.WRAP != 0) { throw new RuntimeException( "Number of node per mapper is not a multiple of " + String.format("%,d", Generator.WRAP)); } long expectedNumNodes = 0; if (numIterations < 0) { numIterations = Integer.MAX_VALUE; //run indefinitely (kind of) } Verify verify = null; long verifyNodes = 0; for (int i = 0; i < numIterations; i++) { LOG.info("Starting iteration = " + i); runGenerator(numMappers, numNodes, concurrent); expectedNumNodes += numMappers * numNodes; if (concurrent) { if (verify != null) { if (verify.isComplete()) { checkSuccess(verify, verifyNodes); verify = startVerify(outputDir, numReducers, true); verifyNodes = expectedNumNodes; } } else { verify = startVerify(outputDir, numReducers, true); verifyNodes = expectedNumNodes; } } else { runVerify(outputDir, numReducers, expectedNumNodes); } } if (verify != null) { verify.waitForCompletion(); checkSuccess(verify, verifyNodes); if (verifyNodes != expectedNumNodes) runVerify(outputDir, numReducers, expectedNumNodes); } return 0; }
From source file:com.adobe.aem.importer.impl.DocImporterImpl.java
private boolean initImport(String importRootPath) { log.info("importRootPath:" + importRootPath); try {//from w w w . j a v a2 s. c o m this.session = slingRepository.loginAdministrative(null); log.info("this.session:" + this.session); if (!this.session.nodeExists(importRootPath)) { log.info("importRootPath " + importRootPath + " not found!"); return false; } this.importRootNode = this.session.getNode(importRootPath); log.info("this.importRootNode: " + this.importRootNode); if (!this.importRootNode.hasNode(DocImporter.CONFIG_FILE_NAME)) { log.info("config file " + DocImporter.CONFIG_FILE_NAME + " not found!"); return false; } this.properties = new Properties(); this.properties .loadFromXML(JcrUtils.readFile(this.importRootNode.getNode(DocImporter.CONFIG_FILE_NAME))); log.info("this.properties: " + Arrays.deepToString(this.properties.values().toArray())); String sourceFolder = properties.getProperty(DocImporter.CONFIG_PARAM_SOURCE_FOLDER, DocImporter.DEFAULT_SOURCE_FOLDER); log.info("sourceFolder: " + sourceFolder); if (!this.importRootNode.hasNode(sourceFolder)) { log.info("sourceFolder " + sourceFolder + " not found!"); return false; } this.sourceFolderNode = importRootNode.getNode(sourceFolder); log.info("this.sourceFolderNode: " + this.sourceFolderNode); this.masterFileName = properties.getProperty(DocImporter.CONFIG_PARAM_MASTER_FILE, DocImporter.DEFAULT_MASTER_FILE); log.info("this.masterFileName: " + this.masterFileName); if (!this.sourceFolderNode.hasNode(this.masterFileName)) { log.info("masterFileName " + this.masterFileName + " not found!"); return false; } this.graphicsFolderName = properties.getProperty(DocImporter.CONFIG_PARAM_GRAPHICS_FOLDER, DocImporter.DEFAULT_GRAPHICS_FOLDER); log.info("this.graphicsFolderName: " + this.graphicsFolderName); this.targetPath = properties.getProperty(DocImporter.CONFIG_PARAM_TARGET_PATH, DocImporter.DEFAULT_TARGET_PATH); log.info("this.targetPath: " + this.targetPath); String sourceFormat = this.properties.getProperty(DocImporter.CONFIG_PARAM_SOURCE_FORMAT, DocImporter.DEFAULT_SOURCE_FORMAT); log.info("sourceFormat: " + sourceFormat); if (sourceFormat.equalsIgnoreCase(DocImporter.SOURCE_FORMAT_DOCBOOK)) { this.xsltFilePath = DocImporter.DOCBOOK_XSLT_PATH; } else { this.xsltFilePath = DocImporter.DITA_XSLT_PATH; } log.info("this.xsltFilePath: " + this.xsltFilePath); } catch (RepositoryException e) { log.error(e.toString()); } catch (IOException e) { log.error(e.toString()); } return true; }
From source file:edu.cornell.mannlib.vitro.webapp.utils.log.LogUtils.java
private String formatArray(Object o) { return formatClass(o) + ": " + Arrays.deepToString((Object[]) o); }
From source file:org.wso2.carbon.event.processor.storm.internal.listener.ConsumingQueuedEventSource.java
@Override public void consumeEvent(Object[] eventData) { if (traceEnabled) { trace.info(tracerPrefix + Arrays.deepToString(eventData)); }//from w w w .j ava 2 s.c o m if (statisticsEnabled) { statisticsMonitor.incrementRequest(); } eventQueue.offer(eventData); }
From source file:edu.cornell.mannlib.vitro.webapp.rdfservice.impl.logging.RDFServiceLogger.java
@Override public void close() { try {/*ww w . jav a2 s . c o m*/ if (startTime != 0L) { long endTime = System.currentTimeMillis(); float elapsedSeconds = (endTime - startTime) / 1000.0F; String cleanArgs = Arrays.deepToString(args).replaceAll("[\\n\\r\\t]+", " "); String formattedTrace = stackTrace.format(traceRequested); log.info(String.format("%8.3f %s %s %s", elapsedSeconds, stackTrace.getMethodName(), cleanArgs, formattedTrace)); } } catch (Exception e) { log.error("Failed to write log record", e); } }
From source file:org.wso2.carbon.event.output.adaptor.core.AbstractOutputEventAdaptor.java
/** * publish a message to a given connection. * * @param outputEventAdaptorMessageConfiguration * - message configuration event adaptor to publish messages * @param message - message to send/*from www . j a va 2 s . co m*/ * @param outputEventAdaptorConfiguration * * @param tenantId */ public void publishCall(OutputEventAdaptorMessageConfiguration outputEventAdaptorMessageConfiguration, Object message, OutputEventAdaptorConfiguration outputEventAdaptorConfiguration, int tenantId) { if (outputEventAdaptorConfiguration.isEnableTracing()) { trace.info("TenantId=" + String.valueOf(tenantId) + " : " + OUTPUT_EVENT_ADAPTOR + " : " + outputEventAdaptorConfiguration.getName() + ", sent " + System.getProperty("line.separator") + (message instanceof Object[] ? Arrays.deepToString((Object[]) message) : message)); } if (outputEventAdaptorConfiguration.isEnableStatistics()) { EventStatisticsMonitor statisticsMonitor = OutputEventAdaptorServiceValueHolder .getEventStatisticsService().getEventStatisticMonitor(tenantId, OUTPUT_EVENT_ADAPTOR, outputEventAdaptorConfiguration.getName(), null); statisticsMonitor.incrementResponse(); } publish(outputEventAdaptorMessageConfiguration, message, outputEventAdaptorConfiguration, tenantId); }