tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r412484 - in /incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi: ./ extension/ loader/
Date Wed, 07 Jun 2006 18:49:01 GMT
Author: jmarino
Date: Wed Jun  7 11:49:01 2006
New Revision: 412484

URL: http://svn.apache.org/viewvc?rev=412484&view=rev
Log:
improve test coverage in spi

Added:
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
  (with props)
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
  (with props)
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
  (with props)
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
  (with props)
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/
    incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
  (with props)

Added: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java?rev=412484&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
(added)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
Wed Jun  7 11:49:01 2006
@@ -0,0 +1,45 @@
+package org.apache.tuscany.spi;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TuscanyExceptionTestCase extends TestCase {
+
+    public void testIdentifier() throws Exception{
+        TuscanyException e = new TestException();
+        e.setIdentifier("foo");
+        assertEquals("foo",e.getIdentifier());
+    }
+
+    public void testAddContext() throws Exception{
+        TuscanyException e = new TestException();
+        e.addContextName("foo");
+        e.addContextName("bar");
+        assertEquals("foo",e.returnContextNames().get(0));
+        assertEquals("bar",e.returnContextNames().get(1));
+    }
+
+    public void testEmptyContext() throws Exception{
+        TuscanyException e = new TestException();
+        assertEquals(0,e.returnContextNames().size());
+    }
+
+    public void testGetMessage() throws Exception{
+        TuscanyException e = new TestException();
+        e.getMessage();
+    }
+
+    public void testFullMessage() throws Exception{
+        TuscanyException e = new TestException();
+        e.setIdentifier("foo");
+        e.addContextName("foo");
+        e.getMessage();
+    }
+
+
+    private class TestException extends TuscanyException{
+
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java?rev=412484&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
(added)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
Wed Jun  7 11:49:01 2006
@@ -0,0 +1,45 @@
+package org.apache.tuscany.spi;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TuscanyRuntimeExceptionTestCase extends TestCase {
+
+    public void testIdentifier() throws Exception{
+        TuscanyRuntimeException e = new TestException();
+        e.setIdentifier("foo");
+        assertEquals("foo",e.getIdentifier());
+    }
+
+    public void testAddContext() throws Exception{
+        TuscanyRuntimeException e = new TestException();
+        e.addContextName("foo");
+        e.addContextName("bar");
+        assertEquals("foo",e.returnContextNames().get(0));
+        assertEquals("bar",e.returnContextNames().get(1));
+    }
+
+    public void testEmptyContext() throws Exception{
+        TuscanyRuntimeException e = new TestException();
+        assertEquals(0,e.returnContextNames().size());
+    }
+
+    public void testEmptyGetMessage() throws Exception{
+        TuscanyRuntimeException e = new TestException();
+        e.getMessage();
+    }
+
+    public void testFullMessage() throws Exception{
+        TuscanyRuntimeException e = new TestException();
+        e.setIdentifier("foo");
+        e.addContextName("foo");
+        e.getMessage();
+    }
+
+
+    private class TestException extends TuscanyRuntimeException{
+
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java?rev=412484&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
(added)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
Wed Jun  7 11:49:01 2006
@@ -0,0 +1,37 @@
+package org.apache.tuscany.spi.extension;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Implementation;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeLoaderExtensionTestCase extends MockObjectTestCase {
+
+    public void testRegistrationDeregistration() throws Exception {
+        Mock mock = mock(LoaderRegistry.class);
+        mock.expects(once()).method("registerLoader");
+        mock.expects(once()).method("unregisterLoader");
+        LoaderRegistry registry = (LoaderRegistry) mock.proxy();
+        Extension loader = new Extension();
+        loader.setLoaderRegistry(registry);
+        loader.start();
+        loader.stop();
+    }
+
+
+    private class Extension extends ComponentTypeLoaderExtension {
+
+        protected Class getImplementationClass() {
+            return null;
+        }
+
+        public void load(Implementation implementation, DeploymentContext deploymentContext)
throws LoaderException {
+
+        }
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java?rev=412484&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
(added)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
Wed Jun  7 11:49:01 2006
@@ -0,0 +1,42 @@
+package org.apache.tuscany.spi.extension;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+
+import org.jmock.MockObjectTestCase;
+import org.jmock.Mock;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LoaderExtensionTestCase extends MockObjectTestCase {
+
+    public void testRegistrationDeregistration() throws Exception {
+        Mock mock = mock(LoaderRegistry.class);
+        mock.expects(once()).method("registerLoader");
+        mock.expects(once()).method("unregisterLoader");
+        LoaderRegistry registry = (LoaderRegistry) mock.proxy();
+        LoaderExtensionTestCase.Extension loader = new LoaderExtensionTestCase.Extension();
+        loader.setRegistry(registry);
+        loader.start();
+        loader.stop();
+    }
+
+
+    private class Extension extends LoaderExtension {
+
+        protected QName getXMLType() {
+            return null;
+        }
+
+        public ModelObject load(XMLStreamReader reader, DeploymentContext deploymentContext)
throws XMLStreamException, LoaderException {
+            return null;
+        }
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java?rev=412484&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
(added)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
Wed Jun  7 11:49:01 2006
@@ -0,0 +1,15 @@
+package org.apache.tuscany.spi.loader;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LoaderExceptionTestCase extends TestCase {
+
+    public void testResourceURI() throws Exception{
+        LoaderException e = new LoaderException();
+        e.setResourceURI("test");
+        assertEquals("test",e.getResourceURI());
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message