use of org.onap.so.db.request.beans.SiteStatus in project so by onap.
the class SiteStatusTest method timeStampCreated.
@Test
@Transactional
public void timeStampCreated() throws InterruptedException, NoEntityFoundException {
SiteStatus found = repository.findById("test name4").orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
assertNotNull(found.getCreated());
assertEquals("test name4", found.getSiteName());
}
use of org.onap.so.db.request.beans.SiteStatus in project so by onap.
the class SiteStatusTest method sortByCreated.
@Test
public void sortByCreated() {
final PageRequest page1 = PageRequest.of(0, 20, Direction.DESC, "created");
SiteStatus example = new SiteStatus();
example.setStatus(true);
Page<SiteStatus> found = repository.findAll(Example.of(example), page1);
assertEquals("test name4", found.getContent().get(0).getSiteName());
}
use of org.onap.so.db.request.beans.SiteStatus in project so by onap.
the class SiteStatusTest method updateStatus.
@Test
public void updateStatus() throws NoEntityFoundException {
SiteStatus status = repository.findById("test name update").orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
status.setStatus(false);
repository.saveAndFlush(status);
status = repository.findById("test name update").orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
assertEquals(false, status.getStatus());
}
use of org.onap.so.db.request.beans.SiteStatus in project so by onap.
the class MsoRequestsDbAdapterImpl method getSiteStatus.
/**
* Get SiteStatus by SiteName.
*
* @param siteName The unique name of the site
* @return Status of that site
*/
@Override
@Transactional
public boolean getSiteStatus(String siteName) {
SiteStatus siteStatus;
logger.debug("Request database - get Site Status with Site name: {}", siteName);
siteStatus = siteRepo.findOneBySiteName(siteName);
if (siteStatus == null) {
// return true
return true;
} else {
return siteStatus.getStatus();
}
}
Aggregations