summaryrefslogtreecommitdiff
path: root/bkucommon/src
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon/src')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java141
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java117
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java10
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java4
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java8
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java100
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java63
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java4
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java6
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java7
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java4
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java83
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java73
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java32
14 files changed, 403 insertions, 249 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java
index 17ce29ce..23f62134 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java
@@ -14,73 +14,76 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.binding;
-
-import java.io.InputStream;
-import java.util.Date;
-
-import at.gv.egiz.bku.slcommands.SLCommandInvoker;
-import at.gv.egiz.stal.STAL;
-
-public abstract class AbstractBindingProcessor implements BindingProcessor {
- protected Id id;
- protected STAL stal;
- protected SLCommandInvoker commandInvoker;
- protected long lastAccessedTime = System.currentTimeMillis();
-
- public AbstractBindingProcessor(String idString) {
- this.id = IdFactory.getInstance().createId(idString);
- }
-
- /**
- * @see java.lang.Thread#run()
- */
- public abstract void run();
-
- /**
- * The caller is advised to check the result in case an error occurred.
- *
- * @see #getResult()
- */
- public abstract void consumeRequestStream(InputStream aIs);
-
- public Id getId() {
- return id;
- }
-
- public STAL getSTAL() {
- return stal;
- }
-
- public SLCommandInvoker getCommandInvoker() {
- return commandInvoker;
- }
-
- public void updateLastAccessTime() {
- lastAccessedTime = System.currentTimeMillis();
- }
-
- public Date getLastAccessTime() {
- return new Date(lastAccessedTime);
- }
-
- /**
- * To be called after object creation.
- *
- * @param aStal
- * must not be null
- * @param aCommandInvoker
- * must not be null
- */
- public void init(STAL aStal, SLCommandInvoker aCommandInvoker) {
- if (aStal == null) {
- throw new NullPointerException("STAL must not be set to null");
- }
- if (aCommandInvoker == null) {
- throw new NullPointerException("Commandinvoker must not be set to null");
- }
- stal = aStal;
- commandInvoker = aCommandInvoker;
- Thread.currentThread().setName("BPID#"+getId().toString());
- }
+package at.gv.egiz.bku.binding;
+
+import at.gv.egiz.bku.conf.Configuration;
+import java.io.InputStream;
+import java.util.Date;
+
+import at.gv.egiz.bku.slcommands.SLCommandInvoker;
+import at.gv.egiz.stal.STAL;
+
+public abstract class AbstractBindingProcessor implements BindingProcessor {
+ protected Id id;
+ protected Configuration config;
+ protected STAL stal;
+ protected SLCommandInvoker commandInvoker;
+ protected long lastAccessedTime = System.currentTimeMillis();
+
+ public AbstractBindingProcessor(String idString) {
+ this.id = IdFactory.getInstance().createId(idString);
+ }
+
+ /**
+ * @see java.lang.Thread#run()
+ */
+ public abstract void run();
+
+ /**
+ * The caller is advised to check the result in case an error occurred.
+ *
+ * @see #getResult()
+ */
+ public abstract void consumeRequestStream(InputStream aIs);
+
+ public Id getId() {
+ return id;
+ }
+
+ public STAL getSTAL() {
+ return stal;
+ }
+
+ public SLCommandInvoker getCommandInvoker() {
+ return commandInvoker;
+ }
+
+ public void updateLastAccessTime() {
+ lastAccessedTime = System.currentTimeMillis();
+ }
+
+ public Date getLastAccessTime() {
+ return new Date(lastAccessedTime);
+ }
+
+ /**
+ * To be called after object creation.
+ *
+ * @param aStal
+ * must not be null
+ * @param aCommandInvoker
+ * must not be null
+ */
+ public void init(STAL aStal, SLCommandInvoker aCommandInvoker, Configuration conf) {
+ if (aStal == null) {
+ throw new NullPointerException("STAL must not be set to null");
+ }
+ if (aCommandInvoker == null) {
+ throw new NullPointerException("Commandinvoker must not be set to null");
+ }
+ config = conf;
+ stal = aStal;
+ commandInvoker = aCommandInvoker;
+ Thread.currentThread().setName("BPID#"+getId().toString());
+ }
} \ No newline at end of file
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java
index 2569bf85..0d978992 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java
@@ -14,64 +14,65 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.binding;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Date;
-import java.util.Locale;
-
-import at.gv.egiz.bku.slcommands.SLCommandInvoker;
-import at.gv.egiz.stal.STAL;
-
-/**
- * Represents an single instance of a SL HTTP binding.
- *
- * @author wbauer
- *
- */
-public interface BindingProcessor extends Runnable {
-
- /**
- * The stream must be read completely within this method.
- *
- * The caller is advised to check the result in case an error occurred.
- *
- * @see #getResult()
- */
- public void consumeRequestStream(InputStream aIs);
-
- /**
- * The unique Id of this http binding instance.
- * @return
- */
- public Id getId();
-
- /**
- * The used underlying STAL instance
- * @return
- */
- public STAL getSTAL();
-
- public SLCommandInvoker getCommandInvoker();
-
- public Date getLastAccessTime();
-
- public void updateLastAccessTime();
-
- public String getResultContentType();
-
- public void writeResultTo(OutputStream os, String encoding) throws IOException;
-
- public void init(STAL aStal, SLCommandInvoker aCommandInvoker);
-
- /**
- * Sets the preferred locale for userinteraction.
- * If the locale is not set the default locale will be used.
- * @param locale must not be null.
- */
+package at.gv.egiz.bku.binding;
+
+import at.gv.egiz.bku.conf.Configuration;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.Locale;
+
+import at.gv.egiz.bku.slcommands.SLCommandInvoker;
+import at.gv.egiz.stal.STAL;
+
+/**
+ * Represents an single instance of a SL HTTP binding.
+ *
+ * @author wbauer
+ *
+ */
+public interface BindingProcessor extends Runnable {
+
+ /**
+ * The stream must be read completely within this method.
+ *
+ * The caller is advised to check the result in case an error occurred.
+ *
+ * @see #getResult()
+ */
+ public void consumeRequestStream(InputStream aIs);
+
+ /**
+ * The unique Id of this http binding instance.
+ * @return
+ */
+ public Id getId();
+
+ /**
+ * The used underlying STAL instance
+ * @return
+ */
+ public STAL getSTAL();
+
+ public SLCommandInvoker getCommandInvoker();
+
+ public Date getLastAccessTime();
+
+ public void updateLastAccessTime();
+
+ public String getResultContentType();
+
+ public void writeResultTo(OutputStream os, String encoding) throws IOException;
+
+ public void init(STAL aStal, SLCommandInvoker aCommandInvoker, Configuration config);
+
+ /**
+ * Sets the preferred locale for userinteraction.
+ * If the locale is not set the default locale will be used.
+ * @param locale must not be null.
+ */
public void setLocale(Locale locale);
- public boolean isFinished();
+ public boolean isFinished();
} \ No newline at end of file
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
index 144416ed..bf9a63e2 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.binding;
+import at.gv.egiz.bku.conf.Configuration;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
@@ -49,6 +50,10 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager {
private static Log log = LogFactory.getLog(BindingProcessorManagerImpl.class);
+ /** spring injected config
+ * Passed to created bindingprocessors, to replace their configuration */
+ protected Configuration config;
+
protected STALFactory stalFactory;
protected SLCommandInvoker commandInvokerClass;
@@ -105,7 +110,7 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager {
* @param ci
* must not be null (prototype to generate new instances)
*/
- public BindingProcessorManagerImpl(STALFactory fab, SLCommandInvoker ci) {
+ public BindingProcessorManagerImpl(STALFactory fab, SLCommandInvoker ci, Configuration conf) {
if (fab == null) {
throw new NullPointerException("STALFactory must not be null");
}
@@ -114,6 +119,7 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager {
throw new NullPointerException("SLCommandInvoker must not be null");
}
commandInvokerClass = ci;
+ config = conf;
executorService = Executors.newCachedThreadPool();
}
@@ -213,7 +219,7 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager {
commandInvokerClass.newInstance(), url);
stalFactory.setLocale(locale);
STAL stal = stalFactory.createSTAL();
- bindingProcessor.init(stal, commandInvokerClass.newInstance());
+ bindingProcessor.init(stal, commandInvokerClass.newInstance(), config);
if (locale != null) {
bindingProcessor.setLocale(locale);
// stal.setLocale(locale);
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
index aaeacd98..1db8c836 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.binding;
+import at.gv.egiz.bku.conf.Configuration;
import at.gv.egiz.bku.conf.Configurator;
import java.net.MalformedURLException;
import java.net.URL;
@@ -42,6 +43,9 @@ public class DataUrl {
private static HostnameVerifier hostNameVerifier;
private URL url;
+ /** spring injected config, to replace configuration */
+ //private Configuration config;
+
/**
* Sets the default DataUrlConnection implementation
* @param aClass must not be null
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java
index cb11a3e6..ef603fc7 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java
@@ -87,12 +87,6 @@ public class HTTPBindingProcessor extends AbstractBindingProcessor implements
public final static Collection<String> XML_REQ_TRANSFER_ENCODING = Arrays
.asList(new String[] { "binary" });
- /**
- * Defines the maximum number of dataurl connects that are allowed within a
- * single SL Request processing.
- */
- protected static int MAX_DATAURL_HOPS = 80;
-
protected static String XML_MIME_TYPE = "text/xml";
protected static String BINARY_MIME_TYPE = "application/octet-stream";
@@ -592,7 +586,7 @@ public class HTTPBindingProcessor extends AbstractBindingProcessor implements
break;
case DATAURL:
handleDataUrl();
- if (++hopcounter > MAX_DATAURL_HOPS) {
+ if (++hopcounter > config.getMaxDataUrlHops()) {
log.error("Maximum number of dataurl hops reached");
bindingProcessorError = new SLBindingException(2000);
currentState = State.FINISHED;
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java
new file mode 100644
index 00000000..f813b14d
--- /dev/null
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java
@@ -0,0 +1,100 @@
+/*
+ * 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;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * BKU Common Configuration
+ *
+ * Injected to BKU Common classes as defined in mocca-conf.xml
+ *
+ * Replace at.gv.egiz.bku.conf.Configurator,
+ * currently only few configuration options are supported.
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class Configuration {
+
+ public static final int MAX_DATAURL_HOPS_DEFAULT = 50;
+ public static final String IMPLEMENTATION_NAME_DEFAULT = "MOCCA";
+ public static final String IMPLEMENTATION_VERSION_DEFAULT = "UNKNOWN";
+
+ private static final Log log = LogFactory.getLog(Configuration.class);
+
+ private int maxDataUrlHops = -1;
+ private String implementationName;
+ private String implementationVersion;
+
+ public void setMaxDataUrlHops(int maxDataUrlHops) {
+ this.maxDataUrlHops = maxDataUrlHops;
+ }
+
+ /**
+ * Defines the maximum number of dataurl connects that are allowed within a
+ * single SL Request processing.
+ */
+ public int getMaxDataUrlHops() {
+ if (maxDataUrlHops < 0) {
+ log.warn("maxDataUrlHops not configured, using default: " + MAX_DATAURL_HOPS_DEFAULT);
+ return MAX_DATAURL_HOPS_DEFAULT;
+ }
+ return maxDataUrlHops;
+ }
+
+ /**
+ * @return the implementationName
+ */
+ public String getImplementationName() {
+ if (implementationName == null) {
+ log.info("implementationName not configured, using default: " + IMPLEMENTATION_NAME_DEFAULT);
+ return "MOCCA";
+ }
+ return implementationName;
+ }
+
+ /**
+ * @param implementationName the implementationName to set
+ */
+ public void setImplementationName(String implementationName) {
+ this.implementationName = implementationName;
+ }
+
+ /**
+ * @return the implementationVersion
+ */
+ public String getImplementationVersion() {
+ if (implementationName == null) {
+ log.info("implementationName not configured, using default: " + IMPLEMENTATION_VERSION_DEFAULT);
+ return IMPLEMENTATION_VERSION_DEFAULT;
+ }
+ return implementationVersion;
+ }
+
+ /**
+ * @param implementationVersion the implementationVersion to set
+ */
+ public void setImplementationVersion(String implementationVersion) {
+ this.implementationVersion = implementationVersion;
+ }
+
+
+
+
+}
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 9481f0bc..22a7aa3b 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
@@ -14,35 +14,38 @@
* 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.*;
+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 {
-
- @Before
- public void setUp() {
- IdFactory.getInstance().setNumberOfBits(24*10);
- }
-
-
- @Test(expected = MalformedURLException.class)
- public void basicCreationTest() throws MalformedURLException {
- BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), new SLCommandInvokerImpl());
- 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);
- }
-
-}
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class BindingProcessorManagerTest {
+
+ @Before
+ public void setUp() {
+ IdFactory.getInstance().setNumberOfBits(24*10);
+ }
+
+
+ @Test(expected = MalformedURLException.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);
+ }
+
+}
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 87726c49..6e48e6fa 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,6 +20,8 @@
*/
package at.gv.egiz.bku.binding;
+import at.gv.egiz.bku.conf.Configuration;
+import at.gv.egiz.bku.conf.DummyConfiguration;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -71,7 +73,7 @@ public class DataUrlConnectionTest {
log.debug("setting up HTTPBindingProcessor");
manager = new BindingProcessorManagerImpl(new DummyStalFactory(),
- new SLCommandInvokerImpl());
+ new SLCommandInvokerImpl(), new DummyConfiguration());
bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor(
"http://www.iaik.at", null);
Map<String, String> headers = new HashMap<String, String>();
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
index dd315f7f..ee17f5e9 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java
@@ -16,6 +16,7 @@
*/
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;
@@ -35,6 +36,7 @@ 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;
@@ -51,7 +53,7 @@ public class EmptyMultipartSLRequestTest {
@Before
public void setUp() throws MalformedURLException, ClassNotFoundException {
manager = new BindingProcessorManagerImpl(new DummyStalFactory(),
- new SLCommandInvokerImpl());
+ new SLCommandInvokerImpl(), new DummyConfiguration());
HTTPBindingProcessor http = (HTTPBindingProcessor) manager
.createBindingProcessor("http://www.at/", null);
Map<String, String> headers = new HashMap<String, String>();
@@ -89,7 +91,7 @@ public class EmptyMultipartSLRequestTest {
@Test
public void testBasicNop() {
bindingProcessor.consumeRequestStream(dataStream);
- // manager.process(bindingProcessor);
+ // 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
index 18ccc11a..faf08c54 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java
@@ -16,6 +16,8 @@
*/
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;
@@ -25,8 +27,9 @@ 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 SLCommandInvokerImpl(), new DummyConfiguration());
BindingProcessor bp = manager.createBindingProcessor("http://www.at", null);
ExpiryRemover remover = new ExpiryRemover();
remover.setBindingProcessorManager(manager);
@@ -46,7 +49,7 @@ public class ExpiryRemoverTest {
@Test
public void testMe2() throws InterruptedException, MalformedURLException {
BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(),
- new SLCommandInvokerImpl());
+ new SLCommandInvokerImpl(), new DummyConfiguration());
BindingProcessor bp = manager.createBindingProcessor("http://www.iaik.at", null);
ExpiryRemover remover = new ExpiryRemover();
remover.setBindingProcessorManager(manager);
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 2130e7f1..d03e1807 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
@@ -33,6 +33,8 @@ 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 {
@@ -102,7 +104,7 @@ public class HttpBindingProcessorTest {
server.setResponseContent("<ok/>");
server.setResponseHeaders(serverHeaderMap);
manager = new BindingProcessorManagerImpl(new DummyStalFactory(),
- new SLCommandInvokerImpl());
+ new SLCommandInvokerImpl(), new DummyConfiguration());
bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor(
"http://www.iaik.at", null);
clientHeaderMap = new HashMap<String, String>();
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 2c48bf4e..1a9a6a70 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
@@ -14,45 +14,46 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.binding;
-
-import java.io.InputStream;
+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.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class MultipartSLRequestTest {
-
- protected String resourceName = "at/gv/egiz/bku/binding/MultipartFromTutorial.txt";
-
- protected BindingProcessor bindingProcessor;
- protected InputStream dataStream;
- protected BindingProcessorManager manager;
-
- @Before
- public void setUp() throws MalformedURLException {
- manager = new BindingProcessorManagerImpl(new DummyStalFactory(),
- new SLCommandInvokerImpl());
- HTTPBindingProcessor http = (HTTPBindingProcessor) manager
- .createBindingProcessor("http://www.at/", null);
- Map<String, String> headers = new HashMap<String, String>();
- headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA
- + ";boundary=---------------------------2330864292941");
- http.setHTTPHeaders(headers);
- dataStream = getClass().getClassLoader().getResourceAsStream(resourceName);
- bindingProcessor = http;
- }
-
- @Test
- public void testBasicNop() {
- bindingProcessor.consumeRequestStream(dataStream);
- // manager.process(bindingProcessor);
- bindingProcessor.run();
- }
-
-}
+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 {
+
+ protected String resourceName = "at/gv/egiz/bku/binding/MultipartFromTutorial.txt";
+
+ 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<String, String> headers = new HashMap<String, String>();
+ headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA
+ + ";boundary=---------------------------2330864292941");
+ 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/NullOperationTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java
index b2a7d387..58c82c49 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java
@@ -14,40 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.binding;
-
-import java.io.InputStream;
+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());
- HTTPBindingProcessor http = (HTTPBindingProcessor) manager.createBindingProcessor("http://www.at/", null);
- Map<String, String> headers = new HashMap<String, String>();
- 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();
- }
-
-}
+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<String, String> headers = new HashMap<String, String>();
+ 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/conf/DummyConfiguration.java b/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java
new file mode 100644
index 00000000..1e0e5aa9
--- /dev/null
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java
@@ -0,0 +1,32 @@
+/*
+ * 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 <clemens.orthacker@iaik.tugraz.at>
+ */
+public class DummyConfiguration extends Configuration {
+
+ public DummyConfiguration() {
+ this.setMaxDataUrlHops(MAX_DATAURL_HOPS_DEFAULT);
+ //this.set...
+ }
+
+
+}