use of org.neo4j.kernel.ha.HighlyAvailableGraphDatabase in project neo4j by neo4j.
the class MasterInfoServiceTest method slaveShouldRespond404AndUNKNOWNWhenUnknown.
@Test
public void slaveShouldRespond404AndUNKNOWNWhenUnknown() throws Exception {
// given
HighlyAvailableGraphDatabase database = mock(HighlyAvailableGraphDatabase.class);
when(database.role()).thenReturn("unknown");
MasterInfoService service = new MasterInfoService(null, database);
// when
Response response = service.isSlave();
// then
assertEquals(404, response.getStatus());
assertEquals("UNKNOWN", String.valueOf(response.getEntity()));
}
use of org.neo4j.kernel.ha.HighlyAvailableGraphDatabase in project neo4j by neo4j.
the class MasterInfoServiceTest method masterShouldRespond404AndFalseWhenSlave.
@Test
public void masterShouldRespond404AndFalseWhenSlave() throws Exception {
// given
HighlyAvailableGraphDatabase database = mock(HighlyAvailableGraphDatabase.class);
when(database.role()).thenReturn("slave");
MasterInfoService service = new MasterInfoService(null, database);
// when
Response response = service.isMaster();
// then
assertEquals(404, response.getStatus());
assertEquals("false", String.valueOf(response.getEntity()));
}
use of org.neo4j.kernel.ha.HighlyAvailableGraphDatabase in project neo4j by neo4j.
the class MasterInfoServiceTest method shouldReportNonMasterOrSlaveAsUnavailableForTransactionProcessing.
@Test
public void shouldReportNonMasterOrSlaveAsUnavailableForTransactionProcessing() throws Exception {
// given
HighlyAvailableGraphDatabase database = mock(HighlyAvailableGraphDatabase.class);
when(database.role()).thenReturn("unknown");
MasterInfoService service = new MasterInfoService(null, database);
// when
Response response = service.isAvailable();
// then
assertEquals(404, response.getStatus());
assertEquals("UNKNOWN", String.valueOf(response.getEntity()));
}
use of org.neo4j.kernel.ha.HighlyAvailableGraphDatabase in project neo4j by neo4j.
the class MasterInfoServiceTest method slaveShouldRespond404AndFalseWhenMaster.
@Test
public void slaveShouldRespond404AndFalseWhenMaster() throws Exception {
// given
HighlyAvailableGraphDatabase database = mock(HighlyAvailableGraphDatabase.class);
when(database.role()).thenReturn("master");
MasterInfoService service = new MasterInfoService(null, database);
// when
Response response = service.isSlave();
// then
assertEquals(404, response.getStatus());
assertEquals("false", String.valueOf(response.getEntity()));
}
use of org.neo4j.kernel.ha.HighlyAvailableGraphDatabase in project neo4j by neo4j.
the class MasterInfoServiceTest method slaveShouldRespond200AndTrueWhenSlave.
@Test
public void slaveShouldRespond200AndTrueWhenSlave() throws Exception {
// given
HighlyAvailableGraphDatabase database = mock(HighlyAvailableGraphDatabase.class);
when(database.role()).thenReturn("slave");
MasterInfoService service = new MasterInfoService(null, database);
// when
Response response = service.isSlave();
// then
assertEquals(200, response.getStatus());
assertEquals("true", String.valueOf(response.getEntity()));
}
Aggregations