X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fgraph%2Fcomponent%2FConnectRequiredProvidedEdgeFilterTest.java;h=53621c91c63bbe40999e56e8e252aebe38625945;hb=49ce7cb8387601982d5e6ef186ce206d38f6e3d7;hp=1b6ff0c2b51d8bc3a63c3638c24a064f7a187d5d;hpb=ddd261f331280640c5b53c7128230b629ebcd268;p=utils diff --git a/system/general/src/test/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilterTest.java b/system/general/src/test/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilterTest.java index 1b6ff0c2..53621c91 100644 --- a/system/general/src/test/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilterTest.java +++ b/system/general/src/test/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilterTest.java @@ -1,12 +1,12 @@ /* - * Copyright 2008 the original author or authors. - * + * Copyright 2005-2010 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,54 +30,34 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; - /** - * DOCUMENT ME! - * + * * @author $author$ * @version $Revision$ - */ + */ public class ConnectRequiredProvidedEdgeFilterTest extends TestCase { - /** - * DOCUMENT ME! - */ private Application app1 = new Application("app1", "pf1."); - /** - * DOCUMENT ME! - */ private Application app2 = new Application("app2", "pf2."); - /** - * DOCUMENT ME! - */ private Environment env1 = new Environment("env1", "pf3."); - /** - * DOCUMENT ME! - */ private Environment env2 = new Environment("env2", "pf4."); - /** - * DOCUMENT ME! - * - * @param aExpected DOCUMENT ME! - * @param aRestriction DOCUMENT ME! - */ private void compare(Boolean[] aExpected, EdgeFilter aRestriction) { List result = new ArrayList(); - // order will be: - // env1, app1 - // env1, app2 - // env2, app1 - // env2, app2 + // order will be: + // env1, app1 + // env1, app2 + // env2, app1 + // env2, app2 for (Environment env : new Environment[] { env1, env2 }) { for (Application app : new Application[] { app1, app2 }) { - Node from = new RequiredInterfaceNode(app, - app.getRequiredInterfaces().get(0)); - Node to = new ProvidedInterfaceNode(env, - env.getProvidedInterfaces().get(0)); + Node from = new RequiredInterfaceNode(app, app + .getRequiredInterfaces().get(0)); + Node to = new ProvidedInterfaceNode(env, env + .getProvidedInterfaces().get(0)); Edge edge = new DefaultEdge(from, to); result.add(aRestriction.isViolated(edge)); } @@ -86,55 +66,49 @@ public class ConnectRequiredProvidedEdgeFilterTest extends TestCase { assertEquals(Arrays.asList(aExpected), result); } - /** - * DOCUMENT ME! - */ public void testNoRestriction() { AssertionUtils.assertException(new AssertionUtils.ErroneousCode() { - @Override - public void run() throws Exception { - EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter(null, - null, null, null); - } - }, IllegalArgumentException.class); + @Override + public void run() throws Exception { + EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter( + null, null, null, null); + ignoredVariable(restriction); + } + }, IllegalArgumentException.class); AssertionUtils.assertException(new AssertionUtils.ErroneousCode() { - @Override - public void run() throws Exception { - EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter(null, - null, "x", "y"); - } - }, IllegalArgumentException.class); + @Override + public void run() throws Exception { + EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter( + null, null, "x", "y"); + ignoredVariable(restriction); + } + }, IllegalArgumentException.class); + } + + private static final void ignoredVariable(Object aObject) { + // for findbugs. } - /** - * DOCUMENT ME! - */ public void testClientServer() { EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter("app1", - null, "env1", null); + null, "env1", null); compare(new Boolean[] { false, false, true, false }, restriction); } - /** - * DOCUMENT ME! - */ public void testNoConnectionsAtAll() { EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter("app1", - null, null, null); + null, null, null); compare(new Boolean[] { true, false, true, false }, restriction); } - /** - * DOCUMENT ME! - */ public void testExplicitConfig() { - app1 = new Application("app1"); - app2 = new Application("app2"); - env1 = new Environment("env1"); - env2 = new Environment("env2"); + app1 = new Application("app1"); + app2 = new Application("app2"); + env1 = new Environment("env1"); + env2 = new Environment("env2"); EdgeFilter restriction = new ConnectRequiredProvidedEdgeFilter("app2", - "string", "env1", "datasource"); + "string", "env1", "datasource"); compare(new Boolean[] { false, false, false, true }, restriction); } }