Example usage for java.util Arrays deepToString

List of usage examples for java.util Arrays deepToString

Introduction

In this page you can find the example usage for java.util Arrays deepToString.

Prototype

public static String deepToString(Object[] a) 

Source Link

Document

Returns a string representation of the "deep contents" of the specified array.

Usage

From source file:org.richfaces.tests.metamer.ftest.richTree.AbstractTreeSelectionTest.java

protected void testSubNodesSelectionWithEvents() {
    expandAll();//from ww  w . j  a  v  a2  s  .co  m
    assertEquals(allSelectedItems.size(), 0);
    boolean checkEvents = selectionType.equals(eventEnabledSelectionTypes[0]);
    Integer[] old = null;
    for (Integer[] path : selectionPaths) {
        treeNode = null;
        for (int index : path) {
            treeNode = (treeNode == null) ? tree.advanced().getNodes().get(index)
                    : treeNode.advanced().getNodes().get(index);
        }
        String previousSelectionValue = selection.getText();
        assertFalse(treeNode.advanced().isSelected());
        jsUtils.scrollToView(treeNode.advanced().getLabelElement());
        getGuarded(treeNode.advanced(), selectionType).select();

        assertTrue(treeNode.advanced().isSelected());
        assertEquals(allSelectedItems.size(), 1);

        if (checkEvents) {
            // there is delay before select triggers output update
            Graphene.waitAjax().until().element(selection).text().not().equalTo(previousSelectionValue);

            assertEquals(getSelection(), path,
                    String.format("Actual Selection (%s) doesn't correspond to expected (%s)",
                            Arrays.deepToString(getSelection()), Arrays.deepToString(path)));

            assertEquals(getNewSelection(), path,
                    String.format("Actual New selection (%s) doesn't correspond to expected (%s)",
                            Arrays.deepToString(getNewSelection()), Arrays.deepToString(path)));
            if (old != null) {
                assertEquals(getOldSelection(), old,
                        String.format("Actual Old selection (%s) doesn't correspond to expected (%s)",
                                Arrays.deepToString(getOldSelection()), Arrays.deepToString(old)));
            } else {
                assertEquals(oldSelection.getText(), "[]");
            }
            old = getNewSelection();
        }
    }
}

From source file:de.kopis.glacier.parsers.GlacierUploaderOptionParserTest.java

