jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1235737 [7/7] - in /jackrabbit/branches/2.4: ./ examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx...
Date Wed, 25 Jan 2012 13:30:25 GMT
Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParser.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParser.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParser.java
Wed Jan 25 13:30:17 2012
@@ -1,199 +1,199 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.webdav.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.util.ParameterParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Simple parser for HTTP Link header fields, as defined in RFC 5988.
- */
-public class LinkHeaderFieldParser {
-
-    /**
-     * the default logger
-     */
-    private static Logger log = LoggerFactory.getLogger(LinkHeaderFieldParser.class);
-
-    private final List<LinkRelation> relations;
-
-    public LinkHeaderFieldParser(List<String> fieldValues) {
-        List<LinkRelation> tmp = new ArrayList<LinkRelation>();
-        if (fieldValues != null) {
-            for (String value : fieldValues) {
-                addFields(tmp, value);
-            }
-        }
-        relations = Collections.unmodifiableList(tmp);
-    }
-
-    public LinkHeaderFieldParser(Enumeration<?> en) {
-        if (en != null && en.hasMoreElements()) {
-            List<LinkRelation> tmp = new ArrayList<LinkRelation>();
-
-            while (en.hasMoreElements()) {
-                addFields(tmp, en.nextElement().toString());
-            }
-            relations = Collections.unmodifiableList(tmp);
-        } else {
-            // optimize case of no Link headers
-            relations = Collections.emptyList();
-        }
-    }
-
-    public String getFirstTargetForRelation(String relationType) {
-
-        for (LinkRelation lr : relations) {
-
-            String relationNames = lr.getParameters().get("rel");
-            if (relationNames != null) {
-
-                // split rel value on whitespace
-                for (String rn : relationNames.toLowerCase(Locale.ENGLISH)
-                        .split("\\s")) {
-                    if (relationType.equals(rn)) {
-                        return lr.getTarget();
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-
-    // A single header field instance can contain multiple, comma-separated
-    // fields.
-    private void addFields(List<LinkRelation> l, String fieldValue) {
-
-        boolean insideAngleBrackets = false;
-        boolean insideDoubleQuotes = false;
-
-        for (int i = 0; i < fieldValue.length(); i++) {
-
-            char c = fieldValue.charAt(i);
-
-            if (insideAngleBrackets) {
-                insideAngleBrackets = c != '>';
-            } else if (insideDoubleQuotes) {
-                insideDoubleQuotes = c != '"';
-                if (c == '\\' && i < fieldValue.length() - 1) {
-                    // skip over next character
-                    c = fieldValue.charAt(++i);
-                }
-            } else {
-                insideAngleBrackets = c == '<';
-                insideDoubleQuotes = c == '"';
-
-                if (c == ',') {
-                    String v = fieldValue.substring(0, i);
-                    if (v.length() > 0) {
-                        try {
-                            l.add(new LinkRelation(v));
-                        } catch (Exception ex) {
-                            log.warn("parse error in Link Header field value",
-                                    ex);
-                        }
-                    }
-                    addFields(l, fieldValue.substring(i + 1));
-                    return;
-                }
-            }
-        }
-
-        if (fieldValue.length() > 0) {
-            try {
-                l.add(new LinkRelation(fieldValue));
-            } catch (Exception ex) {
-                log.warn("parse error in Link Header field value", ex);
-            }
-        }
-    }
-
-    private static class LinkRelation {
-
-        private static Pattern P = Pattern.compile("\\s*<(.*)>\\s*(.*)");
-
-        private String target;
-        private Map<String, String> parameters;
-
-        /**
-         * Parses a single link relation, consisting of <URI> and optional
-         * parameters.
-         * 
-         * @param field
-         *            field value
-         * @throws Exception
-         */
-        @SuppressWarnings("unchecked")
-        public LinkRelation(String field) throws Exception {
-
-            // find the link target using a regexp
-            Matcher m = P.matcher(field);
-            if (!m.matches()) {
-                throw new Exception("illegal Link header field value:" + field);
-            }
-
-            target = m.group(1);
-
-            // pass the remainder to the generic parameter parser
-            List<NameValuePair> params = (List<NameValuePair>) new ParameterParser()
-                    .parse(m.group(2), ';');
-
-            if (params.size() == 0) {
-                parameters = Collections.emptyMap();
-            } else if (params.size() == 1) {
-                NameValuePair nvp = params.get(0);
-                parameters = Collections.singletonMap(nvp.getName()
-                        .toLowerCase(Locale.ENGLISH), nvp.getValue());
-            } else {
-                parameters = new HashMap<String, String>();
-                for (NameValuePair p : params) {
-                    if (null != parameters.put(
-                            p.getName().toLowerCase(Locale.ENGLISH),
-                            p.getValue())) {
-                        throw new Exception("duplicate parameter + "
-                                + p.getName() + " field ignored");
-                    }
-                }
-            }
-        }
-
-        public String getTarget() {
-            return target;
-        }
-
-        public Map<String, String> getParameters() {
-            return parameters;
-        }
-
-        public String toString() {
-            return target + " " + parameters;
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.util.ParameterParser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple parser for HTTP Link header fields, as defined in RFC 5988.
+ */
+public class LinkHeaderFieldParser {
+
+    /**
+     * the default logger
+     */
+    private static Logger log = LoggerFactory.getLogger(LinkHeaderFieldParser.class);
+
+    private final List<LinkRelation> relations;
+
+    public LinkHeaderFieldParser(List<String> fieldValues) {
+        List<LinkRelation> tmp = new ArrayList<LinkRelation>();
+        if (fieldValues != null) {
+            for (String value : fieldValues) {
+                addFields(tmp, value);
+            }
+        }
+        relations = Collections.unmodifiableList(tmp);
+    }
+
+    public LinkHeaderFieldParser(Enumeration<?> en) {
+        if (en != null && en.hasMoreElements()) {
+            List<LinkRelation> tmp = new ArrayList<LinkRelation>();
+
+            while (en.hasMoreElements()) {
+                addFields(tmp, en.nextElement().toString());
+            }
+            relations = Collections.unmodifiableList(tmp);
+        } else {
+            // optimize case of no Link headers
+            relations = Collections.emptyList();
+        }
+    }
+
+    public String getFirstTargetForRelation(String relationType) {
+
+        for (LinkRelation lr : relations) {
+
+            String relationNames = lr.getParameters().get("rel");
+            if (relationNames != null) {
+
+                // split rel value on whitespace
+                for (String rn : relationNames.toLowerCase(Locale.ENGLISH)
+                        .split("\\s")) {
+                    if (relationType.equals(rn)) {
+                        return lr.getTarget();
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+    // A single header field instance can contain multiple, comma-separated
+    // fields.
+    private void addFields(List<LinkRelation> l, String fieldValue) {
+
+        boolean insideAngleBrackets = false;
+        boolean insideDoubleQuotes = false;
+
+        for (int i = 0; i < fieldValue.length(); i++) {
+
+            char c = fieldValue.charAt(i);
+
+            if (insideAngleBrackets) {
+                insideAngleBrackets = c != '>';
+            } else if (insideDoubleQuotes) {
+                insideDoubleQuotes = c != '"';
+                if (c == '\\' && i < fieldValue.length() - 1) {
+                    // skip over next character
+                    c = fieldValue.charAt(++i);
+                }
+            } else {
+                insideAngleBrackets = c == '<';
+                insideDoubleQuotes = c == '"';
+
+                if (c == ',') {
+                    String v = fieldValue.substring(0, i);
+                    if (v.length() > 0) {
+                        try {
+                            l.add(new LinkRelation(v));
+                        } catch (Exception ex) {
+                            log.warn("parse error in Link Header field value",
+                                    ex);
+                        }
+                    }
+                    addFields(l, fieldValue.substring(i + 1));
+                    return;
+                }
+            }
+        }
+
+        if (fieldValue.length() > 0) {
+            try {
+                l.add(new LinkRelation(fieldValue));
+            } catch (Exception ex) {
+                log.warn("parse error in Link Header field value", ex);
+            }
+        }
+    }
+
+    private static class LinkRelation {
+
+        private static Pattern P = Pattern.compile("\\s*<(.*)>\\s*(.*)");
+
+        private String target;
+        private Map<String, String> parameters;
+
+        /**
+         * Parses a single link relation, consisting of <URI> and optional
+         * parameters.
+         * 
+         * @param field
+         *            field value
+         * @throws Exception
+         */
+        @SuppressWarnings("unchecked")
+        public LinkRelation(String field) throws Exception {
+
+            // find the link target using a regexp
+            Matcher m = P.matcher(field);
+            if (!m.matches()) {
+                throw new Exception("illegal Link header field value:" + field);
+            }
+
+            target = m.group(1);
+
+            // pass the remainder to the generic parameter parser
+            List<NameValuePair> params = (List<NameValuePair>) new ParameterParser()
+                    .parse(m.group(2), ';');
+
+            if (params.size() == 0) {
+                parameters = Collections.emptyMap();
+            } else if (params.size() == 1) {
+                NameValuePair nvp = params.get(0);
+                parameters = Collections.singletonMap(nvp.getName()
+                        .toLowerCase(Locale.ENGLISH), nvp.getValue());
+            } else {
+                parameters = new HashMap<String, String>();
+                for (NameValuePair p : params) {
+                    if (null != parameters.put(
+                            p.getName().toLowerCase(Locale.ENGLISH),
+                            p.getValue())) {
+                        throw new Exception("duplicate parameter + "
+                                + p.getName() + " field ignored");
+                    }
+                }
+            }
+        }
+
+        public String getTarget() {
+            return target;
+        }
+
+        public Map<String, String> getParameters() {
+            return parameters;
+        }
+
+        public String toString() {
+            return target + " " + parameters;
+        }
+    }
+}

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/util/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/report/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
Wed Jan 25 13:30:17 2012
@@ -1,120 +1,120 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.webdav.server;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
-import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
-
-/**
- * Test cases for RFC 4918 Destination header functionality
- * (see <a href="http://www.webdav.org/specs/rfc4918.html#rfc.section.10.3">RFC 4918,
Section 10.3</a>
- * <p>
- * Required system properties:
- * <ul>
- *   <li>webdav.test.url</li>
- *   <li>webdav.test.username</li>
- *   <li>webdav.test.password</li>
- * </ul>
- */
-
-public class RFC4918DestinationHeaderTest extends TestCase {
-
-    private String root;
-    private URI uri;
-    private String username, password;
-    private HttpClient client;
-    
-    @Override
-    protected void setUp() throws Exception {
-        this.uri = URI.create(System.getProperty("webdav.test.url"));
-        this.root = this.uri.toASCIIString();
-        if (!this.root.endsWith("/")) {
-            this.root += "/";
-        }
-        this.username = System.getProperty(("webdav.test.username"), "");
-        this.password = System.getProperty(("webdav.test.password"), "");
-        this.client = new HttpClient();
-        this.client.getState().setCredentials(
-                new AuthScope(this.uri.getHost(), this.uri.getPort()),
-                new UsernamePasswordCredentials(this.username, this.password));
-        super.setUp();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-    public void testMove() throws HttpException, IOException, DavException, URISyntaxException
{
-
-        String testuri = this.root + "movetest";
-        String destinationuri = testuri + "2";
-        String destinationpath = new URI(destinationuri).getRawPath();
-        // make sure the scheme is removed
-        assertFalse(destinationpath.contains(":"));
-        
-        int status;
-        try {
-            PutMethod put = new PutMethod(testuri);
-            status = this.client.executeMethod(put);
-            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
-
-            // try to move outside the servlet's name space
-            MoveMethod move = new MoveMethod(testuri, "/foobar", true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 403);
-
-            // try a relative path
-            move = new MoveMethod(testuri, "foobar", true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 400);
-
-            move = new MoveMethod(testuri, destinationpath, true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
-            
-            HeadMethod head = new HeadMethod(destinationuri);
-            status = this.client.executeMethod(head);
-            assertTrue("status: " + status, status == 200);
-
-            head = new HeadMethod(testuri);
-            status = this.client.executeMethod(head);
-            assertTrue("status: " + status, status == 404);
-
-        } finally {
-            DeleteMethod delete = new DeleteMethod(testuri);
-            status = this.client.executeMethod(delete);
-            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
-            delete = new DeleteMethod(destinationuri);
-            status = this.client.executeMethod(delete);
-            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.server;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
+import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
+
+/**
+ * Test cases for RFC 4918 Destination header functionality
+ * (see <a href="http://www.webdav.org/specs/rfc4918.html#rfc.section.10.3">RFC 4918,
Section 10.3</a>
+ * <p>
+ * Required system properties:
+ * <ul>
+ *   <li>webdav.test.url</li>
+ *   <li>webdav.test.username</li>
+ *   <li>webdav.test.password</li>
+ * </ul>
+ */
+
+public class RFC4918DestinationHeaderTest extends TestCase {
+
+    private String root;
+    private URI uri;
+    private String username, password;
+    private HttpClient client;
+    
+    @Override
+    protected void setUp() throws Exception {
+        this.uri = URI.create(System.getProperty("webdav.test.url"));
+        this.root = this.uri.toASCIIString();
+        if (!this.root.endsWith("/")) {
+            this.root += "/";
+        }
+        this.username = System.getProperty(("webdav.test.username"), "");
+        this.password = System.getProperty(("webdav.test.password"), "");
+        this.client = new HttpClient();
+        this.client.getState().setCredentials(
+                new AuthScope(this.uri.getHost(), this.uri.getPort()),
+                new UsernamePasswordCredentials(this.username, this.password));
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    public void testMove() throws HttpException, IOException, DavException, URISyntaxException
{
+
+        String testuri = this.root + "movetest";
+        String destinationuri = testuri + "2";
+        String destinationpath = new URI(destinationuri).getRawPath();
+        // make sure the scheme is removed
+        assertFalse(destinationpath.contains(":"));
+        
+        int status;
+        try {
+            PutMethod put = new PutMethod(testuri);
+            status = this.client.executeMethod(put);
+            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
+
+            // try to move outside the servlet's name space
+            MoveMethod move = new MoveMethod(testuri, "/foobar", true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 403);
+
+            // try a relative path
+            move = new MoveMethod(testuri, "foobar", true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 400);
+
+            move = new MoveMethod(testuri, destinationpath, true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
+            
+            HeadMethod head = new HeadMethod(destinationuri);
+            status = this.client.executeMethod(head);
+            assertTrue("status: " + status, status == 200);
+
+            head = new HeadMethod(testuri);
+            status = this.client.executeMethod(head);
+            assertTrue("status: " + status, status == 404);
+
+        } finally {
+            DeleteMethod delete = new DeleteMethod(testuri);
+            status = this.client.executeMethod(delete);
+            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
+            delete = new DeleteMethod(destinationuri);
+            status = this.client.executeMethod(delete);
+            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
+        }
+    }
+}

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParserTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParserTest.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParserTest.java
Wed Jan 25 13:30:17 2012
@@ -1,66 +1,66 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.webdav.util;
-
-import java.util.Collections;
-
-import org.apache.jackrabbit.webdav.util.LinkHeaderFieldParser;
-
-import junit.framework.TestCase;
-
-/**
- * <code>LinkHeaderFieldParserTest</code>...
- */
-public class LinkHeaderFieldParserTest extends TestCase {
-
-    public void testSimple() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections.singletonList("<a>; rel=foo"));
-        assertEquals("a", lhfp.getFirstTargetForRelation("foo"));
-    }
-
-    public void testMulti() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections.singletonList("<a>; rel=foo, <b>; rel=bar"));
-        assertEquals("b", lhfp.getFirstTargetForRelation("bar"));
-    }
-
-    public void testMultiQs() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections
-                        .singletonList("<a,>; rel=\"fo\\\"o,\", <b,>; rel=bar"));
-        assertEquals("b,", lhfp.getFirstTargetForRelation("bar"));
-    }
-
-    public void testTruncated() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections.singletonList("<a,>; rel=\"x\\\""));
-        assertEquals("a,", lhfp.getFirstTargetForRelation("x\\"));
-    }
-
-    public void testCommas() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections.singletonList(",<a>; rel=\"xy,z\","));
-        assertEquals("a", lhfp.getFirstTargetForRelation("xy,z"));
-    }
-
-    public void testMultiRel() {
-        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
-                Collections.singletonList(",<a>; rel=\"a b\""));
-        assertEquals("a", lhfp.getFirstTargetForRelation("a"));
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.util;
+
+import java.util.Collections;
+
+import org.apache.jackrabbit.webdav.util.LinkHeaderFieldParser;
+
+import junit.framework.TestCase;
+
+/**
+ * <code>LinkHeaderFieldParserTest</code>...
+ */
+public class LinkHeaderFieldParserTest extends TestCase {
+
+    public void testSimple() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections.singletonList("<a>; rel=foo"));
+        assertEquals("a", lhfp.getFirstTargetForRelation("foo"));
+    }
+
+    public void testMulti() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections.singletonList("<a>; rel=foo, <b>; rel=bar"));
+        assertEquals("b", lhfp.getFirstTargetForRelation("bar"));
+    }
+
+    public void testMultiQs() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections
+                        .singletonList("<a,>; rel=\"fo\\\"o,\", <b,>; rel=bar"));
+        assertEquals("b,", lhfp.getFirstTargetForRelation("bar"));
+    }
+
+    public void testTruncated() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections.singletonList("<a,>; rel=\"x\\\""));
+        assertEquals("a,", lhfp.getFirstTargetForRelation("x\\"));
+    }
+
+    public void testCommas() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections.singletonList(",<a>; rel=\"xy,z\","));
+        assertEquals("a", lhfp.getFirstTargetForRelation("xy,z"));
+    }
+
+    public void testMultiRel() {
+        LinkHeaderFieldParser lhfp = new LinkHeaderFieldParser(
+                Collections.singletonList(",<a>; rel=\"a b\""));
+        assertEquals("a", lhfp.getFirstTargetForRelation("a"));
+    }
+}

Propchange: jackrabbit/branches/2.4/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/util/LinkHeaderFieldParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/test/performance/base/src/main/java/org/apache/jackrabbit/performance/DescendantSearchTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/test/performance/base/src/main/java/org/apache/jackrabbit/performance/SQL2DescendantSearchTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.4/test/performance/jackrabbit24/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message