Github user geomacy commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/390#discussion_r85193147
--- Diff:
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/dsl/DslTest.java
---
@@ -118,39 +160,64 @@ public void runConcurrentWorker(Supplier<Runnable>
taskSupplier) {
}
private static class DslTestWorker implements Runnable {
- protected TestApplication parent;
- protected BrooklynDslDeferredSupplier<?> dsl;
+ protected final TestApplication parent;
+ protected final BrooklynDslDeferredSupplier<?> dsl;
+ protected final Class<?> type;
protected EntitySpec<TestEntity> childSpec =
EntitySpec.create(TestEntity.class);
- protected Class<?> type;
-
+ protected int resolverIterations = MANY_RESOLVER_ITERATIONS;
+ protected boolean eventually = false;
+ private boolean wrapInTaskForImmediately = true;
+
public DslTestWorker(TestApplication parent,
BrooklynDslDeferredSupplier<?> dsl, Class<?> type) {
- this.parent = parent;
- this.dsl = dsl;
- this.type = type;
+ this.parent = checkNotNull(parent, "parent");
+ this.dsl = checkNotNull(dsl, "dsl");
+ this.type = checkNotNull(type, "type");
}
+ public DslTestWorker resolverIterations(int val) {
+ resolverIterations = val;
+ return this;
+ }
+
+ public DslTestWorker eventually(boolean val) {
+ eventually = val;
+ return this;
+ }
+
+ public DslTestWorker wrapInTaskForImmediately(boolean val) {
+ wrapInTaskForImmediately = val;
+ return this;
+ }
+
@Override
public void run() {
- TestEntity entity = parent.createAndManageChild(childSpec);
- for (int i = 0; i < RESOLVER_ITERATIONS; i++) {
+ TestEntity entity = parent.addChild(childSpec);
+ for (int i = 0; i < resolverIterations; i++) {
preResolve(entity);
--- End diff --
Do you not want to do this under an "if(eventually)"?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---