@Test public void testSeqByNullToken() throws OSException { HashMapCtxDB db = new HashMapCtxDB(); exception.expect(NullPointerException.class); db.addSeqByToken(null, seq); }
@Override public synchronized void addSeqByToken(Token token, Integer seq) { if (seq == null || seq < 0) { throw new NullPointerException(ErrorDescriptions.SEQ_NBR_INVALID); } if (token == null) { throw new NullPointerException(ErrorDescriptions.TOKEN_NULL); } if (tokenExist(token)) { LOGGER.info("Token exists, but this could be a refresh if not there is a problem"); } else { allTokens.add(token); } seqMap.put(token, seq); }
HashMapCtxDB implements OSCoreCtxDB { @Override public synchronized void addSeqByToken(Token token, Integer seq) { if (seq == null || seq < 0) { throw new NullPointerException(ErrorDescriptions.SEQ_NBR_INVALID); } if (token == null) { throw new NullPointerException(ErrorDescriptions.TOKEN_NULL); } if (tokenExist(token)) { LOGGER.info("Token exists, but this could be a refresh if not there is a problem"); } else { allTokens.add(token); } seqMap.put(token, seq); } }
HashMapCtxDB implements OSCoreCtxDB { @Override public synchronized void addSeqByToken(Token token, Integer seq) { if (seq == null || seq < 0) { throw new NullPointerException(ErrorDescriptions.SEQ_NBR_INVALID); } if (token == null) { throw new NullPointerException(ErrorDescriptions.TOKEN_NULL); } if (tokenExist(token)) { LOGGER.info("Token exists, but this could be a refresh if not there is a problem"); } else { allTokens.add(token); } seqMap.put(token, seq); } HashMapCtxDB(); }
HashMapCtxDB implements OSCoreCtxDB { @Override public synchronized void addSeqByToken(Token token, Integer seq) { if (seq == null || seq < 0) { throw new NullPointerException(ErrorDescriptions.SEQ_NBR_INVALID); } if (token == null) { throw new NullPointerException(ErrorDescriptions.TOKEN_NULL); } if (tokenExist(token)) { LOGGER.info("Token exists, but this could be a refresh if not there is a problem"); } else { allTokens.add(token); } seqMap.put(token, seq); } HashMapCtxDB(); @Override synchronized OSCoreCtx getContext(byte[] rid, byte[] IDContext); @Override synchronized OSCoreCtx getContext(byte[] rid); @Override synchronized OSCoreCtx getContextByToken(Token token); @Override synchronized OSCoreCtx getContext(String uri); @Override synchronized void addContext(Token token, OSCoreCtx ctx); @Override synchronized void addContext(String uri, OSCoreCtx ctx); @Override synchronized void addContext(OSCoreCtx ctx); @Override synchronized void removeContext(OSCoreCtx ctx); @Override synchronized Integer getSeqByToken(Token token); @Override synchronized void addSeqByToken(Token token, Integer seq); @Override synchronized boolean tokenExist(Token token); @Override synchronized void removeSeqByToken(Token token); @Override synchronized void updateSeqByToken(Token token, Integer seq); @Override synchronized void removeToken(Token token); @Override synchronized void purge(); }
HashMapCtxDB implements OSCoreCtxDB { @Override public synchronized void addSeqByToken(Token token, Integer seq) { if (seq == null || seq < 0) { throw new NullPointerException(ErrorDescriptions.SEQ_NBR_INVALID); } if (token == null) { throw new NullPointerException(ErrorDescriptions.TOKEN_NULL); } if (tokenExist(token)) { LOGGER.info("Token exists, but this could be a refresh if not there is a problem"); } else { allTokens.add(token); } seqMap.put(token, seq); } HashMapCtxDB(); @Override synchronized OSCoreCtx getContext(byte[] rid, byte[] IDContext); @Override synchronized OSCoreCtx getContext(byte[] rid); @Override synchronized OSCoreCtx getContextByToken(Token token); @Override synchronized OSCoreCtx getContext(String uri); @Override synchronized void addContext(Token token, OSCoreCtx ctx); @Override synchronized void addContext(String uri, OSCoreCtx ctx); @Override synchronized void addContext(OSCoreCtx ctx); @Override synchronized void removeContext(OSCoreCtx ctx); @Override synchronized Integer getSeqByToken(Token token); @Override synchronized void addSeqByToken(Token token, Integer seq); @Override synchronized boolean tokenExist(Token token); @Override synchronized void removeSeqByToken(Token token); @Override synchronized void updateSeqByToken(Token token, Integer seq); @Override synchronized void removeToken(Token token); @Override synchronized void purge();  }