From b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 5 May 2010 15:29:01 +0000 Subject: Merged feature branch mocca-1.2.13-id@r724 back to trunk. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@725 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/accesscontroller/ConfigTest.java | 7 +- .../bku/binding/AbstractBindingProcessorTest.java | 77 ++++++++ .../bku/binding/BindingProcessorManagerTest.java | 27 +-- .../gv/egiz/bku/binding/DataUrlConnectionTest.java | 39 ++-- .../at/gv/egiz/bku/binding/DummyStalFactory.java | 38 ---- .../bku/binding/EmptyMultipartSLRequestTest.java | 98 ---------- .../at/gv/egiz/bku/binding/ExpiryRemoverTest.java | 70 ------- .../java/at/gv/egiz/bku/binding/FormDataTest.java | 90 +++++++++ .../egiz/bku/binding/HttpBindingProcessorTest.java | 81 ++++---- .../bku/binding/MultiTestDataUrlConnection.java | 5 + .../egiz/bku/binding/MultipartSLRequestTest.java | 78 ++++++-- .../at/gv/egiz/bku/binding/NullOperationTest.java | 54 ------ .../egiz/bku/binding/SSLDataUrlConnectionTest.java | 18 +- .../gv/egiz/bku/binding/TestDataUrlConnection.java | 212 +++++++++------------ .../bku/binding/XWWWFormUrlInputIteratorTest.java | 4 - .../at/gv/egiz/bku/conf/CertValidatorTest.java | 35 ---- .../at/gv/egiz/bku/conf/DummyConfiguration.java | 32 ---- .../egiz/bku/slcommands/SLCommandFactoryTest.java | 17 +- .../impl/CreateXMLSignatureComandImplTest.java | 61 +++--- .../slcommands/impl/InfoboxReadComandImplTest.java | 47 +++-- .../impl/SVPersonendatenInfoboxImplTest.java | 66 ++++--- .../bku/slcommands/impl/xsect/SignatureTest.java | 110 +++++------ .../test/java/at/gv/egiz/stal/dummy/DummySTAL.java | 13 +- .../at/gv/egiz/stal/dummy/DummyStalFactory.java | 38 ++++ .../at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt | 2 +- .../egiz/bku/slcommands/impl/TransformsInfo_2.xml | 2 +- .../egiz/bku/slcommands/testApplicationContext.xml | 156 ++++++++++++--- .../src/test/resources/commons-logging.properties | 1 - 28 files changed, 730 insertions(+), 748 deletions(-) create mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java create mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java delete mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java create mode 100644 bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java delete mode 100644 bkucommon/src/test/resources/commons-logging.properties (limited to 'bkucommon/src/test') diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java index bce3cdd9..88832753 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java @@ -7,7 +7,6 @@ import org.junit.Test; import at.gv.egiz.bku.slcommands.InfoboxReadCommand; import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLResult; -import at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLException; import static org.junit.Assert.*; @@ -20,7 +19,6 @@ public class ConfigTest { static class MyInfoBox implements InfoboxReadCommand { private String domainId; private String boxId; - private String name; public MyInfoBox(String identifier, String domainId) { this.boxId = identifier; @@ -38,12 +36,11 @@ public class ConfigTest { } @Override - public SLResult execute() { + public SLResult execute(SLCommandContext commandContext) { return null; } public void setName(String name) { - this.name = name; } @Override @@ -52,7 +49,7 @@ public class ConfigTest { } @Override - public void init(SLCommandContext ctx, Object unmarshalledRequest) + public void init(Object unmarshalledRequest) throws SLCommandException { } } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java new file mode 100644 index 00000000..409d2611 --- /dev/null +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java @@ -0,0 +1,77 @@ +/* +* Copyright 2009 Federal Chancellery Austria and +* Graz University of Technology +* +* 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 at.gv.egiz.bku.binding; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import iaik.security.ecc.provider.ECCProvider; +import iaik.security.provider.IAIK; +import iaik.xml.crypto.XSecProvider; + +import java.security.Security; + +import org.junit.BeforeClass; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import at.gv.egiz.bku.slcommands.SLCommandInvoker; +import at.gv.egiz.stal.STAL; + +public abstract class AbstractBindingProcessorTest { + + protected static AbstractApplicationContext ctx; + + @BeforeClass + public static void setUpClass() { + Security.insertProviderAt(new IAIK(), 1); + Security.insertProviderAt(new ECCProvider(false), 2); + XSecProvider.addAsProvider(false); + + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( + "at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + assertNotNull(ctx); + HttpBindingProcessorTest.ctx = ctx; + } + + protected static BindingProcessorManager getBindingProcessorManager() { + Object bean = ctx.getBean("bindingProcessorManager"); + assertTrue(bean instanceof BindingProcessorManagerImpl); + BindingProcessorManagerImpl manager = (BindingProcessorManagerImpl) bean; + + assertNotNull(manager.getCommandInvoker()); + assertNotNull(manager.getStalFactory()); + return manager; + } + + public static BindingProcessor createBindingProcessor(String protocol) { + + BindingProcessorManagerImpl manager = (BindingProcessorManagerImpl) getBindingProcessorManager(); + + assertNotNull(manager.getCommandInvoker()); + assertNotNull(manager.getStalFactory()); + + BindingProcessor bindingProcessor = manager.createBindingProcessor(protocol); + SLCommandInvoker commandInvoker = manager.getCommandInvoker().newInstance(); + STAL stal = manager.getStalFactory().createSTAL(); + bindingProcessor.init("test", stal, commandInvoker); + + return bindingProcessor; + + } + +} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java index 22a7aa3b..d4c91560 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java @@ -16,36 +16,19 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; import static org.junit.Assert.*; import java.net.MalformedURLException; -import org.junit.Before; import org.junit.Test; -public class BindingProcessorManagerTest { +public class BindingProcessorManagerTest extends AbstractBindingProcessorTest { - @Before - public void setUp() { - IdFactory.getInstance().setNumberOfBits(24*10); - } - - - @Test(expected = MalformedURLException.class) + @Test(expected = IllegalArgumentException.class) public void basicCreationTest() throws MalformedURLException { - //TODO for the moment empty config sufficient (currently only maxDataURLHops configured) - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.at/", null); - assertNotNull(bp.getId().toString()); - assertEquals(40, bp.getId().toString().length()); - String hansi = "Hansi"; - bp = manager.createBindingProcessor("http://www.iaik.at",hansi); - assertEquals(hansi, bp.getId().toString()); - bp = manager.createBindingProcessor("HtTp://www.iaik.at", null); - assertNotNull(bp); - manager.createBindingProcessor("seppl", null); + assertNotNull(createBindingProcessor("http")); + assertNotNull(createBindingProcessor("HtTp")); + createBindingProcessor("seppl"); } } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java index 6e48e6fa..215af8da 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java @@ -20,8 +20,8 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; +import static org.junit.Assert.*; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -35,13 +35,15 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import at.gv.egiz.bku.slexceptions.SLException; + import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; @@ -51,20 +53,20 @@ import com.sun.net.httpserver.HttpServer; * * @author clemens */ -public class DataUrlConnectionTest { +public class DataUrlConnectionTest extends AbstractBindingProcessorTest { public static final String REQUEST_RESOURCE = "at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt"; - private static final Log log = LogFactory.getLog(DataUrlConnectionTest.class); + private final Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); static HttpServer server; - static BindingProcessor bindingProcessor; - static BindingProcessorManager manager; + static HTTPBindingProcessorImpl bindingProcessor; protected InputStream requestStream; @BeforeClass public static void setUpHTTPServer() throws IOException { + Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); log.debug("setting up HTTPServer"); InetSocketAddress addr = new InetSocketAddress("localhost", 8081); server = HttpServer.create(addr, 0); @@ -72,14 +74,12 @@ public class DataUrlConnectionTest { server.start(); log.debug("setting up HTTPBindingProcessor"); - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor( - "http://www.iaik.at", null); + bindingProcessor = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + Map headers = new HashMap(); headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + ";boundary=---------------------------2330864292941"); - ((HTTPBindingProcessor) bindingProcessor).setHTTPHeaders(headers); + ((HTTPBindingProcessorImpl) bindingProcessor).setHTTPHeaders(headers); } @Before @@ -91,6 +91,7 @@ public class DataUrlConnectionTest { @AfterClass public static void stopServer() { if (server != null) { + Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); log.debug("stopping HTTPServer"); server.stop(0); } @@ -98,9 +99,12 @@ public class DataUrlConnectionTest { @Test public void testBasicNop() { - bindingProcessor.consumeRequestStream(requestStream); - // manager.process(bindingProcessor); + bindingProcessor.consumeRequestStream("http://localhost:3495/http-security-layer-request", requestStream); bindingProcessor.run(); + SLException e = bindingProcessor.bindingProcessorError; + if (e != null) { + fail(e.getMessage()); + } } // @Test @@ -109,8 +113,7 @@ public class DataUrlConnectionTest { URL dataUrl = new URL("http://localhost:8081/"); log.debug("creating DataUrlConnection " + dataUrl.toString()); - DataUrlConnectionImpl c = new DataUrlConnectionImpl(); - c.init(dataUrl); + DataUrlConnectionImpl c = new DataUrlConnectionImpl(dataUrl); c.setHTTPHeader("httpHeader_1", "001"); ByteArrayInputStream bais = new ByteArrayInputStream("Hello, world!" @@ -124,6 +127,8 @@ public class DataUrlConnectionTest { static class DataUrlHandler implements HttpHandler { + private final Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); + public DataUrlHandler() { log.debug("setting up DataUrlHandler"); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java deleted file mode 100644 index f832f364..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* 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 at.gv.egiz.bku.binding; - -import java.util.Locale; - -import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.STALFactory; - -public class DummyStalFactory implements STALFactory { - - @Override - public STAL createSTAL() { - // TODO Auto-generated method stub - return new at.gv.egiz.stal.dummy.DummySTAL(); - } - - @Override - public void setLocale(Locale locale) { - // TODO Auto-generated method stub - - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java deleted file mode 100644 index ee17f5e9..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * 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 at.gv.egiz.bku.binding; - -import at.gv.egiz.bku.conf.Configuration; -import iaik.security.ecc.provider.ECCProvider; -import iaik.security.provider.IAIK; -import iaik.xml.crypto.XSecProvider; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.security.Provider; -import java.security.Security; -import java.security.Provider.Service; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Before; -import org.junit.Test; - -import at.gv.egiz.bku.conf.Configurator; -import at.gv.egiz.bku.conf.DummyConfiguration; -import at.gv.egiz.bku.slcommands.SLCommandFactory; -import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider; - -public class EmptyMultipartSLRequestTest { - - private static Log log = LogFactory.getLog(EmptyMultipartSLRequestTest.class); - - protected String resourceName = "at/gv/egiz/bku/binding/MultipartEmpty.txt"; - - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; - - @Before - public void setUp() throws MalformedURLException, ClassNotFoundException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager - .createBindingProcessor("http://www.at/", null); - Map headers = new HashMap(); - headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA - + ";boundary=uW10q_I9UeqKyw-1o5EW4jtEAaGs7-mC6o"); - http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; - Map commandMap = new HashMap(); - commandMap - .put( - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#:CreateXMLSignatureRequest", - "at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl"); - commandMap - .put( - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxReadRequest", - "at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl"); - SLCommandFactory.getInstance().setCommandImpl(commandMap); - Security.insertProviderAt(new IAIK(), 1); - Security.insertProviderAt(new ECCProvider(false), 2); - XSecProvider.addAsProvider(false); - // registering STALProvider as delegation provider for XSECT - STALProvider stalProvider = new STALProvider(); - Security.addProvider(stalProvider); - Set services = stalProvider.getServices(); - StringBuilder sb = new StringBuilder(); - for (Service service : services) { - String algorithm = service.getType() + "." + service.getAlgorithm(); - XSecProvider.setDelegationProvider(algorithm, stalProvider.getName()); - sb.append("\n" + algorithm); - } - log.debug(sb); - } - - @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - // manager.process(bindingProcessor); - bindingProcessor.run(); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java deleted file mode 100644 index faf08c54..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* 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 at.gv.egiz.bku.binding; - -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; -import java.net.MalformedURLException; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExpiryRemoverTest { - - @Test - public void testMe() throws InterruptedException, MalformedURLException { - //TODO for the moment empty config sufficient (currently only maxDataURLHops configured) - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.at", null); - ExpiryRemover remover = new ExpiryRemover(); - remover.setBindingProcessorManager(manager); - remover.execute(); - manager.process(bp); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - remover.setMaxAcceptedAge(1000); - Thread.sleep(100); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - Thread.sleep(910); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 0); - } - - @Test - public void testMe2() throws InterruptedException, MalformedURLException { - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.iaik.at", null); - ExpiryRemover remover = new ExpiryRemover(); - remover.setBindingProcessorManager(manager); - remover.execute(); - manager.process(bp); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - remover.setMaxAcceptedAge(1000); - Thread.sleep(500); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - bp.updateLastAccessTime(); - Thread.sleep(510); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java new file mode 100644 index 00000000..4f6e0664 --- /dev/null +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java @@ -0,0 +1,90 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* 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 at.gv.egiz.bku.binding; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; + +import org.junit.Test; +import static org.junit.Assert.*; + +import at.gv.egiz.bku.binding.FormDataURLSupplier; +import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.bku.utils.urldereferencer.StreamData; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl; + +public class FormDataTest implements FormDataURLSupplier { + + protected InputStream testStream = null; + protected String contentType = null; + protected String paramName = ""; + + @Override + public InputStream getFormData(String parameterName) { + if (paramName.equals(parameterName)) { + return testStream; + } else { + return null; + } + } + + @Override + public String getFormDataContentType(String parameterName) { + if (paramName.equals(parameterName)) { + return contentType; + } else { + return null; + } + } + + @Test(expected = MalformedURLException.class) + public void testInvalidFormdataUrl() throws IOException { + String url = "abs://whatknowi"; + FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this); + StreamData sd = dereferencer.dereference(url); + assertNull(sd); + url = ":://whatknowi"; + sd = URLDereferencerImpl.getInstance().dereference(url); + assertNull(sd); + url = ""; + sd = URLDereferencerImpl.getInstance().dereference(url); + } + + @Test + public void testFormData() throws IOException { + paramName = "Müllcontainer"; + testStream = new ByteArrayInputStream("HelloWorld".getBytes("UTF-8")); + String url = "formdata:"+paramName; + FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this); + StreamData sd = dereferencer.dereference(url); + assertNotNull(sd); + String result = StreamUtil.asString(sd.getStream(), "UTF-8"); + assertEquals("HelloWorld", result); + } + + @Test(expected=IOException.class) + public void testFormDataNotFound() throws IOException { + paramName = "Müllcontainer"; + testStream = new ByteArrayInputStream("HelloWorld".getBytes("UTF-8")); + String url = "formdata:"+paramName+"2"; + FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this); + dereferencer.dereference(url); + } + +} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java index d03e1807..994fd1de 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java @@ -21,23 +21,18 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; import at.gv.egiz.bku.binding.MultiTestDataUrlConnection.DataSourceProvider; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; -import at.gv.egiz.bku.utils.StreamUtil; -public class HttpBindingProcessorTest { +public class HttpBindingProcessorTest extends AbstractBindingProcessorTest { public static class TestDataSource implements DataSourceProvider { @@ -80,33 +75,32 @@ public class HttpBindingProcessorTest { } } - protected BindingProcessorManager manager; - protected HTTPBindingProcessor bindingProcessor; + protected static String requestUrl = "http://localhost:3495/http-security-layer-request"; + protected static String dataUrl = "http://localhost:8080/dataUrl"; + + protected HTTPBindingProcessorImpl bindingProcessor; protected Map serverHeaderMap; protected Map clientHeaderMap; protected TestDataUrlConnection server; - protected static ApplicationContext appCtx; - - @BeforeClass - public static void setUpClass() { - appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); - } - - @Before public void setUp() throws IOException { - server = new TestDataUrlConnection(); - DataUrl.setDataUrlConnectionImpl(server); + + DataUrl.setConnectionFactory(new DataURLConnectionFactory() { + @Override + public DataUrlConnection openConnection(URL url) { + return server; + } + }); serverHeaderMap = new HashMap(); serverHeaderMap.put("Content-Type", HttpUtil.TXT_XML); + server = new TestDataUrlConnection(new URL(dataUrl)); server.setResponseCode(200); server.setResponseContent(""); server.setResponseHeaders(serverHeaderMap); - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor( - "http://www.iaik.at", null); + + bindingProcessor = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + clientHeaderMap = new HashMap(); clientHeaderMap.put("Content-Type", "application/x-www-form-urlencoded;charset=utf8"); @@ -123,12 +117,14 @@ public class HttpBindingProcessorTest { public void testWithoutDataUrlWithoutStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm("Haßnsi", "Wüurzel"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); + String result = resultAsString("UTF-8"); + System.out.println(result); assertTrue(resultAsString("UTF-8").indexOf("NullOperationResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertEquals(0, bindingProcessor.getResponseHeaders().size()); + assertEquals(2, bindingProcessor.getResponseHeaders().size()); } @Test @@ -137,19 +133,19 @@ public class HttpBindingProcessorTest { rf.addForm("Hansi", "Wurzel"); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); rf.addForm(RequestFactory.STYLESHEETURL, "formdata:Styleshit"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertEquals(HttpUtil.TXT_HTML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullKommaJosef") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertEquals(0, bindingProcessor.getResponseHeaders().size()); + assertEquals(2, bindingProcessor.getResponseHeaders().size()); } @Test public void testWithDataUrl301WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(301); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -166,7 +162,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl302WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(302); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -183,7 +179,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl303WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(303); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -200,7 +196,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl306WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(306); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -210,14 +206,14 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("ErrorResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() == 0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); } @Test public void testWithDataUrl307NonXML() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(307); serverHeaderMap.put("Content-Type", HttpUtil.TXT_PLAIN); server.setResponseHeaders(serverHeaderMap); @@ -229,14 +225,14 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_PLAIN, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullOperationRequest") != -1); assertEquals(307, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() > 0); + assertTrue(bindingProcessor.getResponseHeaders().size() > 2); } @Test public void testWithInvalidDataUrl307XML() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(307); serverHeaderMap.put("Content-Type", HttpUtil.TXT_XML); serverHeaderMap.put("Location", "noUrl"); @@ -247,13 +243,12 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("ErrorResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() == 0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); } @Test public void testWithValidDataUrl307XML() throws IOException, InterruptedException { - server = new MultiTestDataUrlConnection(); - DataUrl.setDataUrlConnectionImpl(server); + server = new MultiTestDataUrlConnection(null); TestDataSource tds = new TestDataSource(); ((MultiTestDataUrlConnection)server).setDataSource(tds); @@ -275,7 +270,7 @@ public class HttpBindingProcessorTest { rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertTrue(bindingProcessor.getResponseHeaders().size()>0); @@ -290,7 +285,7 @@ public class HttpBindingProcessorTest { RequestFactory rf = new RequestFactory(); rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(200); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -298,7 +293,7 @@ public class HttpBindingProcessorTest { server.setResponseHeaders(serverHeaderMap); server.setResponseContent(rf.getURLencodedAsString()); bindingProcessor.run(); - assertTrue(bindingProcessor.getResponseHeaders().size()==0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); assertEquals(200,bindingProcessor.getResponseCode()); assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullOperationResponse") != -1); @@ -309,7 +304,7 @@ public class HttpBindingProcessorTest { RequestFactory rf = new RequestFactory(); rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(200); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -318,7 +313,7 @@ public class HttpBindingProcessorTest { server.setResponseHeaders(serverHeaderMap); server.setResponseContent(rf.getURLencodedAsString()); bindingProcessor.run(); - assertTrue(bindingProcessor.getResponseHeaders().size()==0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); assertEquals(200,bindingProcessor.getResponseCode()); assertEquals(HttpUtil.TXT_HTML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullKommaJosef") != -1); diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java index 5d2a7544..363757d7 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java @@ -17,10 +17,15 @@ package at.gv.egiz.bku.binding; import java.io.IOException; +import java.net.URL; import java.util.Map; public class MultiTestDataUrlConnection extends TestDataUrlConnection { + public MultiTestDataUrlConnection(URL url) { + super(url); + } + public static interface DataSourceProvider { public Map getResponseHeaders(); public String getResponseContent(); diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java index 1a9a6a70..0ac23c69 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java @@ -16,44 +16,80 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.DummyConfiguration; +import static org.junit.Assert.*; + import java.io.InputStream; import java.net.MalformedURLException; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; import java.util.Map; -import org.junit.Before; import org.junit.Test; -public class MultipartSLRequestTest { +public class MultipartSLRequestTest extends AbstractBindingProcessorTest { - protected String resourceName = "at/gv/egiz/bku/binding/MultipartFromTutorial.txt"; + @Test + public void testMultipartFromTutorial() throws MalformedURLException { - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); - @Before - public void setUp() throws MalformedURLException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager - .createBindingProcessor("http://www.at/", null); Map headers = new HashMap(); headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + ";boundary=---------------------------2330864292941"); http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/MultipartFromTutorial.txt"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + assertNotNull(http.bindingProcessorError); + assertEquals(4011, http.bindingProcessorError.getErrorCode()); + } @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - // manager.process(bindingProcessor); - bindingProcessor.run(); + public void testMultipartEmpty() throws MalformedURLException, ClassNotFoundException { + + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + + Map headers = new HashMap(); + headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + + ";boundary=uW10q_I9UeqKyw-1o5EW4jtEAaGs7-mC6o"); + http.setHTTPHeaders(headers); + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/MultipartEmpty.txt"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + if (http.bindingProcessorError != null) { + fail(http.bindingProcessorError.getMessage()); + } + + } + + @Test + public void testNulloperationRequest() throws MalformedURLException, ClassNotFoundException { + + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + + Map headers = new HashMap(); + headers.put("Content-Type", "application/x-www-form-urlencoded"); + http.setHTTPHeaders(headers); + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/NulloperationRequest.txt.bin"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + if (http.bindingProcessorError != null) { + fail(http.bindingProcessorError.getMessage()); + } + } + } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java deleted file mode 100644 index 58c82c49..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* 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 at.gv.egiz.bku.binding; - -import at.gv.egiz.bku.conf.DummyConfiguration; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -public class NullOperationTest { - - protected String resourceName = "at/gv/egiz/bku/binding/NulloperationRequest.txt.bin"; - - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; - - @Before - public void setUp() throws MalformedURLException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager.createBindingProcessor("http://www.at/", null); - Map headers = new HashMap(); - headers.put("Content-Type", "application/x-www-form-urlencoded"); - http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; - } - - @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - //manager.process(bindingProcessor); - bindingProcessor.run(); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java index 79757244..ae146bfe 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java @@ -16,24 +16,22 @@ */ package at.gv.egiz.bku.binding; -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; -import java.net.URL; - +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + import org.junit.Ignore; -import org.junit.Test; +import org.junit.Test; @Ignore public class SSLDataUrlConnectionTest { @Test public void testVerisign() throws IOException { - URL url = new URL("https://www.verisign.com:443"); - DataUrlConnectionImpl uc = new DataUrlConnectionImpl(); - uc.init(url); + DataUrl dataUrl = new DataUrl("https://www.verisign.com:443"); + HttpsDataURLConnection uc = (HttpsDataURLConnection) dataUrl.openConnection(); uc.connect(); - assertNotNull(uc.getServerCertificate()); + assertNotNull(uc.getServerCertificates()); //uc.transmit(null); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java index 0a24b5c5..a83fff17 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java @@ -14,137 +14,111 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.SocketTimeoutException; -import java.net.URL; -import java.security.cert.X509Certificate; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; +package at.gv.egiz.bku.binding; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocketFactory; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Ignore; - -import at.gv.egiz.bku.slcommands.SLResult; - -@Ignore -public class TestDataUrlConnection implements DataUrlConnectionSPI { - - - protected Log log = LogFactory.getLog(TestDataUrlConnection.class); - protected X509Certificate serverCertificate; - protected Map responseHeaders = Collections.EMPTY_MAP; - protected Map requestHeaders = new HashMap(); - protected String responseContent = ""; - protected int responseCode = 200; - - protected URL url; - - @Override - public void init(URL url) { - log.debug("Init Testdataurlconnection to url: " + url); - this.url = url; - } - - @Override - public void connect() throws SocketTimeoutException, IOException { - log.debug("Dummy connect to Testdataurlconnection to url: " + url); - - } - - @Override - public String getProtocol() { - return url.getProtocol(); - } - - @Override - public DataUrlResponse getResponse() throws IOException { - String ct = responseHeaders.get(HttpUtil.HTTP_HEADER_CONTENT_TYPE); - if (ct != null) { - ct = HttpUtil.getCharset(ct, true); - } else { - ct = HttpUtil.DEFAULT_CHARSET; - } - DataUrlResponse response = new DataUrlResponse(url.toString(), responseCode, new ByteArrayInputStream(responseContent.getBytes(ct))); - response.setResponseHttpHeaders(responseHeaders); - return response; - } - - @Override - public X509Certificate getServerCertificate() { - return serverCertificate; - } - - @Override - public void setHTTPFormParameter(String name, InputStream data, - String contentType, String charSet, String transferEncoding) { - // TODO Auto-generated method stub - } - - @Override - public void setHTTPHeader(String key, String value) { - requestHeaders.put(key, value); - } - - @Override - public void transmit(SLResult slResult) throws IOException { - log.debug("Dummy transmit to url: " + url); - } - - public void setServerCertificate(X509Certificate serverCertificate) { - this.serverCertificate = serverCertificate; - } - - public void setResponseHeaders(Map responseHeaders) { - this.responseHeaders = responseHeaders; - } - - public void setResponseContent(String responseContent) { - this.responseContent = responseContent; - } - - public void setResponseCode(int responseCode) { - this.responseCode = responseCode; - } - - public Map getRequestHeaders() { - return requestHeaders; - } - - @Override - public DataUrlConnectionSPI newInstance() { - return this; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.junit.Ignore; + +import at.gv.egiz.bku.slcommands.SLResult; + +@Ignore +public class TestDataUrlConnection extends HttpsDataURLConnection { + + protected final Logger log = LoggerFactory.getLogger(TestDataUrlConnection.class); + protected X509Certificate serverCertificate; + protected Map responseHeaders = Collections.emptyMap(); + protected Map requestHeaders = new HashMap(); + protected String responseContent = ""; + protected int responseCode = 200; + + public TestDataUrlConnection(URL url) { + super(url); } + - @Override - public URL getUrl() { - return url; - } + @Override + public void connect() throws SocketTimeoutException, IOException { + log.debug("Dummy connect to Testdataurlconnection to url: " + url); + + } @Override - public void setConfiguration(Properties config) { - // TODO Auto-generated method stub - + public DataUrlResponse getResponse() throws IOException { + String ct = responseHeaders.get(HttpUtil.HTTP_HEADER_CONTENT_TYPE); + if (ct != null) { + ct = HttpUtil.getCharset(ct, true); + } else { + ct = HttpUtil.DEFAULT_CHARSET; + } + DataUrlResponse response = new DataUrlResponse("" + url, responseCode, new ByteArrayInputStream(responseContent.getBytes(ct))); + response.setResponseHttpHeaders(responseHeaders); + return response; + } + + @Override + public void setHTTPFormParameter(String name, InputStream data, + String contentType, String charSet, String transferEncoding) { + } + + @Override + public void setHTTPHeader(String key, String value) { + requestHeaders.put(key, value); + } + + @Override + public void transmit(SLResult slResult) throws IOException { + log.debug("Dummy transmit to url: " + url); + } + + public void setServerCertificate(X509Certificate serverCertificate) { + this.serverCertificate = serverCertificate; + } + + public void setResponseHeaders(Map responseHeaders) { + this.responseHeaders = responseHeaders; + } + + public void setResponseContent(String responseContent) { + this.responseContent = responseContent; + } + + public void setResponseCode(int responseCode) { + this.responseCode = responseCode; + } + + public Map getRequestHeaders() { + return requestHeaders; } @Override public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { - // TODO Auto-generated method stub - } @Override public void setSSLSocketFactory(SSLSocketFactory socketFactory) { - // TODO Auto-generated method stub - - } - } + } + + + @Override + public Certificate[] getServerCertificates() + throws SSLPeerUnverifiedException, IllegalStateException { + return new Certificate[] {serverCertificate}; + } + + } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java index 4d81f038..57484fa8 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java @@ -4,17 +4,13 @@ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; -import java.nio.CharBuffer; -import java.nio.channels.FileChannel; import java.nio.charset.Charset; import org.junit.Ignore; diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java deleted file mode 100644 index d97d741d..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package at.gv.egiz.bku.conf; - -import iaik.x509.X509Certificate; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.cert.CertificateException; - -import static org.junit.Assert.*; - -import org.junit.Before; -import org.junit.Test; - -public class CertValidatorTest { - - private CertValidator cv; - - @Before - public void setUp() throws URISyntaxException { - cv = new CertValidatorImpl(); - URL caDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/CACerts"); - URL certDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/certStore"); - cv.init(new File(caDir.toURI()), new File(certDir.toURI())); - } - - @Test - public void testValid() throws CertificateException, IOException { - X509Certificate cert = new X509Certificate(getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/conf/certs/testCerts/www.a-trust.at.der")); - assertTrue(cv.isCertificateValid("TID", new X509Certificate[]{cert})); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java b/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java deleted file mode 100644 index 1e0e5aa9..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * 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 at.gv.egiz.bku.conf; - -/** - * - * @author Clemens Orthacker - */ -public class DummyConfiguration extends Configuration { - - public DummyConfiguration() { - this.setMaxDataUrlHops(MAX_DATAURL_HOPS_DEFAULT); - //this.set... - } - - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java index 7a087b38..4b89880d 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java @@ -34,13 +34,11 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; -import at.gv.egiz.stal.dummy.DummySTAL; public class SLCommandFactoryTest { protected static ApplicationContext appCtx; - SLCommandFactory factory; - SLCommandContext context; + protected SLCommandFactory factory; @BeforeClass public static void setUpClass() { @@ -49,9 +47,10 @@ public class SLCommandFactoryTest { @Before public void setUp() { - factory = SLCommandFactory.getInstance(); - context = new SLCommandContext(); - context.setSTAL(new DummySTAL()); + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; } @Test @@ -60,7 +59,7 @@ public class SLCommandFactoryTest { ""); Source source = new StreamSource(requestReader); - SLCommand slCommand = factory.createSLCommand(source, context); + SLCommand slCommand = factory.createSLCommand(source); assertTrue(slCommand instanceof NullOperationCommand); } @@ -71,7 +70,7 @@ public class SLCommandFactoryTest { ""); Source source = new StreamSource(requestReader); - factory.createSLCommand(source, context); + factory.createSLCommand(source); } @@ -83,7 +82,7 @@ public class SLCommandFactoryTest { ""); Source source = new StreamSource(requestReader); - factory.createSLCommand(source, context); + factory.createSLCommand(source); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java index 4e9b4cd7..4f56b423 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertTrue; import iaik.xml.crypto.XSecProvider; import java.io.InputStream; -import java.security.Security; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; @@ -29,41 +28,56 @@ import javax.xml.transform.stream.StreamSource; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import at.gv.egiz.bku.slcommands.CreateXMLSignatureCommand; +import at.gv.egiz.bku.slcommands.ErrorResult; import at.gv.egiz.bku.slcommands.InfoboxReadCommand; import at.gv.egiz.bku.slcommands.SLCommand; import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLCommandFactory; import at.gv.egiz.bku.slcommands.SLResult; -import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore public class CreateXMLSignatureComandImplTest { - private SLCommandFactory factory; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; + + private URLDereferencer urlDereferencer; - private STAL stal; - @BeforeClass public static void setUpClass() { - - new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); - - Security.addProvider(new STALProvider()); + appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); XSecProvider.addAsProvider(true); } @Before public void setUp() { - factory = SLCommandFactory.getInstance(); - stal = new DummySTAL(); + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; + } @Test @@ -71,33 +85,34 @@ public class CreateXMLSignatureComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/createxmlsignaturerequest/CreateXMLSignatureRequest.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof CreateXMLSignatureCommand); - SLResult result = command.execute(); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLResult result = command.execute(context); result.writeTo(new StreamResult(System.out), false); } -// @Test(expected=SLCommandException.class) + @Test(expected=SLCommandException.class) public void testInfboxReadRequestInvalid1() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); } -// @Test(expected=SLCommandException.class) + @Test public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); - assertTrue(command instanceof InfoboxReadCommand); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); + assertTrue(command instanceof InfoboxReadCommandImpl); + + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLResult result = command.execute(context); + assertTrue(result instanceof ErrorResult); } } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java index bfc784f7..814ef8a9 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java @@ -40,18 +40,20 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore public class InfoboxReadComandImplTest { - private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; + + private URLDereferencer urlDereferencer; - private SLCommandFactory factory; - - private STAL stal; - @BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); @@ -59,8 +61,20 @@ public class InfoboxReadComandImplTest { @Before public void setUp() { - factory = SLCommandFactory.getInstance(); - stal = new DummySTAL(); + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; } @Test @@ -68,12 +82,12 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); result.writeTo(new StreamResult(System.out), false); } @@ -82,9 +96,7 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); } @@ -92,12 +104,11 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); assertTrue(result instanceof ErrorResult); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java index a17f0797..2627de72 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.slcommands.impl; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import iaik.asn1.CodingException; +import iaik.xml.crypto.XSecProvider; import java.io.IOException; import java.io.InputStream; @@ -29,7 +30,8 @@ import javax.xml.bind.Marshaller; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import org.junit.Ignore; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -47,8 +49,9 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore public class SVPersonendatenInfoboxImplTest { @@ -70,22 +73,37 @@ public class SVPersonendatenInfoboxImplTest { (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x5a }; - private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; - private SLCommandFactory factory; - - private STAL stal; - -// @BeforeClass + private URLDereferencer urlDereferencer; + + @BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + XSecProvider.addAsProvider(true); } + + @Before + public void setUp() { + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; -// @Before - public void setUp() { - factory = SLCommandFactory.getInstance(); - stal = new DummySTAL(); - } + } @Test public void testEHIC() throws SLCommandException, JAXBException, CodingException, IOException { @@ -102,44 +120,38 @@ public class SVPersonendatenInfoboxImplTest { } - @Ignore @Test public void testInfboxReadRequest() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); result.writeTo(new StreamResult(System.out), false); } - @Ignore @Test(expected=SLCommandException.class) public void testInfboxReadRequestInvalid1() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); } - @Ignore + @Test public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); assertTrue(result instanceof ErrorResult); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java index 0a34c8f3..6a413483 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java @@ -73,14 +73,11 @@ import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLViewerException; import at.gv.egiz.bku.utils.urldereferencer.StreamData; import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl; import at.gv.egiz.bku.utils.urldereferencer.URLProtocolHandler; import at.gv.egiz.dom.DOMUtils; import at.gv.egiz.slbinding.RedirectEventFilter; import at.gv.egiz.slbinding.RedirectUnmarshallerListener; -import org.junit.Ignore; -import org.w3c.dom.NodeList; -import static org.junit.Assert.*; public class SignatureTest { @@ -135,6 +132,8 @@ public class SignatureTest { private static X509Certificate certificate; + private static URLDereferencer urlDereferencer; + @BeforeClass public static void setUpClass() throws JAXBException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException { @@ -161,14 +160,16 @@ public class SignatureTest { certificate = (X509Certificate) keystore.getCertificate(firstAlias); privateKey = (PrivateKey) keystore.getKey(firstAlias, passwd); + urlDereferencer = URLDereferencerImpl.getInstance(); + } private static void initURLDereferencer() { - URLDereferencer.getInstance().registerHandler("testlocal", new URLProtocolHandler() { + URLDereferencerImpl.getInstance().registerHandler("testlocal", new URLProtocolHandler() { @Override - public StreamData dereference(String url, URLDereferencerContext context) + public StreamData dereference(String url) throws IOException { ClassLoader classLoader = SignatureTest.class.getClassLoader(); @@ -237,12 +238,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private SignatureInfoCreationType unmarshalSignatureInfo(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -259,7 +259,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -281,7 +281,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -301,7 +301,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_3.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -321,7 +321,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_XMLContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -341,7 +341,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Reference_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -362,12 +362,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private List unmarshalDataObjectInfo(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -397,19 +396,17 @@ public class SignatureTest { output.setByteStream(System.out); LSSerializer serializer = domImplLS.createLSSerializer(); -// serializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); serializer.getDomConfig().setParameter("namespaces", Boolean.FALSE); serializer.write(document, output); } - @SuppressWarnings("unchecked") @Test public void testDataObject_Base64Content_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Base64Content_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -427,10 +424,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -443,16 +440,14 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test - public void testDataObject_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { System.out.println("\n ****************** testDataObject_XMLContent_1 \n"); List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -470,10 +465,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -486,7 +481,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_XMLContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -494,7 +488,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -512,10 +506,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -529,7 +523,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_LocRefContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -537,7 +530,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -553,10 +546,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -569,7 +562,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_LocRefContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -577,7 +569,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -593,10 +585,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -609,7 +601,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Reference_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -617,7 +608,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Reference_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -633,10 +624,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -649,7 +640,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -657,7 +647,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -673,7 +663,7 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List objects = signature.getXMLObjects(); @@ -682,7 +672,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_Base64Content() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -690,7 +679,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_Base64Content.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -700,13 +689,13 @@ public class SignatureTest { signAndMarshalSignature(signature); - List references = signature.getReferences(); + List references = signature.getReferences(); assertTrue(references.size() == 2); - Reference reference = references.get(0); + Reference reference = (Reference) references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List objects = signature.getXMLObjects(); @@ -715,7 +704,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_LocRefContent() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -723,7 +711,7 @@ public class SignatureTest { List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_LocRefContent.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -739,7 +727,7 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List objects = signature.getXMLObjects(); @@ -754,12 +742,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private CreateXMLSignatureRequestType unmarshalCreateXMLSignatureRequest(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -768,13 +755,12 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testTransformsInfo_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); signature.setSignatureInfo(requestType.getSignatureInfo()); @@ -797,10 +783,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue("Size " + transforms.size() + "", transforms.size() == 3); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.ENVELOPED.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); @@ -809,14 +795,12 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test - @Ignore public void testTransformsInfo_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); signature.setSignatureInfo(requestType.getSignatureInfo()); @@ -839,10 +823,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List transforms = reference.getTransforms(); + List transforms = reference.getTransforms(); assertTrue("Size " + transforms.size() + "", transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XSLT.equals(transform.getAlgorithm())); List objects = signature.getXMLObjects(); diff --git a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java index 8adeadee..e4ffdb9d 100644 --- a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java +++ b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java @@ -27,10 +27,9 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; -import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.InfoboxReadRequest; @@ -43,7 +42,7 @@ import at.gv.egiz.stal.SignResponse; public class DummySTAL implements STAL { - static Log log = LogFactory.getLog(DummySTAL.class); + private final Logger log = LoggerFactory.getLogger(DummySTAL.class); protected X509Certificate cert = null; protected PrivateKey privateKey = null; @@ -66,7 +65,7 @@ public class DummySTAL implements STAL { } } } catch (Exception e) { - log.error(e); + log.error("Failed to create DummySTAL.", e); } } @@ -113,7 +112,7 @@ public class DummySTAL implements STAL { infoboxReadResponse.setInfoboxValue(cert.getEncoded()); response = infoboxReadResponse; } catch (CertificateEncodingException e) { - log.error(e); + log.error("Failed to encode certificate.", e); response = new ErrorResponse(); } } else { @@ -136,7 +135,7 @@ public class DummySTAL implements STAL { resp.setSignatureValue(sigVal); responses.add(resp); } catch (Exception e) { - log.error(e); + log.error("Failed to create signature.", e); responses.add(new ErrorResponse()); } diff --git a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java new file mode 100644 index 00000000..b8e3fff4 --- /dev/null +++ b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java @@ -0,0 +1,38 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* 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 at.gv.egiz.stal.dummy; + +import java.util.Locale; + +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALFactory; + +public class DummyStalFactory implements STALFactory { + + @Override + public STAL createSTAL() { + // TODO Auto-generated method stub + return new at.gv.egiz.stal.dummy.DummySTAL(); + } + + @Override + public void setLocale(Locale locale) { + // TODO Auto-generated method stub + + } + +} diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt b/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt index fb8cc1c3..5d401009 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt @@ -43,5 +43,5 @@ MyHeader:veryUgly -----------------------------2330864292941 Content-Disposition: form-data; name="DataURL" -http://localhost:8080/ +http://localhost:8081/ -----------------------------2330864292941-- diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml index f43dc61a..c45c91aa 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml @@ -267,7 +267,7 @@ - + diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml index a7b588aa..b20202ad 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml @@ -15,38 +15,134 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bkucommon/src/test/resources/commons-logging.properties b/bkucommon/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/bkucommon/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger -- cgit v1.2.3