Package org.springframework.data.redis

Examples of org.springframework.data.redis.Person


   * @see DATAREDIS-241
   */
  @Test
  public void testJackson2JsonSerializer() throws Exception {

    Person person = new PersonObjectFactory().instance();
    assertEquals(person, serializer.deserialize(serializer.serialize(person)));
  }
View Full Code Here


   * @see DTATREDIS-241
   */
  @Test(expected = SerializationException.class)
  public void testJackson2JsonSerilizerShouldThrowExceptionWhenDeserializingInvalidByteArray() {

    Person person = new PersonObjectFactory().instance();
    byte[] serializedValue = serializer.serialize(person);
    Arrays.sort(serializedValue); // corrupt serialization result

    serializer.deserialize(serializedValue);
  }
View Full Code Here

  }

  @Test
  public void testPersonSerialization() throws Exception {
    String value = UUID.randomUUID().toString();
    Person p1 = new Person(value, value, 1, new Address(value, 2));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
  }
View Full Code Here

    xstream.afterPropertiesSet();

    OxmSerializer serializer = new OxmSerializer(xstream, xstream);

    String value = UUID.randomUUID().toString();
    Person p1 = new Person(value, value, 1, new Address(value, 2));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
  }
View Full Code Here

  @Test
  public void testJsonSerializer() throws Exception {
    JacksonJsonRedisSerializer<Person> serializer = new JacksonJsonRedisSerializer<Person>(Person.class);
    String value = UUID.randomUUID().toString();
    Person p1 = new Person(value, value, 1, new Address(value, 2));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
    assertEquals(p1, serializer.deserialize(serializer.serialize(p1)));
  }
View Full Code Here

    test(new Address("Broadway", 1));
  }

  @Test
  public void testNestedBean() throws Exception {
    test(new Person("George", "Enescu", 74, new Address("liveni", 19)));
  }
View Full Code Here

    template.afterPropertiesSet();
    DefaultRedisScript<String> script = new DefaultRedisScript<String>();
    script.setScriptSource(new StaticScriptSource("redis.call('SET',KEYS[1], ARGV[1])\nreturn 'FOO'"));
    script.setResultType(String.class);
    ScriptExecutor<String> scriptExecutor = new DefaultScriptExecutor<String>(template);
    Person joe = new Person("Joe", "Schmoe", 23);
    String result = scriptExecutor.execute(script, personSerializer, new StringRedisSerializer(),
        Collections.singletonList("bar"), joe);
    assertEquals("FOO", result);
    assertEquals(joe, template.boundValueOps("bar").get());
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.