tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r718858 [4/9] - in /tuscany/java/sca/modules: ./ assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/resource...
Date Wed, 19 Nov 2008 05:28:12 GMT
Modified: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java (original)
+++ tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java Tue Nov 18 21:27:58 2008
@@ -29,10 +29,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.ContributionLocationHelper;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
 
 /**
  * HTTP binding unit tests.
@@ -40,831 +37,819 @@
  * @version $Rev$ $Date$
  */
 public class HTTPBindingCacheTestCase extends TestCase {
-    // RFC 822 date time
-    protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z");
-
-    // Request with no predicates in header.
-    private static final String REQUEST1 = "{0} /httpbinding/{1} HTTP/1.0\n" + "Host: localhost\n" + "Content-Type: text/xml\n" + "Connection: close\n" + "Content-Length: {2}" + "\n\n{3}";
-
-    // Request with predicates in header
-    private static final String REQUEST2 = "{0} /httpbinding/{1} HTTP/1.0\n" + "Host: localhost\n" + "Content-Type: text/xml\n" + "{2}: {3}\n" // predicate
-                                                                                                                                               // (
-                                                                                                                                               // If
-                                                                                                                                               // -
-                                                                                                                                               // Match
-                                                                                                                                               // ,
-                                                                                                                                               // If
-                                                                                                                                               // -
-                                                                                                                                               // None
-                                                                                                                                               // -
-                                                                                                                                               // Match
-                                                                                                                                               // ,
-                                                                                                                                               // If
-                                                                                                                                               // -
-                                                                                                                                               // Modified
-                                                                                                                                               // -
-                                                                                                                                               // Since
-                                                                                                                                               // ,
-                                                                                                                                               // If
-                                                                                                                                               // -
-                                                                                                                                               // NotModified
-                                                                                                                                               // -
-                                                                                                                                               // Since
-                                                                                                                                               // )
-                                                                                                                                               // :
-                                                                                                                                               // value
-                                                                                                                                               // (
-                                                                                                                                               // date
-                                                                                                                                               // or
-                                                                                                                                               // ETag
-                                                                                                                                               // )
-        + "Connection: close\n"
-        + "Content-Length: {4}"
-        + "\n\n{5}";
-
-    private static final int HTTP_PORT = 8085;
-
-    private Node node;
-
-    @Override
-    protected void setUp() throws Exception {
-        String contribution = ContributionLocationHelper.getContributionLocation(HTTPBindingCacheTestCase.class);
-        node = NodeFactory.newInstance().createNode("testCache.composite", new Contribution("test", contribution));
-        node.start();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        node.stop();
-        node.destroy();
-    }
-
-    /**
-     * Test invoking a POJO get method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testGet() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST1, "GET", index, content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfModifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfModifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfUnmodifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Unmodified-Since", dateFormat.format(new Date()), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfUnmodifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Unmodified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfNoneMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalGetIfNoneMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "GET", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a POJO get method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testDelete() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST1, "DELETE", index, content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        assertTrue(document.indexOf("deleted item=" + index) != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfModifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfModifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfUnmodifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Unmodified-Since", dateFormat.format(new Date()), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfUnmodifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Unmodified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfNoneMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalDeleteIfNoneMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "DELETE", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("deleted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a POJO get method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testPost() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST1, "POST", index, content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfModifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Modified-Since", dateFormat.format(new Date()), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return code 200 OK
-        // assertTrue(document.indexOf("posted item=" + index) != -1);
-        assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfModifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("posted item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfUnmodifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Unmodified-Since", dateFormat.format(new Date()), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return code 200 OK
-        assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfUnmodifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Unmodified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("posted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Match", "eTagMatch", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return code 200 OK.
-        assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
-        // Should return code 412 precondition failed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-Match", "eTagNoneMatch", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("posted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfNoneMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-None-Match", "eTagNoneMatch", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return code 200 OK
-        assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
-        // Should return code 412 precondition failed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPostIfNoneMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "POST", index, "If-None-Match", "eTagMatch", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("posted item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a POJO get method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testPut() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST1, "PUT", index, content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        assertTrue(document.indexOf("updated item=" + index) != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfModifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfModifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Modified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfUnmodifiedNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Unmodified-Since", dateFormat.format(new Date()), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 304 Not Modified.
-        // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfUnmodifiedPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Unmodified-Since", dateFormat.format(new Date(0)), content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfNoneMatchNegative() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 1;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 412 precondition failed.
-        // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Test invoking a conditional method implementation using the HTTP binding.
-     * 
-     * @throws Exception
-     */
-    public void testConditionalPutIfNoneMatchPositive() throws Exception {
-        Socket client = new Socket("127.0.0.1", HTTP_PORT);
-        OutputStream os = client.getOutputStream();
-        int index = 0;
-        String content = "";
-        String request = MessageFormat.format(REQUEST2, "PUT", index, "If-None-Match", "eTagXXX", content.getBytes().length, content);
-        os.write(request.getBytes());
-        os.flush();
-
-        String document = read(client);
-        // Should return item
-        // assertTrue(document.indexOf("updated item=" + index) != -1);
-        // Should return code 412 PreconditionFailed.
-        assertTrue(document.indexOf("HTTP/1.1 412") != -1);
-    }
-
-    /**
-     * Read response stream from the given socket.
-     * 
-     * @param socket
-     * @return
-     * @throws IOException
-     */
-    private static String read(Socket socket) throws IOException {
-        BufferedReader reader = null;
-        try {
-            reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
-            StringBuffer sb = new StringBuffer();
-            String str;
-            while ((str = reader.readLine()) != null) {
-                sb.append(str);
-            }
-            return sb.toString();
-        } finally {
-            if (reader != null) {
-                reader.close();
-            }
-        }
-    }
+	// RFC 822 date time
+	protected static final SimpleDateFormat dateFormat = new SimpleDateFormat(
+			"EEE, dd MMM yyyy HH:mm:ss Z");
+
+	// Request with no predicates in header.
+	private static final String REQUEST1 = "{0} /httpbinding/{1} HTTP/1.0\n"
+			+ "Host: localhost\n" + "Content-Type: text/xml\n"
+			+ "Connection: close\n" + "Content-Length: {2}" + "\n\n{3}";
+
+	// Request with predicates in header
+	private static final String REQUEST2 = "{0} /httpbinding/{1} HTTP/1.0\n"
+			+ "Host: localhost\n" + "Content-Type: text/xml\n" + "{2}: {3}\n" // predicate (If-Match, If-None-Match, If-Modified-Since, If-NotModified-Since): value (date or ETag)
+			+ "Connection: close\n" + "Content-Length: {4}" + "\n\n{5}";
+
+	private static final int HTTP_PORT = 8085;
+
+	private SCADomain scaDomain;
+
+	@Override
+	protected void setUp() throws Exception {
+		scaDomain = SCADomain.newInstance("testCache.composite");
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		scaDomain.close();
+	}
+
+	/**
+	 * Test invoking a POJO get method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testGet() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST1, "GET", index, content
+				.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfModifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfModifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfUnmodifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Unmodified-Since", dateFormat.format(new Date()), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfUnmodifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Unmodified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfNoneMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalGetIfNoneMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "GET", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("<body><p>item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a POJO get method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testDelete() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST1, "DELETE", index,
+				content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		assertTrue(document.indexOf("deleted item=" + index) != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfModifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfModifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfUnmodifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Unmodified-Since", dateFormat.format(new Date()), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfUnmodifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Unmodified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfNoneMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalDeleteIfNoneMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "DELETE", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("deleted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a POJO get method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testPost() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST1, "POST", index, content
+				.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfModifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-Modified-Since", dateFormat.format(new Date()), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return code 200 OK
+		// assertTrue(document.indexOf("posted item=" + index) != -1);
+		assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfModifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("posted item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfUnmodifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-Unmodified-Since", dateFormat.format(new Date()), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return code 200 OK
+		assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfUnmodifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-Unmodified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("posted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-Match", "eTagMatch", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return code 200 OK.
+		assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
+		// Should return code 412 precondition failed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat
+				.format(REQUEST2, "POST", index, "If-Match", "eTagNoneMatch",
+						content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("posted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfNoneMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-None-Match", "eTagNoneMatch", content.getBytes().length,
+				content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return code 200 OK
+		assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
+		// Should return code 412 precondition failed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPostIfNoneMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "POST", index,
+				"If-None-Match", "eTagMatch", content.getBytes().length,
+				content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("posted item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a POJO get method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testPut() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST1, "PUT", index, content
+				.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		assertTrue(document.indexOf("updated item=" + index) != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfModifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfModifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Modified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfUnmodifiedNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Unmodified-Since", dateFormat.format(new Date()), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 304 Not Modified.
+		// assertTrue(document.indexOf("HTTP/1.1 304") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfUnmodifiedPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Unmodified-Since", dateFormat.format(new Date(0)), content
+						.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfNoneMatchNegative() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 1;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 412 precondition failed.
+		// assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Test invoking a conditional method implementation using the HTTP binding. 
+	 * @throws Exception
+	 */
+	public void testConditionalPutIfNoneMatchPositive() throws Exception {
+		Socket client = new Socket("127.0.0.1", HTTP_PORT);
+		OutputStream os = client.getOutputStream();
+		int index = 0;
+		String content = "";
+		String request = MessageFormat.format(REQUEST2, "PUT", index,
+				"If-None-Match", "eTagXXX", content.getBytes().length, content);
+		os.write(request.getBytes());
+		os.flush();
+
+		String document = read(client);
+		// Should return item
+		// assertTrue(document.indexOf("updated item=" + index) != -1);
+		// Should return code 412 PreconditionFailed.
+		assertTrue(document.indexOf("HTTP/1.1 412") != -1);
+	}
+
+	/**
+	 * Read response stream from the given socket.
+	 * @param socket
+	 * @return
+	 * @throws IOException
+	 */
+	private static String read(Socket socket) throws IOException {
+		BufferedReader reader = null;
+		try {
+			reader = new BufferedReader(new InputStreamReader(socket
+					.getInputStream()));
+			StringBuffer sb = new StringBuffer();
+			String str;
+			while ((str = reader.readLine()) != null) {
+				sb.append(str);
+			}
+			return sb.toString();
+		} finally {
+			if (reader != null) {
+				reader.close();
+			}
+		}
+	}
 }

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java (original)
+++ tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java Tue Nov 18 21:27:58 2008
@@ -49,7 +49,7 @@
 	 * @param id
 	 * @return
 	 */
