Example usage for org.apache.commons.collections MapUtils debugPrint

List of usage examples for org.apache.commons.collections MapUtils debugPrint

Introduction

In this page you can find the example usage for org.apache.commons.collections MapUtils debugPrint.

Prototype

public static void debugPrint(final PrintStream out, final Object label, final Map map) 

Source Link

Document

Prints the given map with nice line breaks.

Usage

From source file:com.mmone.gpdati.config.GpDatiDbRoomMap.java

public void debugPrint() {
    MapUtils.debugPrint(System.out, "GpDatiRoomRecords", this);
}

From source file:com.expedia.tesla.tools.mojo.CompileMojo.java

@Override
public void execute() throws MojoExecutionException {
    Log log = getLog();/*from www .  j  a  v  a2  s .c o m*/

    log.info("Generating source code from Tesla schemas.");
    log.debug(String.format("language: %s", language));
    log.debug(String.format("outputDir: %s", outputDir));
    log.debug(String.format("classTemplate: %s", classTemplate));
    log.debug(String.format("enumTemplate: %s", enumTemplate));
    log.debug(String.format("serializerTemplate: %s", serializerTemplate));
    log.debug(String.format("generateTypes: %s", generateTypes ? "yes" : "no"));
    PrintStream os = new PrintStream(new ByteArrayOutputStream());
    MapUtils.debugPrint(os, null, extension);
    log.debug(String.format("extension: %s", os.toString()));
    try {
        Compiler compiler = new Compiler();
        compiler.setLanguage(language);
        compiler.setOutputDir(outputDir);
        compiler.setAppSchemaClassName(serializerClassName);
        if (serializerTemplate != null) {
            compiler.setAppSchemaTemplatePath(serializerTemplate.getAbsolutePath());
        }
        compiler.setNotGenerateUserTypes(!generateTypes);
        if (classTemplate != null) {
            compiler.setClassTemplatePath(classTemplate.getAbsolutePath());
        }
        if (enumTemplate != null) {
            compiler.setEnumTemplatePath(enumTemplate.getAbsolutePath());
        }
        compiler.setExtension(extension);
        compiler.setSchemaFiles(getTmlFiles());
        compiler.compile();
    } catch (Exception e) {
        throw new MojoExecutionException("Failed to generate Tesla schema from Java.", e);
    }
    log.info("Generated source code from Tesla schemas successfully.");
}

From source file:org.apache.metron.indexing.dao.UpdateIntegrationTest.java

protected void findUpdatedDoc(Map<String, Object> message0, String guid, String sensorType)
        throws InterruptedException, IOException, OriginalNotFoundException {
    for (int t = 0; t < MAX_RETRIES; ++t, Thread.sleep(SLEEP_MS)) {
        Document doc = getDao().getLatest(guid, sensorType);
        if (doc != null && message0.equals(doc.getDocument())) {
            return;
        }/*from w ww  .j a  va2s.c o  m*/
        if (t == MAX_RETRIES - 1) {
            MapUtils.debugPrint(System.out, "Expected", message0);
            MapUtils.debugPrint(System.out, "actual", doc.getDocument());
        }
    }
    throw new OriginalNotFoundException("Count not find " + guid + " after " + MAX_RETRIES + " tries");
}

From source file:org.bml.util.errorconsumer.ParseErrorTable.java

/**
 * <p>/*from  ww w  .  j a v  a2s  .c  o m*/
 * Returns a log printable report on the variables found in this class.
 * Helpful when modifying the table.
 * </p>
 *
 * @return A {@link String} report on the variables in this class
 */
private static final String report() {
    //Prefer Writer for MapUtils.
    ByteArrayOutputStream oStream = new ByteArrayOutputStream();
    PrintStream pStream = new PrintStream(oStream);
    //StringWriter buff = new StringWriter();
    String nl = CharacterUtils.NL;
    //Class Info
    pStream.append("Class : ").append(ParseErrorTable.class.getCanonicalName()).append(nl);
    //Type Info
    pStream.append("Type : mini ORM").append(nl);
    //Table Name
    pStream.append("TABLE_NAME : ").append(TABLE_NAME).append(nl);
    //Table Name
    pStream.append("Prepared Insert Statement : ").append(PREPARED_INSERT_SQL).append(nl);
    //COLUMN_TYPE_MAP
    MapUtils.debugPrint(pStream, "Colum To Class Map", COLUMN_TYPE_MAP);
    //COLUMN_PS_OFFSET_MAP
    MapUtils.debugPrint(pStream, "Colum To PreparedStatement Offset Map", COLUMN_PS_OFFSET_MAP);
    return oStream.toString();
}

