CriteriaManager implements Serializable { @Lock(LockType.READ) public Measure getMeasure(String measureUri) { return knownMeasures.get(measureUri); } CriteriaManager(); Collection<CriterionCategory> getAllCriterionCategories(); @Lock(LockType.READ) Collection<Measure> getAllMeasures(); @Lock(LockType.READ) Collection<Attribute> getAllAttributes(); @Lock(LockType.READ) Measure getMeasure(String measureUri); @Lock(LockType.READ) Attribute getAttribute(String attributeUri); @Lock(LockType.READ) List<String> getCategoryHierachy(String measureUri); @Lock(LockType.WRITE) void reload(); @PostConstruct void init(); static final String MEASURES_FILE; static final String ATTRIBUTES_FILE; static final String CATEGORIES_FILE; }
@Test public void testRetriveSingleMeasureBasic() { Measure m = criteriaManager.getMeasure("http: Assert.assertNotNull(m); }
@Test public void testMeasureWithPositiveNumberScale() { Measure m = criteriaManager.getMeasure("http: Assert.assertNotNull(m); Scale s = m.getScale(); Assert.assertNotNull("Measure '" + m.getName() + "' has no scale!", s); Assert.assertTrue(s instanceof PositiveFloatScale); }
@Test public void testMeasureWithPositiveIntegerScale() { Measure m = criteriaManager.getMeasure("http: Assert.assertNotNull(m); Scale s = m.getScale(); Assert.assertNotNull("Measure '" + m.getName() + "' has no scale!", s); Assert.assertTrue(s instanceof PositiveIntegerScale); }
@Test public void testMeasureWithOrdinalScale() { Measure m = criteriaManager.getMeasure("http: Assert.assertNotNull(m); Scale s = m.getScale(); Assert.assertNotNull("Measure '" + m.getName() + "' has no scale!", s); Assert.assertTrue(s instanceof OrdinalScale); Assert.assertTrue("Measure '" + m.getName() + "' scale " + s.getDisplayName() + " has no restriction defined.", StringUtils.isNotEmpty(((OrdinalScale) s).getRestriction())); }