Skip to content

Commit

Permalink
Fixing repo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 14, 2014
1 parent 5151e14 commit a385214
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions repo/repo-sql-impl-test/pom.xml
Expand Up @@ -65,9 +65,9 @@
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>jgrapht</groupId>
<artifactId>jgrapht</artifactId>
<version>0.8.1</version>
<groupId>org.javabits.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>0.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -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";
Expand All @@ -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);
Expand Down
Expand Up @@ -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());
Expand All @@ -578,11 +579,13 @@ protected void registerObject(ObjectType objectType, boolean registerChildrenLin
if (registerChildrenLinks) {
// let's check for existing children
List<String> 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) {
Expand Down
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion repo/repo-sql-impl-test/testng.xml
Expand Up @@ -47,7 +47,7 @@
<test name="Concurrency Tests" parallel="false" preserve-order="true" verbose="10" enabled="true">
<classes>
<class name="com.evolveum.midpoint.repo.sql.ConcurrencyTest"/>
<!--<class name="com.evolveum.midpoint.repo.sql.closure.OrgClosureConcurrencyTest"/>-->
<class name="com.evolveum.midpoint.repo.sql.closure.OrgClosureConcurrencyTest"/>
</classes>
</test>
<test name="Utils Tests" parallel="false" preserve-order="true" verbose="10" enabled="true">
Expand Down

0 comments on commit a385214

Please sign in to comment.