ElasticsearchSituationStore extends AbstractSituationStore implements SituationStore { protected ElasticsearchClient getClient() { return (_client); } ElasticsearchSituationStore(); @ServiceInit void init(); List<Situation> getSituations(final SituationsQuery sitQuery); void assignSituation(final String situationId, final String userName); void unassignSituation(final String situationId); void updateResolutionState(final String situationId, final ResolutionState resolutionState); @Override void recordSuccessfulResubmit(final String situationId, final String userName); @Override void recordResubmitFailure(final String situationId, final String errorMessage, final String userName); @ServiceClose void close();  }
@Test public void testStoreAndGetSituation() { try { Situation s1=new Situation(); s1.setId(SITUATION_ID_1); s1.setTimestamp(System.currentTimeMillis()); _elasticsearchSituationStore.store(s1); } catch (Exception e) { fail("Could not store situation " + e); } try { Situation s1 = _elasticsearchSituationStore.getSituation(SITUATION_ID_1); if (s1 != null) { if (!s1.getId().equals(SITUATION_ID_1)) fail("Situation id mismatch"); } else fail("Situation is null"); } catch (Exception e) { fail("Failed to get situation: " + e); } try { _elasticsearchSituationStore.getClient().remove(SITUATION_ID_1); } catch (Exception e) { fail("Could not remove situation" + e); } }