use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistAddAllWithIndexConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistAddAllWithIndexConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.addAll(0, Arrays.asList(SYSTEM.newInt(100), SYSTEM.newInt(101)));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistRemoveAllConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistRemoveAllConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.removeAll(Collections.singletonList(sequence.get(2)));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class IonReaderBinaryIncrementalTest method incrementalMultipleValuesIterateFromInputStream.
@Test
public void incrementalMultipleValuesIterateFromInputStream() throws Exception {
ResizingPipedInputStream pipe = new ResizingPipedInputStream(128);
IonSystem system = IonSystemBuilder.standard().withReaderBuilder(STANDARD_READER_BUILDER).build();
Iterator<IonValue> iterator = system.iterate(pipe);
incrementalMultipleValuesIterate(iterator, pipe);
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class IonWriterTestCase method testWritingWithSystemImport.
@Test
public void testWritingWithSystemImport() throws Exception {
final int FRED_ID_OFFSET = systemMaxId();
final int LOCAL_ID_OFFSET = FRED_ID_OFFSET + FRED_MAX_IDS[1];
SymbolTable fred1 = Symtabs.register("fred", 1, catalog());
iw = makeWriter(system().getSystemSymbolTable(), fred1);
iw.writeSymbol("fred_2");
iw.writeSymbol("localSym");
byte[] bytes = outputByteArray();
IonDatagram dg = loader().load(bytes);
assertEquals(4, dg.systemSize());
IonValue f2sym = dg.systemGet(2);
IonValue local = dg.systemGet(3);
checkSymbol("fred_2", FRED_ID_OFFSET + 2, f2sym);
checkSymbol("localSym", local);
SymbolTable symtab = f2sym.getSymbolTable();
assertSame(symtab, local.getSymbolTable());
SymbolTable[] importedTables = symtab.getImportedTables();
assertEquals(1, importedTables.length);
assertSame(fred1, importedTables[0]);
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class IonWriterTestCase method testWriteValueCantCopyFieldName.
@Test
public void testWriteValueCantCopyFieldName() throws Exception {
IonStruct data = struct("{a:{b:10}}");
IonValue a = data.get("a");
IonReader ir = system().newReader(a);
ir.next();
iw = makeWriter();
iw.stepIn(IonType.STRUCT);
// field name not set
thrown.expect(IllegalStateException.class);
iw.writeValue(ir);
}
Aggregations