Example usage for org.apache.commons.lang ArrayUtils clone

List of usage examples for org.apache.commons.lang ArrayUtils clone

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils clone.

Prototype

public static boolean[] clone(boolean[] array) 

Source Link

Document

Clones an array returning a typecast result and handling null.

Usage

From source file:org.jumpmind.symmetric.io.data.writer.DatabaseWriterTest.java

@Test
public void testLargeDouble() throws Exception {
    String[] values = new String[TEST_COLUMNS.length];
    values[0] = getNextId();//ww  w. ja v  a  2 s .  c  o  m
    values[10] = "-0.0747663551401869";
    String[] expectedValues = (String[]) ArrayUtils.clone(values);
    massageExpectectedResultsForDialect(expectedValues);

    if (platform.getDatabaseInfo().isRequiredCharColumnEmptyStringSameAsNull()) {
        expectedValues[4] = AbstractDatabasePlatform.REQUIRED_FIELD_NULL_SUBSTITUTE;
    }

    writeData(new CsvData(DataEventType.INSERT, values), expectedValues);
}

From source file:org.jumpmind.symmetric.io.data.writer.DatabaseWriterTest.java

@Test
public void testDecimalLocale() throws Exception {
    String[] values = new String[TEST_COLUMNS.length];
    values[0] = getNextId();//w  ww.  ja  va2s .c o m
    values[10] = "123456,99";
    String[] expectedValues = (String[]) ArrayUtils.clone(values);
    massageExpectectedResultsForDialect(expectedValues);
    if (platform.getDatabaseInfo().isRequiredCharColumnEmptyStringSameAsNull()) {
        expectedValues[4] = AbstractDatabasePlatform.REQUIRED_FIELD_NULL_SUBSTITUTE;
    }
    writeData(new CsvData(DataEventType.INSERT, values), expectedValues);
}

From source file:org.jumpmind.symmetric.io.data.writer.DatabaseWriterTest.java

@Test
public void testStringEmpty() throws Exception {
    String[] values = new String[TEST_COLUMNS.length];
    values[0] = getNextId();//w ww .  j  av a  2  s.  c om
    if (!(platform instanceof AseDatabasePlatform)) {
        values[1] = values[2] = "";
    }
    values[3] = values[4] = "";
    String[] expectedValues = (String[]) ArrayUtils.clone(values);
    if (platform.getDatabaseInfo().isRequiredCharColumnEmptyStringSameAsNull()) {
        expectedValues[4] = null;
    }
    writeData(new CsvData(DataEventType.INSERT, values), expectedValues);
}

From source file:org.jumpmind.symmetric.io.data.writer.DatabaseWriterTest.java

@Test
public void testStringNull() throws Exception {
    String[] values = new String[TEST_COLUMNS.length];
    values[0] = getNextId();//w  w  w. j av a2s .  c om
    String[] expectedValues = (String[]) ArrayUtils.clone(values);
    if (platform.getDatabaseInfo().isRequiredCharColumnEmptyStringSameAsNull()) {
        expectedValues[4] = AbstractDatabasePlatform.REQUIRED_FIELD_NULL_SUBSTITUTE;
    }
    writeData(new CsvData(DataEventType.INSERT, values), expectedValues);
}

From source file:org.jumpmind.symmetric.io.data.writer.MsSqlBulkDatabaseWriterTest.java

@Test
public void testInsertReorderColumns() throws Exception {
    if (shouldTestRun(platform)) {
        String id = getNextId();/*  w ww.  j a  v  a 2  s . c  o m*/
        String[] values = { "string with space in it", "string-with-no-space", "string with space in it",
                "string-with-no-space", "2007-01-02 00:00:00.000", "2007-02-03 04:05:06.000", "0", "47",
                "67.89", "-0.0747663", encode("string with space in it"), id };
        List<CsvData> data = new ArrayList<CsvData>();
        data.add(new CsvData(DataEventType.INSERT, (String[]) ArrayUtils.clone(values)));
        Table table = (Table) platform.getTableFromCache(getTestTable(), false).clone();
        Column firstColumn = table.getColumn(0);
        table.removeColumn(firstColumn);
        table.addColumn(firstColumn);
        writeData(new MsSqlBulkDatabaseWriter(platform, stagingManager, new CommonsDbcpNativeJdbcExtractor(),
                1000, false, uncPath, null, null), new TableCsvData(table, data));
        values = (String[]) ArrayUtils.remove(values, values.length - 1);
        values = (String[]) ArrayUtils.add(values, 0, id);
        assertTestTableEquals(id, values);
    }
}

From source file:org.kuali.rice.krad.util.ErrorMessage.java

/**
 * Convenience constructor which sets both fields
 *
 * @param errorKey - message key for the error
 * @param messageParameters - zero or more parameters for the message text
 *//*from   w  w  w.  j a va2  s .com*/
public ErrorMessage(String errorKey, String... messageParameters) {
    if (StringUtils.isBlank(errorKey)) {
        StringBuilder builder = null;
        if (messageParameters != null && messageParameters.length > 0) {
            builder = new StringBuilder("  Message parameters are: ");
            for (String param : messageParameters) {
                builder.append(param).append("\n");
            }
        } else {
            builder = new StringBuilder("  Message parameters were null or empty.");
        }
        throw new IllegalArgumentException("invalid (blank) errorKey." + builder.toString());
    }

    setErrorKey(errorKey);
    setMessageParameters((String[]) ArrayUtils.clone(messageParameters));
}

From source file:org.midonet.cluster.cache.StateCacheTest.java

private void assertUpdateEquals(StateNotification.Update update, UUID owner, Class<?> clazz, UUID id,
        String key, KeyType.KeyTypeVal type, byte[] singleValue, String[] multiValue) {
    Assert.assertEquals(owner, update.owner());
    Assert.assertEquals(clazz, update.objectClass());
    Assert.assertEquals(id, update.id());
    Assert.assertEquals(key, update.key());
    Assert.assertEquals(type, update.type());
    if (type.isSingle())
        Assert.assertArrayEquals(singleValue, update.singleData());
    else {// w  ww  .  j  a  v  a  2  s .c o  m
        String[] sortedMultiValue = (String[]) ArrayUtils.clone(multiValue);
        Arrays.sort(sortedMultiValue);

        String[] sortedMultiData = (String[]) ArrayUtils.clone(update.multiData());
        Arrays.sort(sortedMultiData);

        Assert.assertArrayEquals(sortedMultiValue, sortedMultiValue);
    }
}

From source file:org.mrgeo.vector.mrsvector.VectorTileCleaner.java

VectorTileCleaner() {
    strings = (String[]) ArrayUtils.clone(initialStrings);
    init();
}

From source file:org.opens.kbaccess.utils.MailingServiceProperties.java

public void setSubscriptionNotificationMailingList(String[] subscriptionNotificationMailingList) {
    this.subscriptionNotificationMailingList = (String[]) ArrayUtils.clone(subscriptionNotificationMailingList);
}

From source file:org.opens.kbaccess.utils.MailingServiceProperties.java

public void setTestcaseCreationNotificationMailingList(String[] testcaseCreationNotificationMailingList) {
    this.testcaseCreationNotificationMailingList = (String[]) ArrayUtils
            .clone(testcaseCreationNotificationMailingList);
}