Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
new refactor on Mule class.. no more public constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
porcelli committed Aug 9, 2011
1 parent 0a03446 commit 2ad6010
Show file tree
Hide file tree
Showing 48 changed files with 238 additions and 233 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/org/mule/config/dsl/Mule.java
Expand Up @@ -39,14 +39,17 @@ public final class Mule {
private final MuleAdvancedConfig advancedConfig;
private final Map<String, FlowInterfaceHandler> flowCache;

public static Mule newInstance(final Module... modules){
return new Mule(modules);
}

/**
* @param modules array of non-null {@link Module}s
* @throws NullPointerException if any of given {@code modules} is null
* @throws IllegalArgumentException if {@code modules} is empty
*/
public Mule(final Module... modules) throws NullPointerException, IllegalArgumentException {
private Mule(final Module... modules) throws NullPointerException, IllegalArgumentException {
checkContentsNotNull(modules, "modules");

if (modules.length < 1) {
throw new IllegalArgumentException("At least one module should be provided.");
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/test/java/org/mule/config/dsl/TestBridgeFlow.java
Expand Up @@ -30,7 +30,7 @@ public class TestBridgeFlow {

@Test
public void simpleBridge() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -75,7 +75,7 @@ public void configure() {

@Test
public void simpleEchoBridge() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -130,7 +130,7 @@ public void configure() {

@Test
public void simpleServiceBridgeObjectInstance() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
final SimpleCallable myCallable = new SimpleCallable();
Expand Down Expand Up @@ -202,7 +202,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void testDucplicatedFlows() {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
final SimpleCallable myCallable = new SimpleCallable();
Expand Down
14 changes: 7 additions & 7 deletions core/src/test/java/org/mule/config/dsl/TestCustomFilter.java
Expand Up @@ -28,7 +28,7 @@ public class TestCustomFilter {

@Test
public void customFilterByType() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -72,7 +72,7 @@ public void configure() {

@Test
public void customFilterByInstance() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -118,7 +118,7 @@ public void configure() {
public void customFilterByInjector() throws MuleException, InterruptedException {
final MyFilter filter = new MyFilter();

final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -164,7 +164,7 @@ public void configure() {

@Test
public void customFilterByReflection() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -208,7 +208,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidConstructor() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -220,7 +220,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidTypeNull() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -232,7 +232,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidInstanceNull() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class TestCustomTransformer {

@Test
public void customTransformerByType() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -68,7 +68,7 @@ public void configure() {

@Test
public void customTransformerByInstance() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {

Expand Down Expand Up @@ -111,7 +111,7 @@ public void configure() {
public void customTransformerByInjector() throws MuleException, InterruptedException {
final MyTransformer transformer = new MyTransformer();

final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -153,7 +153,7 @@ public void configure() {

@Test
public void customTransformerByReflection() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -193,7 +193,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidConstructor() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -205,7 +205,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidTypeNull() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -217,7 +217,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void invalidInstanceNull() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/org/mule/config/dsl/TestEcho.java
Expand Up @@ -28,7 +28,7 @@ public class TestEcho {

@Test
public void simpleEcho() throws Exception {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -78,7 +78,7 @@ public void configure() {

@Test
public void simpleEchoChain() throws Exception {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/org/mule/config/dsl/TestExecuteFlow.java
Expand Up @@ -28,7 +28,7 @@ public class TestExecuteFlow {

@Test
public void simpleExecuteFlow() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("Receiver")
Expand Down Expand Up @@ -102,7 +102,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleExecuteFlowEmpty() {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("Receiver")
Expand All @@ -114,7 +114,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleExecuteFlowNull() {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("Receiver")
Expand Down
28 changes: 14 additions & 14 deletions core/src/test/java/org/mule/config/dsl/TestExecuteScript.java
Expand Up @@ -28,7 +28,7 @@ public class TestExecuteScript {

@Test
public void simpleExecuteScript() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -75,7 +75,7 @@ public void configure() {

@Test
public void simpleExecuteScriptLang() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -122,7 +122,7 @@ public void configure() {

@Test
public void simpleExecuteScriptLangClasspath() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -169,7 +169,7 @@ public void configure() {

@Test
public void simpleExecuteScriptLangFile() throws MuleException, InterruptedException {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -216,7 +216,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -228,7 +228,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleEmpty() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -240,7 +240,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull2() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -252,7 +252,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleEmpty2() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -264,7 +264,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull3() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -276,7 +276,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleEmpty3() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -288,7 +288,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull4() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -300,7 +300,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleEmpty4() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -312,7 +312,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull5() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand All @@ -324,7 +324,7 @@ public void configure() {

@Test(expected = RuntimeException.class)
public void simpleNull6() throws MuleException, InterruptedException {
new Mule(new AbstractModule() {
Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down
Expand Up @@ -31,7 +31,7 @@ public class TestExpressionFilter {

@Test
public void testChainFilterExpression() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class TestExpressionTransform {

@Test
public void testSimpleExpressionTransform() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down Expand Up @@ -81,7 +81,7 @@ public void configure() {

@Test
public void testChainExpressionTransform() {
final MuleContext muleContext = new Mule(new AbstractModule() {
final MuleContext muleContext = Mule.newInstance(new AbstractModule() {
@Override
public void configure() {
flow("MyFlow")
Expand Down

0 comments on commit 2ad6010

Please sign in to comment.