You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/01/12 12:18:58 UTC

svn commit: r495555 - in /incubator/woden/trunk/java: src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java

Author: jkaputin
Date: Fri Jan 12 03:18:55 2007
New Revision: 495555

URL: http://svn.apache.org/viewvc?view=rev&rev=495555
Log:
WODEN-86 Remove redundant method getLocationSubstituted

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java

Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java?view=diff&rev=495555&r1=495554&r2=495555
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java Fri Jan 12 03:18:55 2007
@@ -138,46 +138,6 @@
     }
     
     /**
-     * Takes a String array containing the instance data values to be substituted
-     * for curly brace-enclosed local names in the HTTP location template and returns
-     * a String representing the substituted template.
-     * The array values correspond positionally to the local names in the template.
-     * <p>
-     * If the HTTP location template is not valid, this method will return null;
-     * <p>
-     * If String array contains more values than there are local names in the template,
-     * those extra values will be ignored. If the template contains more local names
-     * than there are values in the String array, the unmatched local names will remain
-     * enclosed in curly braces in the returned string.
-     * 
-     * TODO remove this method as it is now replaced by the method substitute(String[] values), which changes the object state and conforms to naming convention for other substitution methods.
-     */
-    public String getLocationSubstituted(String[] values) {
-        if(!isTemplateValid()) {
-            return null;
-        }
-        
-        StringBuffer substituted = new StringBuffer();
-        String next;
-        int left, right, temp = 0;
-        
-        for(int i=0; i<values.length; i++) {
-            next = values[i];
-            left = fLocationTemplate.indexOf(leftBrace, temp);
-            if(left == -1) {
-                break; //there are no more templated local names
-            }
-            substituted.append(fLocationTemplate.substring(temp, left));
-            substituted.append(next);
-            right = fLocationTemplate.indexOf(rightBrace, left+1);
-            temp = right+1;
-        }
-        substituted.append(fLocationTemplate.substring(temp));
-        
-        return substituted.toString();
-    }
-    
-    /**
      * Returns a String array containing the element local names that appear
      * enclosed in curly braces in the location template, in the order that they
      * appear in the template. Note that if a local name appears multiple times in

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java?view=diff&rev=495555&r1=495554&r2=495555
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/http/HTTPLocationTest.java Fri Jan 12 03:18:55 2007
@@ -611,85 +611,4 @@
         return result;
     }
     
-    
-    
-    
-    
-    //TODO remove this test method when the getLocationSubtituted method is removed.
-    public void testGetLocationSubstituted() throws Exception
-    {
-        String httpLoc0 = "?op=Cancel";
-        String httpLoc1 = "/temperature/{town}";
-        String httpLoc2 = "?op=Quote;key={symbol};amt={amount}";
-        String httpLoc3 = "?first={FirstName};middle={MiddleName};last={LastName}";
-        
-
-        String[] values0 = new String[] {};
-        String[] values1 = new String[] {"ONE"};
-        String[] values2 = new String[] {"ONE","TWO"};
-        String[] values3 = new String[] {"ONE","TWO","THREE"};
-        String[] values4 = new String[] {"ONE","TWO","THREE","FOUR"};
-
-        //1 value array, but no template
-        HTTPLocation loc = new HTTPLocation(httpLoc0);
-        String result = loc.getLocationSubstituted(values1);
-        assertEquals(httpLoc0,result);
-        
-        //2 value array, but no template
-        loc = new HTTPLocation(httpLoc0);
-        result = loc.getLocationSubstituted(values2);
-        assertEquals(httpLoc0,result);
-        
-        //1 value array and 1 local name template
-        loc = new HTTPLocation(httpLoc1);
-        result = loc.getLocationSubstituted(values1);
-        assertEquals("/temperature/ONE",result);
-
-        //2 value array and 1 local name template
-        loc = new HTTPLocation(httpLoc1);
-        result = loc.getLocationSubstituted(values2);
-        assertEquals("/temperature/ONE",result);
-        
-        //1 value array and 2 local name template
-        loc = new HTTPLocation(httpLoc2);
-        result = loc.getLocationSubstituted(values1);
-        assertEquals("?op=Quote;key=ONE;amt={amount}",result);
-        
-        //2 value array and 2 local name template
-        loc = new HTTPLocation(httpLoc2);
-        result = loc.getLocationSubstituted(values2);
-        assertEquals("?op=Quote;key=ONE;amt=TWO",result);
-        
-        //3 value array and 2 local name template
-        loc = new HTTPLocation(httpLoc2);
-        result = loc.getLocationSubstituted(values3);
-        assertEquals("?op=Quote;key=ONE;amt=TWO",result);
-        
-        //empty value array and 3 local name template
-        loc = new HTTPLocation(httpLoc3);
-        result = loc.getLocationSubstituted(values0);
-        assertEquals("?first={FirstName};middle={MiddleName};last={LastName}",result);
-        
-        //1 value array and 3 local name template
-        loc = new HTTPLocation(httpLoc3);
-        result = loc.getLocationSubstituted(values1);
-        assertEquals("?first=ONE;middle={MiddleName};last={LastName}",result);
-        
-        //2 value array and 3 local name template
-        loc = new HTTPLocation(httpLoc3);
-        result = loc.getLocationSubstituted(values2);
-        assertEquals("?first=ONE;middle=TWO;last={LastName}",result);
-        
-        //3 value array and 3 local name template
-        loc = new HTTPLocation(httpLoc3);
-        result = loc.getLocationSubstituted(values3);
-        assertEquals("?first=ONE;middle=TWO;last=THREE",result);
-        
-        //4 value array and 3 local name template
-        loc = new HTTPLocation(httpLoc3);
-        result = loc.getLocationSubstituted(values4);
-        assertEquals("?first=ONE;middle=TWO;last=THREE",result);
-        
-    }
-
 }



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