From source file:org.janelia.saalfeldlab.confocallens.ConfocalLens.java

/**
 * @param args//from  ww  w .  j a va  2 s  .  c o m
 * @throws IOException
 */
public static void main(final String[] args) throws IOException {
    new ImageJ();

    //      final String dirStr = "/groups/saalfeld/home/saalfelds/experiments/fly-light-lens/20151214_SS_63X_brain_tiles/data_1/";
    //      final String dirStr = "/groups/saalfeld/home/saalfelds/experiments/fly-light-lens/chem tag 4X4 tile mosaic_scope3_60 percent overlap/data_1/";
    //      final String dirStr = "/groups/saalfeld/home/saalfelds/experiments/fly-light-lens/production data_scope 3_2 brains_5-tiles_63X/JRC_SS03173-20150731_21_A3~63x/";
    //      final String dirStr = "/groups/saalfeld/home/saalfelds/experiments/fly-light-lens/production data_scope 3_2 brains_5-tiles_63X/JRC_SS04421-20151124_32_J2~63x/";
    //      final String dirStr = "/misc/public/YoshiToStephan/DPX_Standard2013/lsm_files/lens-model-scope3/";
    final String dirStr = "/groups/saalfeld/home/saalfelds/experiments/fly-light-lens/JFRC2013/";

    //      final HashMap<String, Double> offsets = parseZOffset(dirStr + "TileConfiguration.registered.txt");
    final HashMap<String, Double> offsets = parseZOffset(dirStr + "TileConfiguration.txt");

    MapUtils.debugPrint(System.out, "offsets", offsets);

    //      createThickSliceStacks(dirStr, offsets, 50);

    /* warp all the stacks */
    final NonLinearCoordinateTransform t = new NonLinearCoordinateTransform();

    /* scope 1, 488 bead sample 2, uni */
    //      t.init("5 21 271.2386815264863 -6.924808125825673 -4.434068256732302 233.00418793311462 -27.374851578742586 -8.008158423473185 12.179381717756572 20.28836382146438 6.877631923416217 24.881948711626595 136.33125853489986 43.24330351615581 -11.143516851877518 -20.672896050264118 -14.492819903327248 -7.917012603257609 -3.26513908592198 -9.71638091578189 -161.88257951066578 -43.44992679288882 7.931047563395199 2.752074023612062 8.593248925372691 6.367113246135128 6.031898623981013 5.743157176672485 1.4138577669838774 -13.017082866412313 59.148392837148585 15.822323957399027 -1.1147102363990622 -1.0901781389751615 -4.5602917786216 -0.5711479156494389 -0.6271639501779036 -3.169744365773636 -2.4780291828920387 -0.9022301193316427 0.06769646097501081 5.365590602085669 5.9212868204309155 6.726627298912743 592.1217996270674 672.686690176101 428636.3453335664 385847.74219417153 512385.5146432042 3.3795391313914955E8 2.7587761757694E8 2.9020471687393916E8 4.149162677391383E8 2.802630564534509E11 2.1629883166012875E11 2.0644166886701486E11 2.333824043346479E11 3.4970660994268134E11 2.404765539412518E14 1.788705999761124E14 1.6145668413709447E14 1.6553029691288528E14 1.9583629892894506E14 3.032562414421666E14 100.0 279.33846628673655 244.702999756888 310702.8159160806 239926.15560713861 295245.2727527522 3.1180880335546005E8 2.3920341811379063E8 2.3325743201421535E8 3.1050768380134356E8 3.0546360933912085E11 2.3100991289608194E11 2.1563047595781842E11 2.2622844100692322E11 3.129414905277693E11 2.9698024476856106E14 2.2183005832579488E14 2.0172768638541856E14 2.0086827245389866E14 2.189195775609209E14 3.1001063112624194E14 0.0 1024 1024 ");

    //      /* scope 2, 488 bead sample 2 */
    //      t.init("5 21 275.00708763148475 -11.139685408555483 -4.140541727361453 244.29093531533175 12.327399203147909 13.362837484077662 10.293726422414576 20.094917955357786 5.080678062411163 10.389432710891034 -0.6663478517460337 -4.7203203235908 -9.190056018871427 -19.834822200716797 -11.916742839289967 -6.65407569628796 0.5695914097103469 8.398726034430965 -9.692101795574857 3.3173834453632622 7.039481117677278 3.094197736973138 6.99656910034272 6.062614465051103 4.649041625084109 3.7735112249464438 -2.4194928645745826 -19.058296881505754 3.617448184728817 -0.756516526721855 -0.8096442882598451 -1.5535400463445463 -4.615062632568589 0.1974805756872689 0.3162039933673517 -3.925193604414581 -2.4347854517432497 0.47097944201907593 1.5593917054968103 5.5416245658762096 5.72460255870257 6.478430714661979 572.4589049756667 647.8531577411305 407388.065789315 360395.34625858325 484071.711657639 3.182115332082573E8 2.5308714339881733E8 2.659135005499286E8 3.872531504201706E8 2.6248739738505603E11 1.961722820914984E11 1.856112175417529E11 2.112791571732785E11 3.2357491412661847E11 2.2451169351695247E14 1.6101911573825656E14 1.433697251114752E14 1.4699169644760428E14 1.757983505518449E14 2.7875398392452872E14 100.0 282.2775462943665 253.69155942177017 310683.8834023355 236067.00856988528 298749.8066398044 3.0943999828694516E8 2.310341882185777E8 2.266230326050317E8 3.092309742838464E8 3.014851058537322E11 2.21295008916895E11 2.0600766215870605E11 2.1767154588415765E11 3.084062906153737E11 2.919908397444367E14 2.1156362310008584E14 1.9148681221188747E14 1.9050483366754344E14 2.0909625549662756E14 3.0323377163816375E14 0.0 1024 1024 ");
    //
    //      /* scope 3, 488 bead sample 2 */
    //      t.init("5 21 272.37350218796735 -6.977288726826206 -3.3788751054650135 238.29231508257607 14.00886802258886 -0.7494910883826957 8.29732093899446 18.912823646245368 4.654849570844233 14.488197838914202 -10.606742262932414 26.483278640280602 -5.047700066073055 -23.638558537181414 -8.98031656633492 -7.4382190921780555 -1.525617172931728 1.7754254432517378 3.548272871999144 -27.83412119268638 3.4626799316685464 7.238328321804607 4.2179663308079824 7.464612812707223 2.620042057973432 5.000322733517441 0.6739496037252497 -18.27341280289409 -2.5132334717308753 10.704891572795944 0.4495730247402516 -3.2208441103158 -3.617446947064222 -0.8828047299368569 0.5470037972940389 -3.761631683953626 -1.5641666012697035 -0.5247804106944098 0.10342032978296789 7.416205254696918 6.091863696803091 6.6371467808887985 609.193308520589 663.7275077704338 448771.626907799 392027.98241478164 501293.0905595468 3.5774501388206357E8 2.8548659347470474E8 2.9237194664537406E8 4.0360499465551734E8 2.9873032194013727E11 2.2642813090171606E11 2.1197972553220746E11 2.3371746587002502E11 3.388210867553165E11 2.5740592942854034E14 1.885928607061954E14 1.6783124357373203E14 1.6904944651906547E14 1.9526459319744047E14 2.930096173503559E14 100.0 278.6709037347945 246.49687875776652 311989.2190922388 241444.68876169334 295852.9254177533 3.144811583933858E8 2.411909896476592E8 2.356686942112776E8 3.100136399737289E8 3.090631005867996E11 2.3342963289078918E11 2.1851572862651227E11 2.287085381068669E11 3.116262217952156E11 3.012338733010695E14 2.2458787135351028E14 2.0476291352290472E14 2.0392626408704006E14 2.2119276272483262E14 3.080638166121832E14 0.0 1024 1024 ");
    //
    //      /* scope 4, 488 bead sample 2 */
    //      t.init("5 21 272.2089176827366 -5.362659565186543 -3.6422912675203225 232.57738712778476 11.900601049645358 -11.303980606138015 8.810695698650765 17.031782716697517 6.013115364411233 21.563444299809987 -7.794886007437309 48.91949554585729 -5.350702047330341 -18.835436045572248 -11.737178353743445 -3.306434636908744 -3.0469938119582203 -25.356590567293537 3.4487589744448837 -49.369289120733384 3.9148477486446343 3.8652316721921256 4.729163814714742 2.975724736840931 6.034807909215186 2.008719167339141 0.9404895742691757 16.323398816541236 -3.294049092872898 18.159592520963812 -0.25818751230321624 -2.0279866234886055 -3.2310391671095795 0.3658722466986797 0.13394311736086761 -2.3273754407218545 -2.9565501446567652 0.3045730769881594 0.45046667707225563 -6.440258431426812 5.95463036799349 6.789190286921475 595.4682806639242 678.9298836199393 431944.95657900727 392209.2552717204 519344.1460237457 3.4085478811244404E8 2.806796751059835E8 2.965302088551915E8 4.217150394783372E8 2.827454413063175E11 2.1992167957638223E11 2.1116191549802722E11 2.3938172641439075E11 3.5613692469625616E11 2.4258212579961747E14 1.8169411229498978E14 1.6506117036639638E14 1.7013690636416856E14 2.0148491529393434E14 3.092910768302986E14 100.0 278.14483725428136 241.66075313066017 310115.40675494046 239448.00601350315 293974.30476588255 3.115000091415553E8 2.396696086438358E8 2.3494620689395142E8 3.1047807264560765E8 3.0523526279864966E11 2.322380045679693E11 2.1854793109783646E11 2.2944777648127225E11 3.1379065339573883E11 2.9679171068230844E14 2.2362313854965066E14 2.0560406236342038E14 2.0553276224084547E14 2.2314465797220428E14 3.1149813920417856E14 0.0 1024 1024 ");
    //
    //      /* scope 5, 488 bead sample 2 */
    //      t.init("5 21 275.4620259585938 -8.274225793226783 -4.366834611965939 230.92028316782722 17.5549711714565 1.2333581700214005 10.6624539177166 20.314408641959385 7.134233079529592 70.2911260871703 -13.488188917167573 20.7255678790983 -8.233597866739565 -21.414190232937024 -12.929409293508245 -8.179800570811404 -4.019603283420243 -133.7646021059477 2.285566110542705 -20.862517086331465 5.360615295370124 4.934852747275175 6.61685858130141 5.503257336297984 6.02029157781311 6.595777515918128 1.6167167305764032 112.30836349435012 -0.6672431671939423 7.727498555199549 -0.0808873355586277 -2.4490094386803904 -4.348315693326248 0.47344948265789766 0.31957753766547625 -3.8678136437988253 -3.0446836794358614 -0.9174006443547995 0.29003131168815743 -36.974769814152964 5.933011931273617 6.639710568325525 593.3029040291742 663.9858982768143 432089.0484605273 379539.2496382174 501794.2708387128 3.425813162192174E8 2.72000828673075E8 2.8231933651536024E8 4.0445622327554125E8 2.853930319112766E11 2.1389443453045795E11 2.0080617521702972E11 2.2554475706238968E11 3.399543394251531E11 2.457593129770862E14 1.773680842159039E14 1.5724309801335722E14 1.5966349300709116E14 1.8848128779636122E14 2.943201855726999E14 100.0 282.98908582271054 246.8169421235319 314157.1051142011 238238.59626720686 296916.10288468347 3.151750170384452E8 2.367918313855536E8 2.3080000076104975E8 3.1115282830493146E8 3.089046306999969E11 2.2863364012537628E11 2.121895559401523E11 2.2307248931215247E11 3.126028699801232E11 3.0061153380831844E14 2.1973340088406256E14 1.9823341971596162E14 1.9673892789781494E14 2.1506278801101494E14 3.0880537560608056E14 0.0 1024 1024 ");
    //
    //      /* scope 6, chemcical, z=250 */
    t.init("5 21 265.3552814678547 -9.46667068228438 -4.531760742006943 239.37726894197888 22.858328199010067 12.577412433666721 9.975689928417305 16.35325129865469 9.650389592551617 36.16151963840831 -17.244014738564207 -10.634169785166533 -7.298201392062338 -15.37001738770205 -11.616095930236812 -2.651601920760191 -11.547677405817334 -51.422129456488506 4.2284172035821666 14.066659062796418 4.574271409908075 2.0346108475675018 6.327703558886167 -0.1867516216106493 4.66024082852573 3.098814637577937 9.435288465289805 38.46100321049568 -2.2137394043142162 -6.312635013840618 -0.5157633863136688 -1.4507276842512062 -2.7121668017568448 1.5113537249434053 -0.9037087898330007 -1.3848042937070646 -1.857603111460449 -0.5318306705492479 -2.6272063051772587 -14.671304256902848 5.503570021583938 6.5815444429589665 550.3611303987366 658.1659554903936 378587.47791847424 353367.6744855716 496668.64115102845 2.878994708513267E8 2.3964678240518382E8 2.6408401718693027E8 4.0013589260626554E8 2.3241774823386978E11 1.8063404955169467E11 1.7776898337858954E11 2.117299481573544E11 3.360791915126304E11 1.9539835409852516E14 1.4493774500636447E14 1.3324672546785247E14 1.4183003173533994E14 1.7734286817446294E14 2.9067462900420606E14 100.0 275.12560452535257 251.97136023872915 298486.1321366977 230006.6555085441 299005.3010550548 2.9372703781410813E8 2.2138110056354192E8 2.2053311689287165E8 3.1111484269634515E8 2.840251131113193E11 2.090331229438189E11 1.9579593692097876E11 2.1195446019972284E11 3.115882961767197E11 2.7379440754202656E14 1.9784325948288825E14 1.7858717429114544E14 1.8015632128486216E14 2.037798417056104E14 3.074332037689868E14 0.0 1024 1024 ");
    //
    //      /* scope 6, 488 bead sample 2 */
    //      t.init("5 21 280.3176302296068 -3.385500206352602 -3.7519543456863444 234.05360742201415 21.86044208884239 -25.33729272176778 9.962766065781112 19.53558330886945 5.698547694850178 29.73952864508074 -24.880443681508297 80.99492622318942 -7.676926708775573 -19.85014113084698 -10.823899581558482 -7.26759120384647 -2.433509834937632 -45.23739518521777 18.40744061515936 -82.49519029555023 4.558792132666577 3.4857547233689656 6.201172287417641 5.051231576142243 3.4402802203510503 5.61635943070016 0.872811035679921 35.844272605571255 -8.205398636993525 30.629338026115203 0.008990621125698053 -1.7999810346485183 -3.825696624810304 0.5384603530357505 0.3394988331198708 -3.8199799128661303 -2.011995289645857 -0.47316085215824044 0.3859566568328465 -14.125504078574016 5.35755336868603 6.691114417249501 535.7550737674019 669.1291888070809 370637.10173164547 353671.23907442193 507300.738285688 2.8556188880006105E8 2.428992761420499E8 2.6693126360931328E8 4.092058741416693E8 2.3383642022820236E11 1.863825193379618E11 1.828707739197425E11 2.148918809417319E11 3.43703809565968E11 1.9919914577640912E14 1.5222196286293734E14 1.4013301498162928E14 1.470458889820503E14 1.8027989697641056E14 2.971418526163287E14 100.0 289.146186011741 244.0660378637486 310590.99751716095 240392.9110748359 293856.67867026466 3.047508326417509E8 2.3528682412719136E8 2.2808033041541114E8 3.0823655752054083E8 2.942467159036665E11 2.2398145975596472E11 2.086314238794212E11 2.1836264471667712E11 3.1012820193733734E11 2.833532011081974E14 2.1293395708478206E14 1.9358700279443456E14 1.9218041393801694E14 2.0961728023903934E14 3.068523509203397E14 0.0 1024 1024 ");
    //
    //      /* scope X, chemical, z=250 */
    //      t.init("5 21 265.3552814678547 -9.46667068228438 -4.531760742006943 239.37726894197888 22.858328199010067 12.577412433666721 9.975689928417305 16.35325129865469 9.650389592551617 36.16151963840831 -17.244014738564207 -10.634169785166533 -7.298201392062338 -15.37001738770205 -11.616095930236812 -2.651601920760191 -11.547677405817334 -51.422129456488506 4.2284172035821666 14.066659062796418 4.574271409908075 2.0346108475675018 6.327703558886167 -0.1867516216106493 4.66024082852573 3.098814637577937 9.435288465289805 38.46100321049568 -2.2137394043142162 -6.312635013840618 -0.5157633863136688 -1.4507276842512062 -2.7121668017568448 1.5113537249434053 -0.9037087898330007 -1.3848042937070646 -1.857603111460449 -0.5318306705492479 -2.6272063051772587 -14.671304256902848 5.503570021583938 6.5815444429589665 550.3611303987366 658.1659554903936 378587.47791847424 353367.6744855716 496668.64115102845 2.878994708513267E8 2.3964678240518382E8 2.6408401718693027E8 4.0013589260626554E8 2.3241774823386978E11 1.8063404955169467E11 1.7776898337858954E11 2.117299481573544E11 3.360791915126304E11 1.9539835409852516E14 1.4493774500636447E14 1.3324672546785247E14 1.4183003173533994E14 1.7734286817446294E14 2.9067462900420606E14 100.0 275.12560452535257 251.97136023872915 298486.1321366977 230006.6555085441 299005.3010550548 2.9372703781410813E8 2.2138110056354192E8 2.2053311689287165E8 3.1111484269634515E8 2.840251131113193E11 2.090331229438189E11 1.9579593692097876E11 2.1195446019972284E11 3.115882961767197E11 2.7379440754202656E14 1.9784325948288825E14 1.7858717429114544E14 1.8015632128486216E14 2.037798417056104E14 3.074332037689868E14 0.0 1024 1024 ");

    /* scope 3, chemical, z=150 */
    //      t.init("5 21 265.6307143127233 -9.130056188368174 -5.042534502175269 285.04252007260436 16.73750463611927 8.687376653986409 10.115997261395686 15.420559476744526 9.023895052786482 22.821906826633317 -11.529566512492051 1.4000481520338184 -7.246043792423219 -13.939336757579941 -11.91361713152407 -3.1591756660950754 -8.641052066680258 -22.680446946664638 -0.7356219693276049 -2.196917800709194 3.375523369800531 0.4539356754922039 7.612048812901785 2.2811499578695624 4.595327352940267 1.8899066385111287 6.801776782400479 11.777216765250174 1.7810157593166003 1.0785643897196024 0.6865956787357633 -0.39895368665555164 -4.120482963135277 0.3081569949647477 -0.48676918230487964 -1.6517350116837806 -1.9910132841425692 0.1719597431666795 -1.781006585768337 -5.039542303265364 3.98118187165964 6.084927267255223 398.1132481342764 608.4999799578544 233377.64113242135 243931.7229618072 457591.35727234953 1.6407630730792004E8 1.4431750089423496E8 1.839906145493179E8 3.738953280525476E8 1.2789121253936269E11 1.0215596658039322E11 1.0935180677452296E11 1.505606297400481E11 3.1923073603342224E11 1.0611278880000802E14 7.993067470049967E13 7.76977922690329E13 8.967036665094672E13 1.2863916133117648E14 2.801306764577319E14 100.0 273.66777413450376 295.51895782047615 270991.6074233788 223284.92152850868 331445.9034230781 2.5433458201219186E8 2.0031821110479888E8 2.069616917160562E8 3.32811174009026E8 2.386302151222804E11 1.8273372946067606E11 1.7584555817430225E11 1.9374160646313586E11 3.265268357885264E11 2.253879526293362E14 1.6916041762775225E14 1.5750945002548253E14 1.599289099141636E14 1.829640463375873E14 3.186985651267883E14 0.0 1024 1024 ");
    saveTransformedImages(dirStr, offsets.keySet(), dirStr + "scope6x/", t, 16);
}