-	public InputStream conditionalGet(String id, CacheContext cacheContext)
+	public InputStream conditionalGet(String id, HTTPCacheContext cacheContext)
 			throws NotModifiedException, PreconditionFailedException {
 
 		if (cacheContext != null) {
@@ -99,7 +99,7 @@
 	 * @param id
 	 * @return
 	 */
-	public InputStream conditionalDelete(String id, CacheContext cacheContext)
+	public InputStream conditionalDelete(String id, HTTPCacheContext cacheContext)
 			throws NotModifiedException, PreconditionFailedException {
 
 		if (cacheContext != null) {
@@ -151,7 +151,7 @@
 	 * @param id
 	 * @return
 	 */
-	public CacheContext conditionalPost(CacheContext cacheContext)
+	public HTTPCacheContext conditionalPost(HTTPCacheContext cacheContext)
 			throws NotModifiedException, PreconditionFailedException {
 		String id = "" + (new java.util.Random()).nextInt(Integer.MAX_VALUE);
 
@@ -180,7 +180,7 @@
 		}
 
 		// Return the ETag and LastModfied fields by serialize to a byte array
-		CacheContext returnContext = new CacheContext();
+		HTTPCacheContext returnContext = new HTTPCacheContext();
 		returnContext.setETag( "ETag" + (new java.util.Random()).nextInt(Integer.MAX_VALUE) );
 		returnContext.setLastModified( new Date() );
 		return returnContext;
@@ -202,7 +202,7 @@
 	 * @param id
 	 * @return
 	 */
-	public InputStream conditionalPut(String id, CacheContext cacheContext)
+	public InputStream conditionalPut(String id, HTTPCacheContext cacheContext)
 			throws NotModifiedException, PreconditionFailedException {
 
 		if (cacheContext != null) {

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java (original)
+++ tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java Tue Nov 18 21:27:58 2008
@@ -19,11 +19,14 @@
 
 package org.apache.tuscany.sca.binding.http.impl;
 
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 
 
 /**
@@ -31,10 +34,16 @@
  * 
  * @version $Rev$ $Date$
  */
-class HTTPBindingImpl implements HTTPBinding {
+class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
     
     private String name;
     private String uri;
+    
+    private List<Intent> requiredIntents = new ArrayList<Intent>();
+    private List<PolicySet> policySets = new ArrayList<PolicySet>();
+    private IntentAttachPointType intentAttachPointType;
+    private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
 
     public String getName() {
         return name;
@@ -60,7 +69,37 @@
     public void setUnresolved(boolean unresolved) {
         // The sample binding is always resolved
     }
+    
+    //Policy related getters/setters
+    
+    public List<PolicySet> getPolicySets() {
+        return policySets;
+    }
+    
+    public List<Intent> getRequiredIntents() {
+        return requiredIntents;
+    }
 
+    public IntentAttachPointType getType() {
+        return intentAttachPointType;
+    }
+    
+    public void setType(IntentAttachPointType intentAttachPointType) {
+        this.intentAttachPointType = intentAttachPointType;
+    }
+
+    public void setPolicySets(List<PolicySet> policySets) {
+        this.policySets = policySets; 
+    }
+
+    public void setRequiredIntents(List<Intent> intents) {
+        this.requiredIntents = intents;
+    }    
+
+    public List<PolicySet> getApplicablePolicySets() {
+        return applicablePolicySets;
+    }
+    
     @Override
     public Object clone() throws CloneNotSupportedException {
         return super.clone();

Propchange: tuscany/java/sca/modules/binding-jms-policy/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 18 21:27:58 2008
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Copied: tuscany/java/sca/modules/binding-jms-policy/pom.xml (from r700344, tuscany/java/sca/modules/binding-jms-policy/pom.xml)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/pom.xml?p2=tuscany/java/sca/modules/binding-jms-policy/pom.xml&p1=tuscany/java/sca/modules/binding-jms-policy/pom.xml&r1=700344&r2=718858&rev=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/pom.xml (original)
+++ tuscany/java/sca/modules/binding-jms-policy/pom.xml Tue Nov 18 21:27:58 2008
@@ -40,6 +40,25 @@
             <artifactId>tuscany-assembly-xml</artifactId>
             <version>1.4-SNAPSHOT</version>
         </dependency>
+        
+        <dependency>
+           <groupId>org.apache.geronimo.specs</groupId>
+           <artifactId>geronimo-jms_1.1_spec</artifactId>
+           <version>1.1</version>
+           <scope>provided</scope>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.apache.geronimo.specs</groupId>
+                   <artifactId>geronimo-jms_1.1_spec</artifactId>
+               </exclusion>
+           </exclusions>
+        </dependency>         
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>        
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>

Modified: tuscany/java/sca/modules/binding-jms-runtime/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-runtime/pom.xml?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms-runtime/pom.xml (original)
+++ tuscany/java/sca/modules/binding-jms-runtime/pom.xml Tue Nov 18 21:27:58 2008
@@ -35,6 +35,12 @@
             <artifactId>tuscany-binding-jms</artifactId>
             <version>1.4-EQUINOX-SNAPSHOT</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms-policy</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>         
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>

Propchange: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Nov 18 21:27:58 2008
@@ -0,0 +1 @@
+/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java:713805-714043

Modified: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java (original)
+++ tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java Tue Nov 18 21:27:58 2008
@@ -19,6 +19,7 @@
 package org.apache.tuscany.sca.binding.jms.provider;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.List;
 import java.util.Map;
 
 import javax.jms.DeliveryMode;
@@ -29,14 +30,21 @@
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.naming.NamingException;
+import javax.security.auth.Subject;
 
 import org.apache.tuscany.sca.binding.jms.JMSBinding;
 import org.apache.tuscany.sca.binding.jms.JMSBindingException;
 import org.apache.tuscany.sca.binding.jms.xml.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
+import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
 import org.apache.tuscany.sca.runtime.ReferenceParameters;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -59,6 +67,8 @@
     protected Destination bindingRequestDest;
     protected Destination bindingReplyDest;
     protected RuntimeComponentReference reference;
+    protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null;
+    protected JMSHeaderPolicy jmsHeaderPolicy = null;
 
     public JMSBindingInvoker(JMSBinding jmsBinding, Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeComponentReference reference) {
 
@@ -71,6 +81,22 @@
         this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
         this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
 
+        // find out which policies are active
+        if (jmsBinding instanceof PolicySetAttachPoint) {
+            List<PolicySet> policySets = ((PolicySetAttachPoint)jmsBinding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
+                        jmsTokenAuthenticationPolicy = (JMSTokenAuthenticationPolicy)p;
+                    }else if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
+                        jmsHeaderPolicy = (JMSHeaderPolicy)p;
+                    } else {
+                        // etc. check for other types of policy being present
+                    }
+                }
+            }
+        }
+        
         try {
 
             bindingRequestDest = lookupDestination();
@@ -302,7 +328,15 @@
 
         requestMessageProcessor.setOperationName(jmsBinding.getNativeOperationName(operationName), jmsMsg);
 
-        if (jmsBinding.getOperationJMSDeliveryMode(operationName) != null) {
+        if ((jmsHeaderPolicy != null) && 
+            (jmsHeaderPolicy.getDeliveryModePersistent() != null)) {
+            if (jmsHeaderPolicy.getDeliveryModePersistent()) {
+                jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
+            } else {
+                jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            }
+            
+        } else if (jmsBinding.getOperationJMSDeliveryMode(operationName) != null) {
             if (jmsBinding.getOperationJMSDeliveryMode(operationName)) {
                 jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
             } else {
@@ -310,15 +344,24 @@
             }
         }
 
-        if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
+        if ((jmsHeaderPolicy != null) && 
+            (jmsHeaderPolicy.getJmsCorrelationId() != null)) {
+            jmsMsg.setJMSCorrelationID(jmsHeaderPolicy.getJmsCorrelationId());
+        } else if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
             jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
         }
 
-        if (jmsBinding.getOperationJMSPriority(operationName) != null) {
+        if ((jmsHeaderPolicy != null) && 
+            (jmsHeaderPolicy.getJmsPriority() != null)) {
+            jmsMsg.setJMSPriority(jmsHeaderPolicy.getJmsPriority());
+        } else if (jmsBinding.getOperationJMSPriority(operationName) != null) {
             jmsMsg.setJMSPriority(jmsBinding.getOperationJMSPriority(operationName));
         }
 
-        if (jmsBinding.getOperationJMSType(operationName) != null) {
+        if ((jmsHeaderPolicy != null) && 
+            (jmsHeaderPolicy.getJmsType() != null)) {
+            jmsMsg.setJMSType(jmsHeaderPolicy.getJmsType());
+        } else if (jmsBinding.getOperationJMSType(operationName) != null) {
             jmsMsg.setJMSType(jmsBinding.getOperationJMSType(operationName));
         }
 
@@ -341,6 +384,12 @@
             }
         }
         
+        if (jmsHeaderPolicy != null){
+            for (String propName : jmsHeaderPolicy.getProperties().keySet()) {
+                jmsMsg.setObjectProperty(propName, jmsHeaderPolicy.getProperties().get(propName));
+            }
+        }
+        
         for (String propName : jmsBinding.getPropertyNames()) {
             Object value = jmsBinding.getProperty(propName);
             jmsMsg.setObjectProperty(propName, value);
@@ -353,6 +402,14 @@
                 jmsMsg.setObjectProperty(propName, value);
             }
         }
+        
+        if (jmsTokenAuthenticationPolicy != null) {
+            Subject subject = SecurityUtil.getSubject(tuscanyMsg);
+            TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
+            if (principal != null){
+                jmsMsg.setStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString(), principal.getName());
+            }
+        }
     }
 
     protected boolean hasCallback() {
@@ -370,7 +427,10 @@
         MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
       
         long receiveWait;
-        if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
+        if ((jmsHeaderPolicy != null) && 
+            (jmsHeaderPolicy.getTimeToLive() != null)) {
+            receiveWait = jmsHeaderPolicy.getTimeToLive();
+        } else if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
             receiveWait = jmsBinding.getOperationJMSTimeToLive(operationName) * 2;        
         } else {
             receiveWait = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;

Modified: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java (original)
+++ tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java Tue Nov 18 21:27:58 2008
@@ -39,19 +39,28 @@
 
     private WorkScheduler workScheduler;
     private ExtensionPointRegistry extensionPoints;
+    private JMSResourceFactoryExtensionPoint jmsRFEP;
 
     public JMSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
         this.extensionPoints = extensionPoints;
         UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
         workScheduler = utilities.getUtility(WorkScheduler.class);
+
+        jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
+        if (jmsRFEP == null) {
+            jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint();
+            extensionPoints.addExtensionPoint(jmsRFEP);
+        }
     }
 
     public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) {
-        return new JMSBindingReferenceBindingProvider(component, reference, binding, extensionPoints);
+        JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
+        return new JMSBindingReferenceBindingProvider(component, reference, binding, extensionPoints, jmsRF);
     }
 
     public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding) {
-        return new JMSBindingServiceBindingProvider(component, service, binding, binding, workScheduler, extensionPoints);
+        JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
+        return new JMSBindingServiceBindingProvider(component, service, binding, binding, workScheduler, extensionPoints, jmsRF);
     }
 
     public Class<JMSBinding> getModelType() {



Mime
View raw message