@Test
  @RedisAvailable
  public void testPersistKeyValue() {
    RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
    RedisMetadataStore metadataStore = new RedisMetadataStore(jcf, "testMetadata");
    metadataStore.put("RedisMetadataStoreTests-Spring", "Integration");

    StringRedisTemplate redisTemplate = new StringRedisTemplate(jcf);
    BoundHashOperations<String, Object, Object> ops = redisTemplate.boundHashOps("testMetadata");

    assertEquals("Integration", ops.get("RedisMetadataStoreTests-Spring"));
  }
Esempio n. 2
0
  private void initGetHashOperationsForContact(Long id) {
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_CONTACT_ID)).thenReturn(id);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_CONTACT_EMAIL_ADDRESS))
        .thenReturn(ContactTestUtil.EMAIL_ADDRESS);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_CONTACT_FIRST_NAME))
        .thenReturn(ContactTestUtil.FIRST_NAME);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_CONTACT_LAST_NAME))
        .thenReturn(ContactTestUtil.LAST_NAME);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_CONTACT_PHONE_NUMBER))
        .thenReturn(ContactTestUtil.PHONE_NUMBER);

    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_ADDRESS_STREET_ADDRESS))
        .thenReturn(ContactTestUtil.STREET_ADDRESS);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_ADDRESS_POST_CODE))
        .thenReturn(ContactTestUtil.POST_CODE);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_ADDRESS_POST_OFFICE))
        .thenReturn(ContactTestUtil.POST_OFFICE);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_ADDRESS_STATE))
        .thenReturn(ContactTestUtil.STATE);
    when(boundHashOperationsMock.get(RedisContactService.HASH_KEY_ADDRESS_COUNTRY))
        .thenReturn(ContactTestUtil.COUNTRY);
  }