From source file:org.nuxeo.connect.update.task.standalone.AbstractTask.java

@Override
@SuppressWarnings("hiding")
public void initialize(LocalPackage pkg, boolean restart) throws PackageException {
    this.pkg = pkg;
    this.restart = restart;
    env.put(PKG_ID, pkg.getId());// ww w . ja v  a  2 s .  c  om
    env.put(PKG_NAME, pkg.getName());
    env.put(PKG_VERSION, pkg.getVersion().toString());
    env.put(PKG_ROOT, pkg.getData().getRoot().getAbsolutePath());

    if (log.isDebugEnabled()) {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final PrintStream outPrint = new PrintStream(out);
        MapUtils.debugPrint(outPrint, null, env);
        log.debug(out.toString());
    }
}

From source file:org.opendaylight.ovsdb.lib.message.OVSDBNettyFactoryIT.java

@Test
public void testSome() throws InterruptedException, ExecutionException, IOException {
    ConnectionService connectionService = new ConnectionService();
    connectionService.init();/*  w ww  .  j a  v  a 2 s  .c om*/
    inventoryService = new InventoryService();
    inventoryService.init();
    connectionService.setInventoryServiceInternal(inventoryService);
    Node.NodeIDType.registerIDType("OVS", String.class);
    Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
    params.put(ConnectionConstants.ADDRESS, props.getProperty("ovsdbserver.ipaddress"));
    params.put(ConnectionConstants.PORT, props.getProperty("ovsdbserver.port", "6640"));
    Node node = connectionService.connect("TEST", params);
    if (node == null) {
        throw new IOException("Unable to connect to the host");
    }

    Connection connection = connectionService.getConnection(node);
    if (connection == null) {
        throw new IOException("Unable to connect to the host");
    }

    OvsdbRPC ovsdb = connection.getRpc();
    if (ovsdb == null) {
        throw new IOException("Unable to obtain RPC instance");
    }

    //GET DB-SCHEMA
    List<String> dbNames = Arrays.asList(Open_vSwitch.NAME.getName());
    ListenableFuture<DatabaseSchema> dbSchemaF = ovsdb.get_schema(dbNames);
    DatabaseSchema databaseSchema = dbSchemaF.get();
    MapUtils.debugPrint(System.out, null, databaseSchema.getTables());

    // TEST MONITOR
    // YES it is expected to fail with "duplicate monitor ID" as we have a perpetual monitor in Inventory Service
    MonitorRequestBuilder monitorReq = new MonitorRequestBuilder();
    for (Table<?> table : Tables.getTables()) {
        monitorReq.monitor(table);
    }

    ListenableFuture<TableUpdates> monResponse = ovsdb.monitor(monitorReq);
    System.out.println("Monitor Request sent :");
    TableUpdates updates = monResponse.get();
    inventoryService.processTableUpdates(node, updates);
    inventoryService.printCache(node);

    // TRANSACT INSERT TEST

    Map<String, Table<?>> ovsTable = inventoryService.getTableCache(node, Open_vSwitch.NAME.getName());
    String newBridge = "new_bridge";
    String newInterface = "new_interface";
    String newPort = "new_port";
    String newSwitch = "new_switch";

    Operation addSwitchRequest = null;

    if (ovsTable != null) {
        String ovsTableUUID = (String) ovsTable.keySet().toArray()[0];
        UUID bridgeUuidPair = new UUID(newBridge);
        Mutation bm = new Mutation("bridges", Mutator.INSERT, bridgeUuidPair);
        List<Mutation> mutations = new ArrayList<Mutation>();
        mutations.add(bm);

        UUID uuid = new UUID(ovsTableUUID);
        Condition condition = new Condition("_uuid", Function.EQUALS, uuid);
        List<Condition> where = new ArrayList<Condition>();
        where.add(condition);
        addSwitchRequest = new MutateOperation(Open_vSwitch.NAME.getName(), where, mutations);
    } else {
        Open_vSwitch ovsTableRow = new Open_vSwitch();
        OvsDBSet<UUID> bridges = new OvsDBSet<UUID>();
        UUID bridgeUuidPair = new UUID(newBridge);
        bridges.add(bridgeUuidPair);
        ovsTableRow.setBridges(bridges);
        addSwitchRequest = new InsertOperation(Open_vSwitch.NAME.getName(), newSwitch, ovsTableRow);
    }

    Bridge bridgeRow = new Bridge();
    bridgeRow.setName(bridgeIdentifier);
    OvsDBSet<UUID> ports = new OvsDBSet<UUID>();
    UUID port = new UUID(newPort);
    ports.add(port);
    bridgeRow.setPorts(ports);
    InsertOperation addBridgeRequest = new InsertOperation(Bridge.NAME.getName(), newBridge, bridgeRow);

    Port portRow = new Port();
    portRow.setName(bridgeIdentifier);
    OvsDBSet<UUID> interfaces = new OvsDBSet<UUID>();
    UUID interfaceid = new UUID(newInterface);
    interfaces.add(interfaceid);
    portRow.setInterfaces(interfaces);
    InsertOperation addPortRequest = new InsertOperation(Port.NAME.getName(), newPort, portRow);

    Interface interfaceRow = new Interface();
    interfaceRow.setName(bridgeIdentifier);
    interfaceRow.setType("internal");
    InsertOperation addIntfRequest = new InsertOperation(Interface.NAME.getName(), newInterface, interfaceRow);

    TransactBuilder transaction = new TransactBuilder();
    transaction.addOperations(new ArrayList<Operation>(
            Arrays.asList(addSwitchRequest, addIntfRequest, addPortRequest, addBridgeRequest)));

    ListenableFuture<List<OperationResult>> transResponse = ovsdb.transact(transaction);
    System.out.println("Transcation sent :");
    List<OperationResult> tr = transResponse.get();
    System.out.println("Transaction response : " + transResponse.toString());
    List<Operation> requests = transaction.getRequests();
    for (int i = 0; i < tr.size(); i++) {
        if (i < requests.size())
            requests.get(i).setResult(tr.get(i));
    }

    System.out.println("Request + Response : " + requests.toString());
    if (tr.size() > requests.size()) {
        System.out.println("ERROR : " + tr.get(tr.size() - 1).getError());
        System.out.println("Details : " + tr.get(tr.size() - 1).getDetails());
    }

    // TEST ECHO

    ListenableFuture<List<String>> some = ovsdb.echo();
    Object s = some.get();
    System.out.printf("Result of echo is %s \n", s);

    // TEST ECHO REQUEST/REPLY
    Thread.sleep(10000);

    connectionService.disconnect(node);
}

