test_class.declarator: thrown= ExpectedException.none()
test_class.modifier: @Rule
    public
test_class.original_string: @Rule
    public ExpectedException thrown= ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.file: session-replacement/src/test/java/com/amadeus/session/repository/redis/TestRedisSessionRepository.java
test_class.identifier: TestRedisSessionRepository
test_case.body: @Test
    public void testSetMetrics() {
      RedisFacade facade = mock(RedisFacade.class);
      SessionManager sm = mock(SessionManager.class);
      MetricRegistry metrics = spy(new MetricRegistry());
      SessionConfiguration conf = new SessionConfiguration();
      when(sm.getConfiguration()).thenReturn(conf);
      when(sm.getMetrics()).thenReturn(metrics);
      metrics.meter("com.amadeus.session.myapp.redis.sample");
      try (RedisSessionRepository rsr = new RedisSessionRepository(facade, "myapp", "localhost", ExpirationStrategy.NOTIF, false)) {
        rsr.setSessionManager(sm);
        verify(metrics).removeMatching(any(MetricFilter.class));
        verify(metrics, never()).meter("com.amadeus.session.myapp.redis.failover");
      }
    }
test_case.class_method_signature: TestRedisSessionRepository.testSetMetrics()
test_case.full_signature: @Test public void testSetMetrics()
test_case.identifier: testSetMetrics
test_case.invocations: mock mock spy thenReturn when getConfiguration thenReturn when getMetrics meter setSessionManager removeMatching verify any meter verify never
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSetMetrics()
focal_class.declarator: logger = LoggerFactory.getLogger(RedisSessionRepository.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(RedisSessionRepository.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: DEFAULT_SESSION_PREFIX = "com.amadeus.session:"
focal_class.modifier: static final
focal_class.original_string: static final String DEFAULT_SESSION_PREFIX = "com.amadeus.session:";
focal_class.type: String
focal_class.var_name: DEFAULT_SESSION_PREFIX
focal_class.declarator: LAST_ACCESSED = encode("#:lastAccessed")
focal_class.modifier: static final
focal_class.original_string: static final byte[] LAST_ACCESSED = encode("#:lastAccessed");
focal_class.type: byte[]
focal_class.var_name: LAST_ACCESSED
focal_class.declarator: MAX_INACTIVE_INTERVAL = encode("#:maxInactiveInterval")
focal_class.modifier: static final
focal_class.original_string: static final byte[] MAX_INACTIVE_INTERVAL = encode("#:maxInactiveInterval");
focal_class.type: byte[]
focal_class.var_name: MAX_INACTIVE_INTERVAL
focal_class.declarator: CREATION_TIME = encode("#:creationTime")
focal_class.modifier: static final
focal_class.original_string: static final byte[] CREATION_TIME = encode("#:creationTime");
focal_class.type: byte[]
focal_class.var_name: CREATION_TIME
focal_class.declarator: INVALID_SESSION = encode("#:invalidSession")
focal_class.modifier: static final
focal_class.original_string: static final byte[] INVALID_SESSION = encode("#:invalidSession");
focal_class.type: byte[]
focal_class.var_name: INVALID_SESSION
focal_class.declarator: OWNER_NODE = encode("#:owner")
focal_class.modifier: static final
focal_class.original_string: static final byte[] OWNER_NODE = encode("#:owner");
focal_class.type: byte[]
focal_class.var_name: OWNER_NODE
focal_class.declarator: BYTES_TRUE = SafeEncoder.encode(String.valueOf(1))
focal_class.modifier: static final
focal_class.original_string: static final byte[] BYTES_TRUE = SafeEncoder.encode(String.valueOf(1));
focal_class.type: byte[]
focal_class.var_name: BYTES_TRUE
focal_class.declarator: INTERNAL_PREFIX = new byte[] { '#', ':' }
focal_class.modifier: private static final
focal_class.original_string: private static final byte[] INTERNAL_PREFIX = new byte[] { '#', ':' };
focal_class.type: byte[]
focal_class.var_name: INTERNAL_PREFIX
focal_class.declarator: CREATION_TIME_INDEX = 2
focal_class.modifier: private static final
focal_class.original_string: private static final int CREATION_TIME_INDEX = 2;
focal_class.type: int
focal_class.var_name: CREATION_TIME_INDEX
focal_class.declarator: INVALID_SESSION_INDEX = 3
focal_class.modifier: private static final
focal_class.original_string: private static final int INVALID_SESSION_INDEX = 3;
focal_class.type: int
focal_class.var_name: INVALID_SESSION_INDEX
focal_class.declarator: OWNER_NODE_INDEX = 4
focal_class.modifier: private static final
focal_class.original_string: private static final int OWNER_NODE_INDEX = 4;
focal_class.type: int
focal_class.var_name: OWNER_NODE_INDEX
focal_class.declarator: OK_RESULT = new RedisFacade.ResponseFacade<String>() {
      @Override
      public String get() {
        return "OK";
      }
    }
focal_class.modifier: private static final
focal_class.original_string: private static final RedisFacade.ResponseFacade<String> OK_RESULT = new RedisFacade.ResponseFacade<String>() {
      @Override
      public String get() {
        return "OK";
      }
    };
focal_class.type: RedisFacade.ResponseFacade<String>
focal_class.var_name: OK_RESULT
focal_class.declarator: BITS_IN_BYTE = 8
focal_class.modifier: private static final
focal_class.original_string: private static final int BITS_IN_BYTE = 8;
focal_class.type: int
focal_class.var_name: BITS_IN_BYTE
focal_class.declarator: owner
focal_class.modifier: private final
focal_class.original_string: private final String owner;
focal_class.type: String
focal_class.var_name: owner
focal_class.declarator: ownerByteArray
focal_class.modifier: private final
focal_class.original_string: private final byte[] ownerByteArray;
focal_class.type: byte[]
focal_class.var_name: ownerByteArray
focal_class.declarator: keyPrefix
focal_class.modifier: private final
focal_class.original_string: private final String keyPrefix;
focal_class.type: String
focal_class.var_name: keyPrefix
focal_class.declarator: keyPrefixByteArray
focal_class.modifier: private final
focal_class.original_string: private final byte[] keyPrefixByteArray;
focal_class.type: byte[]
focal_class.var_name: keyPrefixByteArray
focal_class.declarator: redirectionsChannel
focal_class.modifier: private
focal_class.original_string: private byte[] redirectionsChannel;
focal_class.type: byte[]
focal_class.var_name: redirectionsChannel
focal_class.declarator: redis
focal_class.modifier: private final
focal_class.original_string: private final RedisFacade redis;
focal_class.type: RedisFacade
focal_class.var_name: redis
focal_class.declarator: expirationManager
focal_class.modifier: final
focal_class.original_string: final RedisExpirationStrategy expirationManager;
focal_class.type: RedisExpirationStrategy
focal_class.var_name: expirationManager
focal_class.declarator: sessionManager
focal_class.modifier: private
focal_class.original_string: private SessionManager sessionManager;
focal_class.type: SessionManager
focal_class.var_name: sessionManager
focal_class.declarator: failoverMetrics
focal_class.modifier: private
focal_class.original_string: private Meter failoverMetrics;
focal_class.type: Meter
focal_class.var_name: failoverMetrics
focal_class.declarator: sticky
focal_class.modifier: private
focal_class.original_string: private boolean sticky;
focal_class.type: boolean
focal_class.var_name: sticky
focal_class.declarator: namespace
focal_class.modifier: private final
focal_class.original_string: private final String namespace;
focal_class.type: String
focal_class.var_name: namespace
focal_class.file: session-replacement/src/main/java/com/amadeus/session/repository/redis/RedisSessionRepository.java
focal_class.identifier: RedisSessionRepository
focal_class.interfaces: implements SessionRepository
focal_class.class_method_signature: RedisSessionRepository.RedisSessionRepository(RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
        boolean sticky)
focal_class.full_signature: public  RedisSessionRepository(RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
        boolean sticky)
focal_class.identifier: RedisSessionRepository
focal_class.modifiers: public
focal_class.parameters: (RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
        boolean sticky)
focal_class.signature:  RedisSessionRepository(RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
        boolean sticky)
focal_class.class_method_signature: RedisSessionRepository.setSessionManager(final SessionManager sessionManager)
focal_class.full_signature: @Override public void setSessionManager(final SessionManager sessionManager)
focal_class.identifier: setSessionManager
focal_class.modifiers: @Override public
focal_class.parameters: (final SessionManager sessionManager)
focal_class.return: void
focal_class.signature: void setSessionManager(final SessionManager sessionManager)
focal_class.class_method_signature: RedisSessionRepository.getSessionData(String id)
focal_class.full_signature: @Override public SessionData getSessionData(String id)
focal_class.identifier: getSessionData
focal_class.modifiers: @Override public
focal_class.parameters: (String id)
focal_class.return: SessionData
focal_class.signature: SessionData getSessionData(String id)
focal_class.class_method_signature: RedisSessionRepository.checkConsistent(String sessionId, List<byte[]> values)
focal_class.full_signature: private boolean checkConsistent(String sessionId, List<byte[]> values)
focal_class.identifier: checkConsistent
focal_class.modifiers: private
focal_class.parameters: (String sessionId, List<byte[]> values)
focal_class.return: boolean
focal_class.signature: boolean checkConsistent(String sessionId, List<byte[]> values)
focal_class.class_method_signature: RedisSessionRepository.intFrom(byte[] b)
focal_class.full_signature: private static int intFrom(byte[] b)
focal_class.identifier: intFrom
focal_class.modifiers: private static
focal_class.parameters: (byte[] b)
focal_class.return: int
focal_class.signature: int intFrom(byte[] b)
focal_class.class_method_signature: RedisSessionRepository.longFrom(byte[] b)
focal_class.full_signature: private static long longFrom(byte[] b)
focal_class.identifier: longFrom
focal_class.modifiers: private static
focal_class.parameters: (byte[] b)
focal_class.return: long
focal_class.signature: long longFrom(byte[] b)
focal_class.class_method_signature: RedisSessionRepository.addLong(Map<byte[], byte[]> attributes, byte[] attr, long value)
focal_class.full_signature: private static void addLong(Map<byte[], byte[]> attributes, byte[] attr, long value)
focal_class.identifier: addLong
focal_class.modifiers: private static
focal_class.parameters: (Map<byte[], byte[]> attributes, byte[] attr, long value)
focal_class.return: void
focal_class.signature: void addLong(Map<byte[], byte[]> attributes, byte[] attr, long value)
focal_class.class_method_signature: RedisSessionRepository.addInt(Map<byte[], byte[]> attributes, byte[] attr, int value)
focal_class.full_signature: private static void addInt(Map<byte[], byte[]> attributes, byte[] attr, int value)
focal_class.identifier: addInt
focal_class.modifiers: private static
focal_class.parameters: (Map<byte[], byte[]> attributes, byte[] attr, int value)
focal_class.return: void
focal_class.signature: void addInt(Map<byte[], byte[]> attributes, byte[] attr, int value)
focal_class.class_method_signature: RedisSessionRepository.startCommit(SessionData session)
focal_class.full_signature: @Override public CommitTransaction startCommit(SessionData session)
focal_class.identifier: startCommit
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session)
focal_class.return: CommitTransaction
focal_class.signature: CommitTransaction startCommit(SessionData session)
focal_class.class_method_signature: RedisSessionRepository.remove(SessionData session)
focal_class.full_signature: @Override public void remove(SessionData session)
focal_class.identifier: remove
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session)
focal_class.return: void
focal_class.signature: void remove(SessionData session)
focal_class.class_method_signature: RedisSessionRepository.sessionKey(String sessionId)
focal_class.full_signature: public byte[] sessionKey(String sessionId)
focal_class.identifier: sessionKey
focal_class.modifiers: public
focal_class.parameters: (String sessionId)
focal_class.return: byte[]
focal_class.signature: byte[] sessionKey(String sessionId)
focal_class.class_method_signature: RedisSessionRepository.sessionKey(SessionData session)
focal_class.full_signature: private byte[] sessionKey(SessionData session)
focal_class.identifier: sessionKey
focal_class.modifiers: private
focal_class.parameters: (SessionData session)
focal_class.return: byte[]
focal_class.signature: byte[] sessionKey(SessionData session)
focal_class.class_method_signature: RedisSessionRepository.getSessionAttribute(SessionData session, String attribute)
focal_class.full_signature: @Override public Object getSessionAttribute(SessionData session, String attribute)
focal_class.identifier: getSessionAttribute
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session, String attribute)
focal_class.return: Object
focal_class.signature: Object getSessionAttribute(SessionData session, String attribute)
focal_class.class_method_signature: RedisSessionRepository.hasInternalPrefix(byte[] buf)
focal_class.full_signature: static boolean hasInternalPrefix(byte[] buf)
focal_class.identifier: hasInternalPrefix
focal_class.modifiers: static
focal_class.parameters: (byte[] buf)
focal_class.return: boolean
focal_class.signature: boolean hasInternalPrefix(byte[] buf)
focal_class.class_method_signature: RedisSessionRepository.getSessionKey(byte[] session)
focal_class.full_signature:  byte[] getSessionKey(byte[] session)
focal_class.identifier: getSessionKey
focal_class.parameters: (byte[] session)
focal_class.return: byte[]
focal_class.signature: byte[] getSessionKey(byte[] session)
focal_class.class_method_signature: RedisSessionRepository.prepareRemove(SessionData session)
focal_class.full_signature: @Override public boolean prepareRemove(SessionData session)
focal_class.identifier: prepareRemove
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session)
focal_class.return: boolean
focal_class.signature: boolean prepareRemove(SessionData session)
focal_class.class_method_signature: RedisSessionRepository.getAllKeys(SessionData session)
focal_class.full_signature: @Override public Set<String> getAllKeys(SessionData session)
focal_class.identifier: getAllKeys
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session)
focal_class.return: Set<String>
focal_class.signature: Set<String> getAllKeys(SessionData session)
focal_class.class_method_signature: RedisSessionRepository.storeSessionData(SessionData sessionData)
focal_class.full_signature: @Override public void storeSessionData(SessionData sessionData)
focal_class.identifier: storeSessionData
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData sessionData)
focal_class.return: void
focal_class.signature: void storeSessionData(SessionData sessionData)
focal_class.class_method_signature: RedisSessionRepository.requestFinished()
focal_class.full_signature: @Override public void requestFinished()
focal_class.identifier: requestFinished
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void requestFinished()
focal_class.class_method_signature: RedisSessionRepository.setSessionAttribute(SessionData session, String name, Object value)
focal_class.full_signature: @Override public void setSessionAttribute(SessionData session, String name, Object value)
focal_class.identifier: setSessionAttribute
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session, String name, Object value)
focal_class.return: void
focal_class.signature: void setSessionAttribute(SessionData session, String name, Object value)
focal_class.class_method_signature: RedisSessionRepository.serializerDeserializer()
focal_class.full_signature: private SerializerDeserializer serializerDeserializer()
focal_class.identifier: serializerDeserializer
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: SerializerDeserializer
focal_class.signature: SerializerDeserializer serializerDeserializer()
focal_class.class_method_signature: RedisSessionRepository.removeSessionAttribute(SessionData session, String name)
focal_class.full_signature: @Override public void removeSessionAttribute(SessionData session, String name)
focal_class.identifier: removeSessionAttribute
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData session, String name)
focal_class.return: void
focal_class.signature: void removeSessionAttribute(SessionData session, String name)
focal_class.class_method_signature: RedisSessionRepository.cleanSessionsOnShutdown()
focal_class.full_signature: @Override public boolean cleanSessionsOnShutdown()
focal_class.identifier: cleanSessionsOnShutdown
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean cleanSessionsOnShutdown()
focal_class.class_method_signature: RedisSessionRepository.getOwnedSessionIds()
focal_class.full_signature: @Override public Collection<String> getOwnedSessionIds()
focal_class.identifier: getOwnedSessionIds
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<String>
focal_class.signature: Collection<String> getOwnedSessionIds()
focal_class.class_method_signature: RedisSessionRepository.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: RedisSessionRepository.reset()
focal_class.full_signature: @Override public void reset()
focal_class.identifier: reset
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: RedisSessionRepository.getRedis()
focal_class.full_signature:  RedisFacade getRedis()
focal_class.identifier: getRedis
focal_class.parameters: ()
focal_class.return: RedisFacade
focal_class.signature: RedisFacade getRedis()
focal_class.class_method_signature: RedisSessionRepository.extractSessionId(String body)
focal_class.full_signature: static String extractSessionId(String body)
focal_class.identifier: extractSessionId
focal_class.modifiers: static
focal_class.parameters: (String body)
focal_class.return: String
focal_class.signature: String extractSessionId(String body)
focal_class.class_method_signature: RedisSessionRepository.sessionIdChange(SessionData sessionData)
focal_class.full_signature: @Override public void sessionIdChange(SessionData sessionData)
focal_class.identifier: sessionIdChange
focal_class.modifiers: @Override public
focal_class.parameters: (SessionData sessionData)
focal_class.return: void
focal_class.signature: void sessionIdChange(SessionData sessionData)
focal_class.class_method_signature: RedisSessionRepository.isConnected()
focal_class.full_signature: @Override public boolean isConnected()
focal_class.identifier: isConnected
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isConnected()
focal_method.body: @Override
    public void setSessionManager(final SessionManager sessionManager) {
      this.sessionManager = sessionManager;
      MetricRegistry metrics = sessionManager.getMetrics();
      if (metrics != null) {
        // Cleanup old metrics related to this namespace
        metrics.removeMatching(new MetricFilter() {
          @Override
          public boolean matches(String name, Metric metric) {
            return name.startsWith(name(RedisConfiguration.METRIC_PREFIX, "redis"));
          }
        });
        if (sticky) {
          failoverMetrics = metrics.meter(name(RedisConfiguration.METRIC_PREFIX, namespace, "redis", "failover"));
        }
  
        redis.startMonitoring(metrics);
      }
      expirationManager.startExpiredSessionsTask(sessionManager);
    }
focal_method.class_method_signature: RedisSessionRepository.setSessionManager(final SessionManager sessionManager)
focal_method.full_signature: @Override public void setSessionManager(final SessionManager sessionManager)
focal_method.identifier: setSessionManager
focal_method.invocations: getMetrics removeMatching startsWith name meter name startMonitoring startExpiredSessionsTask
focal_method.modifiers: @Override public
focal_method.parameters: (final SessionManager sessionManager)
focal_method.return: void
focal_method.signature: void setSessionManager(final SessionManager sessionManager)