public MultipleRootException(Scope scope) { super(String.format("Scope %s is a new root in TP scope forest. Only one root is allowed in this configuration.", scope.getName())); } }
public ThreadSafeProviderImpl(Scope scope, Class<T> clazz, String name, boolean isLazy) { this.scope = new WeakReference<>(scope); this.scopeName = scope.getName().toString(); this.clazz = clazz; this.name = name; this.isLazy = isLazy; }
throw new IllegalBindingException(format("Class %s cannot be bound." + " It has a scope annotation: %s that is not supported by current scope: %s", clazz.getName(), annotationType.getName(), scope.getName()));
@Override public void doRun() { //pick a random node in the tree, starting from root //add a new child node to this node Scope scopeName = NodeUtil.findRandomNode(scopeNames, ACCEPTANCE_THRESHOLD); if (scopeName == null) { setIsSuccessful(true); return; } Object name = scopeName.getName(); Object newScopeName = new Object(); scopeNames.add(newScopeName); Toothpick.openScopes(name, newScopeName); setIsSuccessful(true); } }
@Override public void doRun() { //pick a random node in the tree, starting from root //add a new child node to this node Scope scopeName = NodeUtil.findRandomNode(rootScopeName, ACCEPTANCE_THRESHOLD); if (scopeName == null) { setIsSuccessful(true); return; } Object name = scopeName.getName(); Toothpick.openScopes(name, new Object()); setIsSuccessful(true); } }
@Test public void testScopeNameSetByConstruction() throws Exception { assertThat(toothPickRule.getScope(), notNullValue()); assertThat(toothPickRule.getScope().getName(), is((Object) "Foo")); assertThat(toothPickRule.getTestModule(), notNullValue()); }
@Test public void testSetScopeName() throws Exception { toothPickRuleWithoutScopeName.setScopeName("Bar"); assertThat(toothPickRuleWithoutScopeName.getScope(), notNullValue()); assertThat(toothPickRuleWithoutScopeName.getScope().getName(), is((Object) "Bar")); assertThat(toothPickRuleWithoutScopeName.getTestModule(), notNullValue()); } }
public MultipleRootException(Scope scope) { super(String.format("Scope %s is a new root in TP scope forest. Only one root is allowed in this configuration.", scope.getName())); } }
public ThreadSafeProviderImpl(Scope scope, Class<T> clazz, String name, boolean isLazy) { this.scope = new WeakReference<>(scope); this.scopeName = scope.getName().toString(); this.clazz = clazz; this.name = name; this.isLazy = isLazy; }
@Override public void doRun() { //pick a random node in the tree, starting from root //add a new child node to this node Scope scope = NodeUtil.findRandomNode(scopeNames, ACCEPTANCE_THRESHOLD); if (scope == null) { setIsSuccessful(true); return; } //remove any node except root if (scope.getParentScope() == null) { setIsSuccessful(true); return; } Object scopeName = scope.getName(); Toothpick.closeScope(scopeName); setIsSuccessful(true); } }
@Override public void doRun() { //pick a random node in the tree, starting from root //add a new child node to this node Scope scope = NodeUtil.findRandomNode(rootScopeName, ACCEPTANCE_THRESHOLD); if (scope == null) { setIsSuccessful(true); return; } //remove any node except root if (scope.getParentScope() == null) { setIsSuccessful(true); return; } Object scopeName = scope.getName(); Toothpick.closeScope(scopeName); setIsSuccessful(true); } }
throw new IllegalBindingException(format("Class %s cannot be bound." + " It has a scope annotation: %s that is not supported by current scope: %s", clazz.getName(), annotationType.getName(), scope.getName()));