You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scout-dev@ws.apache.org by jb...@apache.org on 2004/12/26 02:38:24 UTC

svn commit: r123352 - /webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java /webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/infomodel/PersonNameTest.java

Author: jboynes
Date: Sat Dec 25 17:38:22 2004
New Revision: 123352

URL: http://svn.apache.org/viewcvs?view=rev&rev=123352
Log:
fix for SCOUT-4: Level 1 PersonName methods must throw UnsupportedCapabilityException
Added:
   webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/infomodel/PersonNameTest.java
Modified:
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java?view=diff&rev=123352&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java&r1=123351&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java&r2=123352
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java	(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/PersonNameImpl.java	Sat Dec 25 17:38:22 2004
@@ -17,6 +17,7 @@
 package org.apache.ws.scout.registry.infomodel;
 
 import javax.xml.registry.JAXRException;
+import javax.xml.registry.UnsupportedCapabilityException;
 
 /**
  * Implements JAXR Interface.
@@ -24,13 +25,9 @@
  *
  * @author Anil Saldhana  <an...@apache.org>
  */
-public class PersonNameImpl
-        implements javax.xml.registry.infomodel.PersonName {
+public class PersonNameImpl implements javax.xml.registry.infomodel.PersonName {
 
-    private String firstname = "";
     private String fullname = "";
-    private String lastname = "";
-    private String middlename = "";
 
     /**
      * Creates a new instance of PersonNameImpl
@@ -38,46 +35,39 @@
     public PersonNameImpl() {
     }
 
-    public PersonNameImpl(String fn, String mn, String ln) {
-        this.firstname = fn;
-        this.middlename = mn;
-        this.lastname = ln;
-    }
-
     public PersonNameImpl(String fullname) {
         this.fullname = fullname;
     }
 
-    public String getFirstName() throws JAXRException {
-        return this.firstname;
-    }
-
     public String getFullName() throws JAXRException {
         return this.fullname;
     }
 
+    public void setFullName(String str) throws JAXRException {
+        this.fullname = str;
+    }
+
+    public String getFirstName() throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
     public String getLastName() throws JAXRException {
-        return this.lastname;
+        throw new UnsupportedCapabilityException();
     }
 
     public String getMiddleName() throws JAXRException {
-        return this.middlename;
+        throw new UnsupportedCapabilityException();
     }
 
     public void setFirstName(String str) throws JAXRException {
-        this.firstname = str;
-    }
-
-    public void setFullName(String str) throws JAXRException {
-        this.fullname = str;
+        throw new UnsupportedCapabilityException();
     }
 
     public void setLastName(String str) throws JAXRException {
-        this.lastname = str;
+        throw new UnsupportedCapabilityException();
     }
 
     public void setMiddleName(String str) throws JAXRException {
-        this.middlename = str;
+        throw new UnsupportedCapabilityException();
     }
-
 }

Added: webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/infomodel/PersonNameTest.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/infomodel/PersonNameTest.java?view=auto&rev=123352
==============================================================================
--- (empty file)
+++ webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/infomodel/PersonNameTest.java	Sat Dec 25 17:38:22 2004
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.registry.infomodel;
+
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.UnsupportedCapabilityException;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PersonNameTest extends TestCase {
+    private PersonName name;
+
+    public void testLevel1Methods() throws JAXRException {
+        try {
+            name.getFirstName();
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+        try {
+            name.getMiddleName();
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+        try {
+            name.getLastName();
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+        try {
+            name.setFirstName(null);
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+        try {
+            name.setMiddleName(null);
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+        try {
+            name.setLastName(null);
+            fail("Expected UnsupportedCapabilityException");
+        } catch (UnsupportedCapabilityException e) {
+            // OK
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        name = new PersonNameImpl();
+    }
+}

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