use of org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath in project estatio by estatio.
the class T_unclassify_IntegTest method disabled_when_no_classification_to_remove.
@Test
public void disabled_when_no_classification_to_remove() {
// given "Other bar (in Paris)", that has no classifications
// given
OtherObjectWithAtPath otherBarInFrance = otherObjectMenu.listAllOtherObjectsWithAtPath().stream().filter(otherObject -> otherObject.getName().equals("Other bar (in France)")).findFirst().get();
assertThat(classificationRepository.findByClassified(otherBarInFrance)).isEmpty();
final ClassificationForOtherObjectWithAtPath.unclassify unclassify = factoryService.mixin(ClassificationForOtherObjectWithAtPath.unclassify.class, otherBarInFrance);
// when
final String message = unclassify.disableUnclassify().toString();
// then
assertThat(message).isEqualTo("tr: No classifications to delete");
}
use of org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath in project estatio by estatio.
the class DemoObjectWithAtPath_and_OtherObjectWithAtPath_create3 method createOther.
private OtherObjectWithAtPath createOther(final String name, final String atPath, final ExecutionContext executionContext) {
final OtherObjectWithAtPath otherObject = wrap(otherObjectMenu).createOtherObjectWithAtPath(name, atPath);
otherObjects.add(otherObject);
return executionContext.addResult(this, otherObject);
}
use of org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath in project estatio by estatio.
the class DemoObjectWithAtPath_and_OtherObjectWithAtPath_create3 method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
// italian taxonomy applicable only to Italian DemoObject and OtherObject
Taxonomy italianColours = categoryRepository.createTaxonomy("Italian Colours");
italianColours.setReference("ITACOL");
Category italianRed = italianColours.addChild("Red", "RED", null);
Category italianGreen = italianColours.addChild("Green", "GREEN", null);
Category italianWhite = italianColours.addChild("White", "WHITE", null);
wrap(italianColours).applicable("/ITA", DemoObjectWithAtPath.class.getName());
wrap(italianColours).applicable("/ITA", OtherObjectWithAtPath.class.getName());
// french taxonomy applicable only to French DemoObject (and not to OtherObject even if with FRA app tenancy)
Taxonomy frenchColours = categoryRepository.createTaxonomy("French Colours");
frenchColours.setReference("FRCOL");
Category frenchRed = frenchColours.addChild("Red", "FRRED", null);
Category frenchWhite = frenchColours.addChild("White", "FRWHITE", null);
Category frenchBlue = frenchColours.addChild("Blue", "FRBLUE", null);
wrap(frenchColours).applicable("/FRA", DemoObjectWithAtPath.class.getName());
// global taxonomy applicable only to DemoObject (any app tenancy)
Taxonomy globalSizes = categoryRepository.createTaxonomy("Sizes");
globalSizes.setReference("SIZES");
Category large = globalSizes.addChild("Large", "LGE", 1);
Category medium = globalSizes.addChild("Medium", "M", 2);
Category small = globalSizes.addChild("Small", "SML", 3);
Category largeLargest = large.addChild("Largest", "XXL", 1);
Category largeLarger = large.addChild("Larger", "XL", 2);
Category largeLarge = large.addChild("Large", "L", 3);
Category smallSmall = small.addChild("Small", "S", 1);
Category smallSmaller = small.addChild("Smaller", "XS", 2);
Category smallSmallest = small.addChild("Smallest", "XXS", 3);
wrap(globalSizes).applicable("/", DemoObjectWithAtPath.class.getName());
// create a sample set of DemoObject and OtherObject, for various app tenancies
final DemoObjectWithAtPath demoFooInItaly = createDemo("Demo foo (in Italy)", "/ITA", executionContext);
final DemoObjectWithAtPath demoBarInFrance = createDemo("Demo bar (in France)", "/FRA", executionContext);
final DemoObjectWithAtPath demoBaz = createDemo("Demo baz (Global)", "/", executionContext);
final DemoObjectWithAtPath demoBip = createDemo("Demo bip (in Milan)", "/ITA/I-MIL", executionContext);
final DemoObjectWithAtPath demoBop = createDemo("Demo bop (in Paris)", "/FRA/F-PAR", executionContext);
final OtherObjectWithAtPath otherFooInItaly = createOther("Other foo (in Italy)", "/ITA", executionContext);
final OtherObjectWithAtPath otherBarInFrance = createOther("Other bar (in France)", "/FRA", executionContext);
final OtherObjectWithAtPath otherBaz = createOther("Other baz (Global)", "/", executionContext);
final OtherObjectWithAtPath otherBip = createOther("Other bip (in Milan)", "/ITA/I-MIL", executionContext);
final OtherObjectWithAtPath otherBop = createOther("Other bop (in Paris)", "/FRA/F-PAR", executionContext);
// classify DemoObject
wrap(mixin(ClassificationForDemoObjectWithAtPath.classify.class, demoFooInItaly)).classify(italianColours, italianRed);
wrap(mixin(ClassificationForDemoObjectWithAtPath.classify.class, demoFooInItaly)).classify(globalSizes, medium);
wrap(mixin(ClassificationForDemoObjectWithAtPath.classify.class, demoBarInFrance)).classify(globalSizes, smallSmaller);
// leave OtherObject unclassified
}
use of org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath in project estatio by estatio.
the class T_classify_IntegTest method cannot_classify_when_no_applicability_for_domain_type.
@Test
public void cannot_classify_when_no_applicability_for_domain_type() {
// given
OtherObjectWithAtPath otherBaz = otherObjectMenu.listAllOtherObjectsWithAtPath().stream().filter(otherObject -> otherObject.getName().equals("Other baz (Global)")).findFirst().get();
assertThat(applicabilityRepository.findByDomainTypeAndUnderAtPath(otherBaz.getClass(), otherBaz.getAtPath())).isEmpty();
final ClassificationForOtherObjectWithAtPath.classify classification = factoryService.mixin(ClassificationForOtherObjectWithAtPath.classify.class, otherBaz);
// when
final String message = classification.disableClassify().toString();
// then
assertThat(message).isEqualTo("tr: There are no classifications that can be added");
}
use of org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath in project estatio by estatio.
the class T_classify_IntegTest method cannot_classify_when_no_applicability_for_atPath.
@Test
public void cannot_classify_when_no_applicability_for_atPath() {
// given
OtherObjectWithAtPath otherBarInFrance = otherObjectMenu.listAllOtherObjectsWithAtPath().stream().filter(otherObject -> otherObject.getName().equals("Other bar (in France)")).findFirst().get();
assertThat(applicabilityRepository.findByDomainTypeAndUnderAtPath(otherBarInFrance.getClass(), otherBarInFrance.getAtPath())).isEmpty();
final ClassificationForOtherObjectWithAtPath.classify classification = factoryService.mixin(ClassificationForOtherObjectWithAtPath.classify.class, otherBarInFrance);
// when
final String message = classification.disableClassify().toString();
// then
assertThat(message).isEqualTo("tr: There are no classifications that can be added");
}
Aggregations