From source file:org.opendaylight.ovsdb.plugin.NodeDB.java

public void printTableCache() {
    MapUtils.debugPrint(System.out, null, schema.getTables());
    MapUtils.debugPrint(System.out, null, cache);
}

From source file:org.openstreetmap.josm.plugins.PluginHandlerTestIT.java

/**
 * Test that available plugins rules can be loaded.
 *///  w w w . j a  v a 2 s  .co m
@Test
public void testValidityOfAvailablePlugins() {
    // Download complete list of plugins
    ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
            Main.pref.getOnlinePluginSites());
    pluginInfoDownloadTask.run();
    List<PluginInformation> plugins = pluginInfoDownloadTask.getAvailablePlugins();
    System.out.println("Original plugin list contains " + plugins.size() + " plugins");
    assertFalse(plugins.isEmpty());
    PluginInformation info = plugins.get(0);
    assertFalse(info.getName().isEmpty());
    assertFalse(info.getClass().getName().isEmpty());

    // Filter deprecated and unmaintained ones, or those not responsive enough to match our continuous integration needs
    List<String> uncooperatingPlugins = Arrays.asList("ebdirigo", "scoutsigns", "josm-config");
    Set<String> deprecatedPlugins = PluginHandler.getDeprecatedAndUnmaintainedPlugins();
    for (Iterator<PluginInformation> it = plugins.iterator(); it.hasNext();) {
        PluginInformation pi = it.next();
        if (deprecatedPlugins.contains(pi.name) || uncooperatingPlugins.contains(pi.name)) {
            System.out.println("Ignoring " + pi.name + " (deprecated, unmaintained, or uncooperative)");
            it.remove();
        }
    }
    System.out.println("Filtered plugin list contains " + plugins.size() + " plugins");

    // Download plugins
    downloadPlugins(plugins);

    // Load early plugins
    PluginHandler.loadEarlyPlugins(null, plugins, null);

    // Load late plugins
    PluginHandler.loadLatePlugins(null, plugins, null);

    Map<String, Throwable> loadingExceptions = PluginHandler.pluginLoadingExceptions.entrySet().stream()
            .collect(Collectors.toMap(e -> e.getKey(), e -> ExceptionUtils.getRootCause(e.getValue())));

    // Add/remove layers twice to test basic plugin good behaviour
    Map<String, Throwable> layerExceptions = new HashMap<>();
    List<PluginInformation> loadedPlugins = PluginHandler.getPlugins();
    for (int i = 0; i < 2; i++) {
        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer " + i, null);
        testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
        testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    }
    for (int i = 0; i < 2; i++) {
        GpxLayer layer = new GpxLayer(new GpxData());
        testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
        testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    }

    MapUtils.debugPrint(System.out, null, loadingExceptions);
    MapUtils.debugPrint(System.out, null, layerExceptions);
    String msg = Arrays.toString(loadingExceptions.entrySet().toArray()) + '\n'
            + Arrays.toString(layerExceptions.entrySet().toArray());
    assertTrue(msg, loadingExceptions.isEmpty() && layerExceptions.isEmpty());
}

From source file:org.pentaho.platform.util.StringUtil.java

/**
 * Returns the provided {@link Map} as a pretty string, using the system dependent new like character as the
 * key-value pair separator, and ' -> ' as the individual key and value separator.
 *
 * @param map the {@link Map} to be converted to a string
 * @return a pretty {@link String} representation of the {@link Map}
 *//* www.  ja  v  a  2  s .  co  m*/
public static String getMapAsPrettyString(final Map map) {
    final ByteArrayOutputStream writtenBytes = new ByteArrayOutputStream();
    MapUtils.debugPrint(new PrintStream(writtenBytes), "Map", map);
    return writtenBytes.toString();
}