@Override public RedissonClient get() { // JDK serialization codec for now, but we can do better in speed and space final Codec codec = new SerializationCodec(); final Config redissonCfg = new Config(); redissonCfg.setCodec(codec) .useSingleServer() .setAddress(address) .setConnectionMinimumIdleSize(connectionMinimumIdleSize); return Redisson.create(redissonCfg); } }
@Test(groups = "fast") public void testStandaloneCatalogExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0)); final StandaloneCatalog standaloneCatalog = (StandaloneCatalog) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(standaloneCatalog, vc.getVersions().get(0)); } }
@Test(groups = "fast") public void testExternalizable() throws IOException { final DefaultTenant tenantdata = new DefaultTenant(UUID.randomUUID(), clock.getUTCNow(), clock.getUTCNow(), "er44TT-yy4r", "TTR445ee2", null); final Codec code = new SerializationCodec(); final ByteBuf byteBuf = code.getValueEncoder().encode(tenantdata); final DefaultTenant tenantData2 = (DefaultTenant) code.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(tenantData2, tenantdata); } }
@Test(groups = "fast") public void testDefaultPlanRulesExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0).getPlanRules()); final DefaultPlanRules planRules = (DefaultPlanRules) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(planRules, vc.getVersions().get(0).getPlanRules()); }
@Test(groups = "fast") public void testCatalogEntityCollectionProductExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0).getCatalogEntityCollectionProduct()); final Collection products = (CatalogEntityCollection) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(products, vc.getVersions().get(0).getCatalogEntityCollectionProduct()); }
@Test(groups = "fast") public void testProductExternalizable() throws IOException { final Codec codec = new SerializationCodec(); for (final Product product : vc.getVersions().get(0).getCatalogEntityCollectionProduct().getEntries()) { final ByteBuf byteBuf = codec.getValueEncoder().encode(product); final Product product2 = (Product) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(product2, product); } }
@Override public RedissonClient get() { // JDK serialization codec for now, but we can do better in speed and space final Codec codec = new SerializationCodec(); final Config redissonCfg = new Config(); redissonCfg.setCodec(codec) .useSingleServer() .setAddress(address) .setConnectionMinimumIdleSize(connectionMinimumIdleSize); return Redisson.create(redissonCfg); } }
@Test(groups = "fast") public void testStandaloneCatalogExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0)); final StandaloneCatalog standaloneCatalog = (StandaloneCatalog) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(standaloneCatalog, vc.getVersions().get(0)); } }
@Test(groups = "fast") public void testProductExternalizable() throws IOException { final Codec codec = new SerializationCodec(); for (final Product product : vc.getVersions().get(0).getCatalogEntityCollectionProduct().getEntries()) { final ByteBuf byteBuf = codec.getValueEncoder().encode(product); final Product product2 = (Product) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(product2, product); } }
@Test(groups = "fast") public void testDefaultPlanRulesExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0).getPlanRules()); final DefaultPlanRules planRules = (DefaultPlanRules) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(planRules, vc.getVersions().get(0).getPlanRules()); }
@Test(groups = "fast") public void testCatalogEntityCollectionProductExternalizable() throws IOException { final Codec codec = new SerializationCodec(); final ByteBuf byteBuf = codec.getValueEncoder().encode(vc.getVersions().get(0).getCatalogEntityCollectionProduct()); final Collection products = (CatalogEntityCollection) codec.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(products, vc.getVersions().get(0).getCatalogEntityCollectionProduct()); }
@Test(groups = "fast") public void testExternalizable() throws IOException { final DefaultTenant tenantdata = new DefaultTenant(UUID.randomUUID(), clock.getUTCNow(), clock.getUTCNow(), "er44TT-yy4r", "TTR445ee2", null); final Codec code = new SerializationCodec(); final ByteBuf byteBuf = code.getValueEncoder().encode(tenantdata); final DefaultTenant tenantData2 = (DefaultTenant) code.getValueDecoder().decode(byteBuf, null); Assert.assertEquals(tenantData2, tenantdata); } }