use of org.candlepin.model.Status in project candlepin by candlepin.
the class StatusResourceTest method status.
@Test
public void status() throws Exception {
PrintStream ps = new PrintStream(new File(this.getClass().getClassLoader().getResource("version.properties").toURI()));
ps.println("version=${version}");
ps.println("release=${release}");
StatusResource sr = new StatusResource(rulesCurator, config, jsProvider, candlepinCache, modeManager);
Status s = sr.status();
ps.close();
assertNotNull(s);
assertEquals("${release}", s.getRelease());
assertEquals("${version}", s.getVersion());
assertTrue(s.getResult());
}
use of org.candlepin.model.Status in project candlepin by candlepin.
the class StatusResourceTest method testDBDown.
@Test
public void testDBDown() throws Exception {
PrintStream ps = new PrintStream(new File(this.getClass().getClassLoader().getResource("version.properties").toURI()));
ps.println("version=${version}");
ps.println("release=${release}");
when(rulesCurator.getUpdatedFromDB()).thenThrow(new RuntimeException());
StatusResource sr = new StatusResource(rulesCurator, config, jsProvider, candlepinCache, modeManager);
Status s = sr.status();
ps.close();
assertNotNull(s);
assertEquals("${release}", s.getRelease());
assertEquals("${version}", s.getVersion());
assertFalse(s.getResult());
}
use of org.candlepin.model.Status in project candlepin by candlepin.
the class StatusCacheTest method setAndGet.
@Test
public void setAndGet() {
StatusCache cache = new StatusCache();
Status status = new Status(true, "2.0", "2.0", false, "4.2", Rules.RulesSourceEnum.DATABASE, CandlepinModeChange.Mode.NORMAL, CandlepinModeChange.Reason.STARTUP, new Date());
cache.setStatus(status);
assertEquals(status, cache.getStatus());
}
use of org.candlepin.model.Status in project candlepin by candlepin.
the class StatusCacheTest method multipleInstancesShareSameStatus.
@Test
public void multipleInstancesShareSameStatus() {
StatusCache cache1 = new StatusCache();
Status status = new Status(true, "2.0", "2.0", false, "4.2", Rules.RulesSourceEnum.DATABASE, CandlepinModeChange.Mode.NORMAL, CandlepinModeChange.Reason.STARTUP, new Date());
cache1.setStatus(status);
StatusCache cache2 = new StatusCache();
assertEquals(cache1.getStatus(), cache2.getStatus());
}
use of org.candlepin.model.Status in project candlepin by candlepin.
the class StatusCacheTest method testExpiresAfter5Seconds.
@Test
public void testExpiresAfter5Seconds() throws Exception {
StatusCache cache = new StatusCache();
Status status = new Status(true, "2.0", "2.0", false, "4.2", Rules.RulesSourceEnum.DATABASE, CandlepinModeChange.Mode.NORMAL, CandlepinModeChange.Reason.STARTUP, new Date());
cache.setStatus(status);
assertEquals(status, cache.getStatus());
Thread.sleep(6000L);
assertNull(cache.getStatus());
}
Aggregations