Examples of IResultSet


Examples of net.floodlightcontroller.storage.IResultSet

   
    @Test
    public void testNullValues() {
       
        IPredicate predicate = new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.EQ, "Jones");
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, predicate, new RowOrdering(PERSON_SSN));
        while (resultSet.next()) {
            resultSet.setNull(PERSON_FIRST_NAME);
            resultSet.setIntegerObject(PERSON_AGE, null);
        }
        resultSet.save();
        resultSet.close();

        resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, predicate, new RowOrdering(PERSON_SSN));
        int count = 0;
        while (resultSet.next()) {
            boolean checkNull = resultSet.isNull(PERSON_FIRST_NAME);
            assertTrue(checkNull);
            String s = resultSet.getString(PERSON_FIRST_NAME);
            assertEquals(s, null);
            checkNull = resultSet.isNull(PERSON_AGE);
            assertTrue(checkNull);
            Integer intObj = resultSet.getIntegerObject(PERSON_AGE);
            assertEquals(intObj, null);
            Short shortObj = resultSet.getShortObject(PERSON_AGE);
            assertEquals(shortObj, null);
            boolean excThrown = false;
            try {
                resultSet.getInt(PERSON_AGE);
            }
            catch (NullValueStorageException exc) {
                excThrown = true;
            }
            assertTrue(excThrown);
            count++;
        }
        resultSet.close();
        assertEquals(count, 2);
       
        predicate = new OperatorPredicate(PERSON_FIRST_NAME, OperatorPredicate.Operator.EQ, null);
        resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, predicate, new RowOrdering(PERSON_SSN));
        count = 0;
        while (resultSet.next()) {
            boolean checkNull = resultSet.isNull(PERSON_FIRST_NAME);
            assertTrue(checkNull);
            count++;
            checkNull = resultSet.isNull(PERSON_AGE);
            assertTrue(checkNull);
        }
        resultSet.close();
        assertEquals(count, 2);
    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        IPredicate predicate = new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "Sm");
        IQuery query = storageSource.createQuery(PERSON_TABLE_NAME, columnList, predicate, new RowOrdering(PERSON_SSN));
        Future<IResultSet> future = storageSource.executeQueryAsync(query);
        waitForFuture(future);
        try {
            IResultSet resultSet = future.get();
            checkExpectedResults(resultSet, columnList, expectedResults);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
        }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        IPredicate predicate = new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "Sm");
        Future<IResultSet> future = storageSource.executeQueryAsync(PERSON_TABLE_NAME,
                columnList, predicate, new RowOrdering(PERSON_SSN));
        waitForFuture(future);
        try {
            IResultSet resultSet = future.get();
            checkExpectedResults(resultSet, columnList, expectedResults);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
        }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        Object[][] newPersonInfo = {{"999-99-9999", "Ellen", "Wilson", 40, true}};
        Map<String,Object> rowValues = createPersonRowValues(newPersonInfo[0]);
        Future<?> future = storageSource.insertRowAsync(PERSON_TABLE_NAME, rowValues);
        waitForFuture(future);
        try {
            IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
            Object[][] expectedPersons = Arrays.copyOf(PERSON_INIT_DATA, PERSON_INIT_DATA.length + newPersonInfo.length);
            System.arraycopy(newPersonInfo, 0, expectedPersons, PERSON_INIT_DATA.length, newPersonInfo.length);
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
        }
        catch (Exception e) {
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        Future<?> future = storageSource.updateRowAsync(PERSON_TABLE_NAME, updateValues);
        waitForFuture(future);

        try {
            IResultSet resultSet = storageSource.getRow(PERSON_TABLE_NAME, "777-77-7777");
            Object[][] expectedPersons = {{"777-77-7777", "Tennis", "Borg", 60, true}};
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        Future<?> future = storageSource.updateRowAsync(PERSON_TABLE_NAME, "777-77-7777", updateValues);
        waitForFuture(future);

        try {
            IResultSet resultSet = storageSource.getRow(PERSON_TABLE_NAME, "777-77-7777");
            Object[][] expectedPersons = {{"777-77-7777", "Tennis", "Borg", 60, true}};
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        IPredicate predicate = new OperatorPredicate(PERSON_SSN, OperatorPredicate.Operator.EQ, "777-77-7777");
        Future<?> future = storageSource.updateMatchingRowsAsync(PERSON_TABLE_NAME, predicate, updateValues);
        waitForFuture(future);
        try {
            IResultSet resultSet = storageSource.getRow(PERSON_TABLE_NAME, "777-77-7777");
            Object[][] expectedPersons = {{"777-77-7777", "Tennis", "Borg", 60, true}};
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    @Test
    public void testAsyncDeleteRow() {
        Future<?> future = storageSource.deleteRowAsync(PERSON_TABLE_NAME, "111-11-1111");
        waitForFuture(future);
        try {
            IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
            Object[][] expectedPersons = Arrays.copyOfRange(PERSON_INIT_DATA, 1, PERSON_INIT_DATA.length);
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    @Test
    public void testAsyncDeleteMatchingRows() {
        Future<?> future = storageSource.deleteMatchingRowsAsync(PERSON_TABLE_NAME, null);
        waitForFuture(future);
        try {
            IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
            checkExpectedResults(resultSet, PERSON_COLUMN_LIST, new Object[0][]);
        }
        catch (Exception e) {
            fail("Exception thrown in async storage operation: " + e.toString());
        }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    }
   
    @Test
    public void testAsyncSave() {
        // Get a result set and make some changes to it
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
        resultSet.next();
        resultSet.deleteRow();
        resultSet.next();
        resultSet.setString(PERSON_FIRST_NAME, "John");
       
        Future<?> future = storageSource.saveAsync(resultSet);
        waitForFuture(future);
        try {
            resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.