summaryrefslogtreecommitdiff
path: root/bkucommon/src/test/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon/src/test/java/at/gv')
-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
8 files changed, 159 insertions, 113 deletions
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...
+ }
+
+
+}