@Test
public void hasActionOptionCreateVault() {
    final String[] newArgs = Arrays.copyOf(args, args.length + 1);
    newArgs[newArgs.length - 1] = "--create";

    final OptionSet optionSet = optionsParser.parse(newArgs);
    assertTrue("Option 'create' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            optionSet.has("create"));
}

From source file:org.apache.sqoop.connector.idf.TestJSONIntermediateDataFormat.java

private void assertObjectArray() {
    Object[] out = dataFormat.getObjectData();
    assertEquals(10L, out[0]);//from   w ww  . ja v  a 2 s.  com
    assertEquals(34, out[1]);
    assertEquals("54", out[2]);
    assertEquals("random data", out[3]);
    assertEquals(-112, ((byte[]) out[4])[0]);
    assertEquals(54, ((byte[]) out[4])[1]);
    assertEquals("10", out[5]);
    assertEquals("ENUM", out[6]);

    Object[] givenArrayOne = new Object[2];
    givenArrayOne[0] = 11;
    givenArrayOne[1] = 11;
    Object[] givenArrayTwo = new Object[2];
    givenArrayTwo[0] = 14;
    givenArrayTwo[1] = 15;
    Object[] arrayOfArrays = new Object[2];
    arrayOfArrays[0] = givenArrayOne;
    arrayOfArrays[1] = givenArrayTwo;
    Map<Object, Object> map = new HashMap<Object, Object>();
    map.put("testKey", "testValue");
    // no time zone
    LocalDateTime dateTime = new org.joda.time.LocalDateTime(2014, 10, 01, 12, 0, 0);
    org.joda.time.LocalTime time = new org.joda.time.LocalTime(12, 59, 59);
    org.joda.time.LocalDate date = new org.joda.time.LocalDate(2014, 10, 01);
    Object[] set0 = new Object[2];
    set0[0] = 11;
    set0[1] = 12;
    Object[] set1 = new Object[2];
    set1[0] = 14;
    set1[1] = 15;
    Object[] set = new Object[2];
    set[0] = set0;
    set[1] = set1;
    out[14] = set;
    assertEquals(arrayOfArrays.length, 2);
    assertEquals(Arrays.deepToString(arrayOfArrays), Arrays.deepToString((Object[]) out[7]));
    assertEquals(map, out[8]);
    assertEquals(true, out[9]);
    assertEquals(dateTime, out[10]);
    assertEquals(time, out[11]);
    assertEquals(date, out[12]);
    assertEquals(13.44f, out[13]);
    assertEquals(set.length, 2);
    assertEquals(Arrays.deepToString(set), Arrays.deepToString((Object[]) out[14]));

}

From source file:de.kopis.glacier.parsers.GlacierUploaderOptionParserTest.java

@Test
public void hasActionOptionDeleteArchive() {
    final String[] newArgs = Arrays.copyOf(args, args.length + 2);
    newArgs[newArgs.length - 2] = "--delete";
    newArgs[newArgs.length - 1] = "myarchiveid";

    final OptionSet optionSet = optionsParser.parse(newArgs);
    assertTrue("Option 'delete' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            optionSet.has("delete"));
    assertEquals("Value of option 'delete' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            "myarchiveid", optionSet.valueOf("delete"));
}

From source file:org.apache.zeppelin.submarine.hadoop.YarnClient.java

public void deleteService(String serviceName) {
    String appUrl = this.yarnWebHttpAddr + "/app/v1/services/" + serviceName + "?_="
            + System.currentTimeMillis();

    InputStream inputStream = null;
    try {/*  www  .  j av  a 2  s . com*/
        HttpResponse response = callRestUrl(appUrl, principal, HTTP.DELETE);
        inputStream = response.getEntity().getContent();
        String result = new BufferedReader(new InputStreamReader(inputStream)).lines()
                .collect(Collectors.joining(System.lineSeparator()));
        if (response.getStatusLine().getStatusCode() != 200 /*success*/) {
            LOGGER.warn("Status code " + response.getStatusLine().getStatusCode());
            LOGGER.warn("message is :" + Arrays.deepToString(response.getAllHeaders()));
            LOGGER.warn("result\n" + result);
        }
    } catch (Exception exp) {
        exp.printStackTrace();
    } finally {
        try {
            if (null != inputStream) {
                inputStream.close();
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
}

From source file:org.wrml.runtime.schema.SchemaBuilder.java

public SchemaBuilder slots(final Object... slots) {

    if (slots == null) {
        throw new IllegalArgumentException("The slots cannot be null.");
    }//from   ww w.  j a  v  a2s.c om

    if ((slots.length % 2) != 0) {
        throw new IllegalArgumentException(
                "The slots must be in name/value pair order. Slots: " + Arrays.deepToString(slots));
    }

    for (int i = 0; i < slots.length; i++) {

        if (!(slots[i] instanceof String)) {
            throw new IllegalArgumentException(
                    "The slot's _definition_ array must contain a (String) name and (Object) value. Slots: "
                            + Arrays.deepToString(slots));
        }

        final String slotName = (String) slots[i];

        i = i + 1;

        final Object slotValue = slots[i];

        slot(slotName, slotValue);
    }

    return this;
}

From source file:org.jasig.portal.utils.cache.CacheKey.java

@Override
public String toString() {
    int d = DEPTH.get();
    DEPTH.set(d + 1);/* w  ww  .  j  av a 2  s  .  co  m*/
    final String indent = StringUtils.leftPad("", DEPTH.get(), '\t');
    final String s = indent + "CacheKey [" + this.source + "\n\t" + indent + Arrays.deepToString(this.key)
            + "\n" + indent + "]";
    DEPTH.set(d);
    return s;
}

From source file:org.carracoo.maven.assist.AssistProcessor.java

private void debugClassLoader(final ClassPool classPool) {
    if (!logger.isLoggable(Level.INFO)) {
        return;// w ww  . j  a  v  a2  s .  co  m
    }

    logger.log(Level.FINE, String.format(" - classPool: %s", classPool.toString()));
    ClassLoader classLoader = classPool.getClassLoader();
    while (classLoader != null) {
        logger.log(Level.INFO,
                String.format(" -- %s : %s", classLoader.getClass().getName(), classLoader.toString()));
        if (classLoader instanceof URLClassLoader) {
            logger.log(Level.INFO, String.format(" --- urls: %s ",
                    Arrays.deepToString(((URLClassLoader) classLoader).getURLs())));
        }
        classLoader = classLoader.getParent();
    }
}

From source file:org.omnaest.utils.table.impl.StripeImpl.java

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("StripeImpl [isDeleted=");
    builder.append(this.isDeleted);
    builder.append(", isModified=");
    builder.append(this.isModified);
    builder.append(", elements=");
    builder.append(Arrays.deepToString(this.getElements()));
    builder.append("]");
    return builder.toString();
}

From source file:org.apache.sqoop.connector.idf.TestAVROIntermediateDataFormat.java

private void assertObjectArray() {
    Object[] out = dataFormat.getObjectData();
    assertEquals(10L, out[0]);//from  w w w.  ja v a2 s .  c  o m
    assertEquals(34, out[1]);
    assertEquals("54", out[2]);
    assertEquals("random data", out[3]);
    assertEquals(-112, ((byte[]) out[4])[0]);
    assertEquals(54, ((byte[]) out[4])[1]);
    assertEquals("10", out[5]);
    assertEquals("ENUM", out[6]);

    Object[] givenArrayOne = new Object[2];
    givenArrayOne[0] = 11;
    givenArrayOne[1] = 11;
    Object[] givenArrayTwo = new Object[2];
    givenArrayTwo[0] = 14;
    givenArrayTwo[1] = 15;
    Object[] arrayOfArrays = new Object[2];
    arrayOfArrays[0] = givenArrayOne;
    arrayOfArrays[1] = givenArrayTwo;
    Map<Object, Object> map = new HashMap<Object, Object>();
    map.put("testKey", "testValue");
    Object[] set0 = new Object[2];
    set0[0] = 11;
    set0[1] = 12;
    Object[] set1 = new Object[2];
    set1[0] = 14;
    set1[1] = 15;
    Object[] set = new Object[2];
    set[0] = set0;
    set[1] = set1;
    out[14] = set;
    assertEquals(arrayOfArrays.length, 2);
    assertEquals(Arrays.deepToString(arrayOfArrays), Arrays.deepToString((Object[]) out[7]));
    assertEquals(map, out[8]);
    assertEquals(true, out[9]);
    assertEquals(dateTime, out[10]);
    assertEquals(time, out[11]);
    assertEquals(date, out[12]);
    assertEquals(13.44f, out[13]);
    assertEquals(set.length, 2);
    assertEquals(Arrays.deepToString(set), Arrays.deepToString((Object[]) out[14]));

}