Java Code Examples for org.apache.kylin.common.persistence.Serializer#deserialize()
The following examples show how to use
org.apache.kylin.common.persistence.Serializer#deserialize() .
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: ModelServiceTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Test public void testSuccessModelUpdate() throws IOException, JobException { Serializer<DataModelDesc> serializer = modelService.getDataModelManager().getDataModelSerializer(); List<DataModelDesc> dataModelDescs = modelService.listAllModels("ci_inner_join_model", "default", true); Assert.assertTrue(dataModelDescs.size() == 1); ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.serialize(dataModelDescs.get(0), new DataOutputStream(baos)); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DataModelDesc deserialize = serializer.deserialize(new DataInputStream(bais)); deserialize.setOwner("somebody"); DataModelDesc dataModelDesc = modelService.updateModelAndDesc("default", deserialize); Assert.assertTrue(dataModelDesc.getOwner().equals("somebody")); }
Example 2
Source File: ModelServiceTest.java From kylin with Apache License 2.0 | 6 votes |
@Test public void testSuccessModelUpdate() throws IOException, JobException { Serializer<DataModelDesc> serializer = modelService.getDataModelManager().getDataModelSerializer(); List<DataModelDesc> dataModelDescs = modelService.listAllModels("ci_inner_join_model", "default", true); Assert.assertTrue(dataModelDescs.size() == 1); ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.serialize(dataModelDescs.get(0), new DataOutputStream(baos)); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DataModelDesc deserialize = serializer.deserialize(new DataInputStream(bais)); deserialize.setOwner("somebody"); DataModelDesc dataModelDesc = modelService.updateModelAndDesc("default", deserialize); Assert.assertTrue(dataModelDesc.getOwner().equals("somebody")); }
Example 3
Source File: TableSchemaUpdaterTest.java From kylin with Apache License 2.0 | 5 votes |
private <T extends RootPersistentEntity> T reinit(T obj, Serializer<T> serializer) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); serializer.serialize(obj, dos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DataInputStream dis = new DataInputStream(bais); return serializer.deserialize(dis); }