Java Code Examples for org.apache.beam.sdk.util.CoderUtils#encodeToBase64()

The following examples show how to use org.apache.beam.sdk.util.CoderUtils#encodeToBase64() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StateNamespaces.java    From beam with Apache License 2.0 6 votes vote down vote up
@Override
public String stringKey() {
  try {
    // equivalent to String.format("/%s/%s/", ...)
    return "/"
        + CoderUtils.encodeToBase64(windowCoder, window)
        +
        // Use base 36 so that can address 36 triggers in a single byte and still be human
        // readable.
        "/"
        + Integer.toString(triggerIndex, TRIGGER_RADIX).toUpperCase()
        + "/";
  } catch (CoderException e) {
    throw new RuntimeException("Unable to generate string key from window " + window, e);
  }
}
 
Example 2
Source File: CollectionCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Collection");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 3
Source File: BigEndianIntegerCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Integer");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 4
Source File: SetCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Set");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 5
Source File: DoubleCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Double");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 6
Source File: ByteCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Byte");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 7
Source File: InstantCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Instant");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 8
Source File: VarLongCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Long");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 9
Source File: ListCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null List");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 10
Source File: BigEndianLongCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Long");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 11
Source File: VarIntCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Integer");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 12
Source File: ProtoCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null MessageA");

  CoderUtils.encodeToBase64(ProtoCoder.of(MessageA.class), null);
}
 
Example 13
Source File: BigIntegerCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(NullPointerException.class);
  thrown.expectMessage("cannot encode a null BigInteger");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 14
Source File: ByteArrayCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null byte[]");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 15
Source File: JavaBinCodecCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null SolrDocument");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 16
Source File: BigDecimalCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsException() throws Exception {
  thrown.expect(NullPointerException.class);
  thrown.expectMessage("cannot encode a null BigDecimal");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 17
Source File: IterableCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Iterable");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 18
Source File: TextualIntegerCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null Integer");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 19
Source File: BitSetCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void encodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null BitSet");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}
 
Example 20
Source File: ByteStringCoderTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodeNullThrowsCoderException() throws Exception {
  thrown.expect(CoderException.class);
  thrown.expectMessage("cannot encode a null ByteString");

  CoderUtils.encodeToBase64(TEST_CODER, null);
}