Author: reinhard Date: Mon Oct 4 06:05:55 2004 New Revision: 51886 Added: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/wiring/ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/wiring/WiringBuilderTest.java Log: - work on XML mappings - some refactorings
Added: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/wiring/WiringBuilderTest.java ============================================================================== --- (empty file) +++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/wiring/WiringBuilderTest.java Mon Oct 4 06:05:55 2004 @@ -0,0 +1,60 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.blockdeployer.wiring; + +import java.io.File; +import java.util.Iterator; + +import org.apache.cocoon.blockdeployer.Constants; + +import junit.framework.TestCase; + +/** + * @since 0.1 + */ +public class WiringBuilderTest extends TestCase { + + public void testBuild() throws Exception { + File wiringFile = new File(Constants.WIRING_FILE); + Wiring wiring = null; + wiring = WiringBuilder.build(wiringFile); + + Iterator blockDescriptorIterator = wiring.getBlockDescriptors() + .iterator(); + while (blockDescriptorIterator.hasNext()) { + WiredBlockDescriptor descriptor = (WiredBlockDescriptor) blockDescriptorIterator + .next(); + System.out.print(" - id: " + descriptor.getId()); + System.out.println(", location: " + descriptor.getLocation()); + + Iterator propIterator = descriptor.getProperties().iterator(); + while(propIterator.hasNext()) { + WiredBlockProperty property = (WiredBlockProperty) propIterator.next(); + System.out.print(" property name: " + property.getName() + ", "); + System.out.println(" value: " + property.getValue()); + } + + Iterator connIterator = descriptor.getConnections().iterator(); + while(connIterator.hasNext()) { + WiredBlockConnection conn = (WiredBlockConnection) connIterator.next(); + System.out.print(" connection name: " + conn.getName() + ", "); + System.out.println(" id: " + conn.getConnectedBlockId()); + } + + } + } + +} \ No newline at end of file