From a385214b384d749062eb2ef75390d6514ecfb4ec Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 14 Oct 2014 13:31:33 +0200 Subject: [PATCH] Fixing repo tests --- repo/repo-sql-impl-test/pom.xml | 6 +++--- .../midpoint/repo/sql/QueryInterpreterTest.java | 11 ++++++----- .../repo/sql/closure/AbstractOrgClosureTest.java | 3 +++ .../repo/sql/closure/OrgClosureConcurrencyTest.java | 4 ++-- repo/repo-sql-impl-test/testng.xml | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/repo/repo-sql-impl-test/pom.xml b/repo/repo-sql-impl-test/pom.xml index be4166b0885..8df882996ed 100644 --- a/repo/repo-sql-impl-test/pom.xml +++ b/repo/repo-sql-impl-test/pom.xml @@ -65,9 +65,9 @@ mysql-connector-java - jgrapht - jgrapht - 0.8.1 + org.javabits.jgrapht + jgrapht-core + 0.9.3 test diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java index e6fc493c7bd..83e0314bbf1 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java @@ -1104,10 +1104,12 @@ public void test310QueryNameAndOrg() throws Exception { Session session = open(); try { - DetachedCriteria detached = DetachedCriteria.forClass(ROrgClosure.class, "cl"); - detached.setProjection(Projections.distinct(Projections.property("cl.descendantOid"))); - detached.add(Restrictions.eq("cl.ancestorOid", "1234")); - detached.add(Restrictions.ne("cl.descendantOid", "1234")); + DetachedCriteria detached = DetachedCriteria.forClass(RParentOrgRef.class, "p"); + detached.setProjection(Projections.distinct(Projections.property("p.ownerOid"))); + detached.add(Property.forName("targetOid").in( + DetachedCriteria.forClass(ROrgClosure.class, "cl") + .setProjection(Projections.property("cl.descendantOid")) + .add(Restrictions.eq("cl.ancestorOid", "1234")))); Criteria main = session.createCriteria(RUser.class, "u"); String mainAlias = "u"; @@ -1130,7 +1132,6 @@ public void test310QueryNameAndOrg() throws Exception { c.add(Subqueries.propertyIn(mainAlias + ".oid", detached)); main.add(c); - main.addOrder(Order.asc("u.name.orig")); String expected = HibernateToSqlTranslator.toSql(main); diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java index bbeeecaaf81..81e7108aacd 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java @@ -564,6 +564,7 @@ protected void registerObject(ObjectType objectType, boolean registerChildrenLin return; } String oid = objectType.getOid(); + LOGGER.info("Registering {} into memory graph", oid); registerVertexIfNeeded(oid); for (ObjectReferenceType ort : objectType.getParentOrgRef()) { registerVertexIfNeeded(ort.getOid()); @@ -578,11 +579,13 @@ protected void registerObject(ObjectType objectType, boolean registerChildrenLin if (registerChildrenLinks) { // let's check for existing children List children = getOrgChildren(oid); + LOGGER.info("Registering children of {}: {} into memory graph", oid, children); for (String child : children) { registerVertexIfNeeded(child); orgGraph.addEdge(child, oid); } } + LOGGER.info("Registration of {} done.", oid); } private void registerVertexIfNeeded(String oid) { diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/OrgClosureConcurrencyTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/OrgClosureConcurrencyTest.java index 7df7bf79fbc..2ca51bf6e3f 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/OrgClosureConcurrencyTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/OrgClosureConcurrencyTest.java @@ -328,7 +328,7 @@ public void run() { } catch (ObjectNotFoundException e) { // this is OK info(Thread.currentThread().getName() + ": " + objectType + " already deleted"); - Thread.sleep(100); // give other threads a chance + Thread.sleep(300); // give other threads a chance } } } catch (Throwable e) { @@ -385,7 +385,7 @@ public void run() { } catch (ObjectAlreadyExistsException e) { // this is OK info(Thread.currentThread().getName() + ": " + objectType + " already exists"); - Thread.sleep(100); // give other threads a chance + Thread.sleep(300); // give other threads a chance } } } catch (Throwable e) { diff --git a/repo/repo-sql-impl-test/testng.xml b/repo/repo-sql-impl-test/testng.xml index 366e7712ba8..7234ec33f28 100644 --- a/repo/repo-sql-impl-test/testng.xml +++ b/repo/repo-sql-impl-test/testng.xml @@ -47,7 +47,7 @@ - +