Search in sources :

Example 1 with OtherObjectWithAtPath

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");
}
Also used : ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) OtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath) ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) Test(org.junit.Test)

Example 2 with OtherObjectWithAtPath

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);
}
Also used : OtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath)

Example 3 with OtherObjectWithAtPath

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
}
Also used : ClassificationForDemoObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.demowithatpath.ClassificationForDemoObjectWithAtPath) ClassificationForDemoObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.demowithatpath.ClassificationForDemoObjectWithAtPath) DemoObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath) Category(org.incode.module.classification.dom.impl.category.Category) Taxonomy(org.incode.module.classification.dom.impl.category.taxonomy.Taxonomy) OtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath)

Example 4 with OtherObjectWithAtPath

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");
}
Also used : ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) OtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath) Test(org.junit.Test)

Example 5 with OtherObjectWithAtPath

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");
}
Also used : ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) ClassificationForOtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath) OtherObjectWithAtPath(org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath) Test(org.junit.Test)

Aggregations

OtherObjectWithAtPath (org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath)5 ClassificationForOtherObjectWithAtPath (org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.otherwithatpath.ClassificationForOtherObjectWithAtPath)3 Test (org.junit.Test)3 Category (org.incode.module.classification.dom.impl.category.Category)1 Taxonomy (org.incode.module.classification.dom.impl.category.taxonomy.Taxonomy)1 DemoObjectWithAtPath (org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath)1 ClassificationForDemoObjectWithAtPath (org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.demowithatpath.ClassificationForDemoObjectWithAtPath)1