use of org.opennms.netmgt.bsm.service.model.BusinessService in project opennms by OpenNMS.
the class BusinessServiceCriteriaTest method createDummyBusinessService.
private BusinessService createDummyBusinessService(final long id, final String name, String attributeKey, String attributeValue, final Status status) {
BusinessServiceEntity businessServiceEntity = new BusinessServiceEntity();
businessServiceEntity.setId(id);
businessServiceEntity.setAttribute(attributeKey, attributeValue);
businessServiceEntity.setName(name);
BusinessService businessService = new BusinessServiceImpl(businessServiceManager, businessServiceEntity) {
@Override
public Status getOperationalStatus() {
return status;
}
};
return businessService;
}
use of org.opennms.netmgt.bsm.service.model.BusinessService in project opennms by OpenNMS.
the class BusinessServiceManagerImplIT method ensureNoDanglingMapFunctions.
@Test
public void ensureNoDanglingMapFunctions() {
// Create a business service with an edge
final BusinessService bs = this.createBusinessService("bs1");
bs.addReductionKeyEdge("my-reduction-key", new Increase(), Edge.DEFAULT_WEIGHT, "My Reduction Key");
bs.save();
// Ensure there is an associated mapping function
assertEquals(1, mapFunctionDao.countAll());
Iterables.getOnlyElement(bs.getReductionKeyEdges()).setMapFunction(new Decrease());
bs.save();
// Ensure there is still only one associated mapping function
assertEquals(1, mapFunctionDao.countAll());
// Delete an edge
bs.delete();
// Ensure there are no mapping functions left
assertEquals(0, mapFunctionDao.countAll());
}
Aggregations