Java Code Examples for io.protostuff.ByteString#copyFrom()

The following examples show how to use io.protostuff.ByteString#copyFrom() . 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: TestUpgrade.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Tests illegal upgrade from OSS to EE
 */
@Test
public void testIllegalUpgrade() throws Exception {
  thrown.expect(Exception.class);
  thrown.expectMessage("Illegal upgrade from OSS to EE");

  final ByteString prevEdition = ByteString.copyFrom("OSS".getBytes());
  final ConfigurationEntry configurationEntry = new ConfigurationEntry();
  configurationEntry.setValue(prevEdition);
  final LegacyKVStoreProvider kvStoreProvider = new LegacyKVStoreProviderAdapter(
    new LocalKVStoreProvider(CLASSPATH_SCAN_RESULT, null, true, false),
    CLASSPATH_SCAN_RESULT);
  kvStoreProvider.start();
  final ConfigurationStore configurationStore = new ConfigurationStore(kvStoreProvider);
  configurationStore.put(SupportService.DREMIO_EDITION, configurationEntry);
  new Upgrade(DACConfig.newConfig(), CLASSPATH_SCAN_RESULT, false).validateUpgrade(kvStoreProvider, "EE");
}
 
Example 2
Source File: TestUpgrade.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Test legal upgrade if prior dremio edition is not specified or editions match
 */
@Test
public void testLegalUpgrade() throws Exception {
  final ByteString prevEdition = ByteString.copyFrom("OSS".getBytes());
  final ConfigurationEntry configurationEntry = new ConfigurationEntry();
  configurationEntry.setValue(prevEdition);
  final LegacyKVStoreProvider kvStoreProvider = new LegacyKVStoreProviderAdapter(
    new LocalKVStoreProvider(CLASSPATH_SCAN_RESULT, null, true, false),
    CLASSPATH_SCAN_RESULT);
  kvStoreProvider.start();
  final ConfigurationStore configurationStore = new ConfigurationStore(kvStoreProvider);
  new Upgrade(DACConfig.newConfig(), CLASSPATH_SCAN_RESULT, false).validateUpgrade(kvStoreProvider, "OSS");
  configurationStore.put(SupportService.DREMIO_EDITION, configurationEntry);
  new Upgrade(DACConfig.newConfig(), CLASSPATH_SCAN_RESULT, false).validateUpgrade(kvStoreProvider, "OSS");
}
 
Example 3
Source File: BatchSchema.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
public ByteString toByteString(){
  return ByteString.copyFrom(serialize());
}
 
Example 4
Source File: ConnectionConf.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public ByteString toBytesString() {
  return ByteString.copyFrom(toBytes());
}
 
Example 5
Source File: PhysicalPlanReader.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public ByteString deserialize(JsonParser p, DeserializationContext ctxt)
    throws IOException, JsonProcessingException {
  return ByteString.copyFrom(p.getBinaryValue());
}
 
Example 6
Source File: BasicSupportService.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
private static ByteString convertClusterIdentityToByteString(ClusterIdentity identity) {
  final LinkedBuffer buffer = LinkedBuffer.allocate();
  byte[] bytes = ProtostuffIOUtil.toByteArray(identity, ClusterIdentity.getSchema(), buffer);
  return ByteString.copyFrom(bytes);
}
 
Example 7
Source File: SearchIndexManager.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
private static ByteString convertSearchConfigurationToByteString(SearchConfiguration configuration) {
  final LinkedBuffer buffer = LinkedBuffer.allocate();
  byte[] bytes = ProtostuffIOUtil.toByteArray(configuration, SearchConfiguration.getSchema(), buffer);
  return ByteString.copyFrom(bytes);
}