Skip to content

Commit

Permalink
Revert "JNG-5778 Add missing ancestor joind on count"
Browse files Browse the repository at this point in the history
This reverts commit 26ba5bc.
  • Loading branch information
robertcsakany committed Oct 20, 2024
1 parent 26ba5bc commit a829a6d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
* #L%
*/

import com.google.common.base.Strings;
import com.google.inject.Inject;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.a.A;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.a.ADao;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.a.AForCreate;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.a.AMask;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.b.B;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.b.BDao;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.b.BForCreate;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.c.C;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.c.CDao;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.filtercountmodel.filtercountmodel.c.CForCreate;
import hu.blackbelt.judo.psm.generator.sdk.core.test.guice.FilterCountModelDaoModules;
import hu.blackbelt.judo.requirement.report.annotation.Requirement;
import hu.blackbelt.judo.runtime.core.jsl.fixture.JudoRuntimeExtension;
import hu.blackbelt.judo.runtime.core.jsl.fixture.JudoRuntimeFixture;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -57,40 +57,34 @@ public class FilterCountTest {
CDao cDao;

@Test
@Disabled("https://blackbelt.atlassian.net/browse/JNG-5778")
void testAncestorFilterCount(JudoRuntimeFixture fixture) {
// Filter on the entity attributes inherited from the ancestor and count the matched ones.

C c = cDao.create(CForCreate.builder().withNum(2).build());

B b = bDao.create(BForCreate.builder().withName("B").build());

A a = aDao.create(AForCreate.builder()
.withName("A")
.withAncestorName("PA")
.withNumb(2).withC(c)
.withAncestorB(b).build());
// A a = aDao.create(AForCreate.builder().withName("A").withAncestorName("PA").withNumb(2).withC(c).withAncestorB(b).build());
A a = aDao.create(AForCreate.builder().withAncestorName("PA").build());

assertEquals("A", a.getName().orElseThrow());
// assertEquals("A", a.getName().orElseThrow());
assertEquals("PA", a.getAncestorName().orElseThrow());
assertEquals("B", a.getAncestorBName().orElseThrow());
assertEquals("B", a.getBname().orElseThrow());
// assertEquals("B", a.getAncestorBName().orElseThrow());
// assertEquals("B", a.getBname().orElseThrow());

fixture.commitTransaction();
fixture.beginTransaction();

log.debug("\n" + Strings.repeat("=", 40) + "\nFilter by: this.ancestorBName!like('B')");
assertEquals(1, aDao.query().filterBy("this.ancestorBName!like('B')").maskedBy(AMask.aMask()).selectList().size());
assertEquals(1, aDao.query().filterBy("this.ancestorBName!like('B')").count()); // TODO: https://blackbelt.atlassian.net/browse/JNG-5778
log.debug("\n" + Strings.repeat("=", 40) + "\nFilter by: this.ancestorName!like('PA')");
assertEquals(1, aDao.query().filterBy("this.ancestorName!like('PA')").maskedBy(AMask.aMask()).selectList().size());

// aDao.query().filterBy("this.ancestorBName!like('B')").selectList();

// assertEquals(1, aDao.query().filterBy("this.ancestorBName!like('B')").count());
assertEquals(1, aDao.query().filterBy("this.ancestorName!like('PA')").selectList().size());
assertEquals(1, aDao.query().filterBy("this.ancestorName!like('PA')").count());
log.debug("\n" + Strings.repeat("=", 40) + "\nFilter by: this.bname!like('B')");
assertEquals(1, aDao.query().filterBy("this.bname!like('B')").maskedBy(AMask.aMask()).selectList().size());
assertEquals(1, aDao.query().filterBy("this.bname!like('B')").count()); // TODO: https://blackbelt.atlassian.net/browse/JNG-5778
log.debug("\n" + Strings.repeat("=", 40) + "\nFilter by: this.name!like('A')");
assertEquals(1, aDao.query().filterBy("this.name!like('A')").maskedBy(AMask.aMask()).selectList().size());
assertEquals(1, aDao.query().filterBy("this.name!like('A')").count());
log.debug("\n" + Strings.repeat("=", 40) + "\nFilter by: this.cnum == 2");
assertEquals(1, aDao.query().filterBy("this.cnum == 2").maskedBy(AMask.aMask()).selectList().size());
assertEquals(1, aDao.query().filterBy("this.cnum == 2").count());
// assertEquals(1, aDao.query().filterBy("this.bname!like('B')").count());
// assertEquals(1, aDao.query().filterBy("this.name!like('A')").count());
// assertEquals(1, aDao.query().filterBy("this.cnum == 2").count());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import judo::types;

entity ParentA {
field String ancestorName;
relation B ancestorB;
field String ancestorBName <= self.ancestorB.name;
// relation B ancestorB;
// field String ancestorBName <= self.ancestorB.name;
}

entity A extends ParentA {
field String name;
field Integer numb;
relation C[] cs;
relation C c;
field String bname <= self.ancestorB.name;
field Integer sum <= self.cs.sum(c | c.num);
field Integer cnum <= self.c.num;
// field String name;
// field Integer numb;
// relation C[] cs;
// relation C c;
// field String bname <= self.ancestorB.name;
// field Integer sum <= self.cs.sum(c | c.num);
// field Integer cnum <= self.c.num;
}

entity B {
Expand Down

0 comments on commit a829a6d

Please sign in to comment.