Search in sources :

Example 36 with IonSystem

use of com.amazon.ion.IonSystem in project ion-java by amzn.

the class IonSystemBuilderTest method testFluidStyle.

// -------------------------------------------------------------------------
@Test
public void testFluidStyle() {
    IonCatalog catalog = new SimpleCatalog();
    IonSystem ion = IonSystemBuilder.standard().withCatalog(catalog).withStreamCopyOptimized(true).build();
    assertSame(catalog, ion.getCatalog());
}
Also used : IonSystem(com.amazon.ion.IonSystem) IonCatalog(com.amazon.ion.IonCatalog) Test(org.junit.Test)

Example 37 with IonSystem

use of com.amazon.ion.IonSystem in project ion-java by amzn.

the class IonSystemBuilderTest method testCustomCatalog.

@Test
public void testCustomCatalog() {
    IonCatalog catalog = new SimpleCatalog();
    IonSystemBuilder b = IonSystemBuilder.standard().copy();
    b.setCatalog(catalog);
    assertSame(catalog, b.getCatalog());
    IonSystem ion = b.build();
    assertSame(catalog, ion.getCatalog());
}
Also used : IonSystem(com.amazon.ion.IonSystem) IonCatalog(com.amazon.ion.IonCatalog) Test(org.junit.Test)

Example 38 with IonSystem

use of com.amazon.ion.IonSystem in project ion-java by amzn.

the class IonSystemBuilderTest method testStreamCopyOptimized.

// -------------------------------------------------------------------------
@Test
public void testStreamCopyOptimized() {
    IonSystemBuilder b = IonSystemBuilder.standard().copy();
    b.setStreamCopyOptimized(true);
    IonSystem ion = b.build();
    assertTrue(isLiteSystem(ion));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    IonWriter w = ion.newBinaryWriter(out);
    assertTrue(((_Private_IonWriter) w).isStreamCopyOptimized());
}
Also used : IonSystem(com.amazon.ion.IonSystem) IonWriter(com.amazon.ion.IonWriter) com.amazon.ion.impl._Private_IonWriter(com.amazon.ion.impl._Private_IonWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 39 with IonSystem

use of com.amazon.ion.IonSystem in project ion-java by amzn.

the class IonSystemBuilderTest method testNullCatalog.

@Test
public void testNullCatalog() {
    IonSystemBuilder b = IonSystemBuilder.standard().copy();
    b.setCatalog(null);
    IonSystem ion = b.build();
    assertSame(SimpleCatalog.class, ion.getCatalog().getClass());
}
Also used : IonSystem(com.amazon.ion.IonSystem) Test(org.junit.Test)

Aggregations

IonSystem (com.amazon.ion.IonSystem)39 Test (org.junit.Test)27 IonValue (com.amazon.ion.IonValue)12 SymbolTable (com.amazon.ion.SymbolTable)10 IonReader (com.amazon.ion.IonReader)8 IonWriter (com.amazon.ion.IonWriter)8 IonDatagram (com.amazon.ion.IonDatagram)6 IonStruct (com.amazon.ion.IonStruct)6 IonCatalog (com.amazon.ion.IonCatalog)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 IonString (com.amazon.ion.IonString)4 com.amazon.ion.impl._Private_IonBinaryWriterBuilder (com.amazon.ion.impl._Private_IonBinaryWriterBuilder)4 com.amazon.ion.impl._Private_IonWriter (com.amazon.ion.impl._Private_IonWriter)4 BinaryTest (com.amazon.ion.BinaryTest)3 IonBinaryWriter (com.amazon.ion.IonBinaryWriter)2 IonType (com.amazon.ion.IonType)2 SimpleCatalog (com.amazon.ion.system.SimpleCatalog)2 IOException (java.io.IOException)2 BigInteger (java.math.BigInteger)2 Date (java.util.Date)2