You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/06/17 07:21:34 UTC

svn commit: r1136762 - in /directory/shared/trunk/dsml/parser/src/test: java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml

Author: elecharny
Date: Fri Jun 17 05:21:34 2011
New Revision: 1136762

URL: http://svn.apache.org/viewvc?rev=1136762&view=rev
Log:
Added a test where the SearchResponse contains no resultEntry and one SRD

Added:
    directory/shared/trunk/dsml/parser/src/test/resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml
Modified:
    directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java

Modified: directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java?rev=1136762&r1=1136761&r2=1136762&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java (original)
+++ directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/SearchResponseTest.java Fri Jun 17 05:21:34 2011
@@ -25,14 +25,15 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.dsmlv2.AbstractResponseTest;
 import org.apache.directory.shared.dsmlv2.Dsmlv2ResponseParser;
 import org.apache.directory.shared.dsmlv2.reponse.SearchResponse;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 /**
  * Tests for the Search Result Done Response parsing
  *
@@ -135,6 +136,35 @@ public class SearchResponseTest extends 
 
 
     /**
+     * Test parsing of a Response with 1 Search Result Entry and a Search Result Done
+     */
+    @Test
+    public void testResponseWith0SRE1SRD()
+    {
+        Dsmlv2ResponseParser parser = null;
+        try
+        {
+            parser = new Dsmlv2ResponseParser( getCodec() );
+
+            parser.setInput( SearchResponseTest.class.getResource( "response_with_0_SRE_1_SRD.xml" ).openStream(),
+                "UTF-8" );
+
+            parser.parse();
+        }
+        catch ( Exception e )
+        {
+            fail( e.getMessage() );
+        }
+
+        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse().getDecorated();
+
+        assertEquals( 0, searchResponse.getSearchResultEntryList().size() );
+
+        assertNotNull( searchResponse.getSearchResultDone() );
+    }
+
+
+    /**
      * Test parsing of a Response with 1 Search Result Reference and a Search Result Done
      */
     @Test

Added: directory/shared/trunk/dsml/parser/src/test/resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/test/resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml?rev=1136762&view=auto
==============================================================================
--- directory/shared/trunk/dsml/parser/src/test/resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml (added)
+++ directory/shared/trunk/dsml/parser/src/test/resources/org/apache/directory/shared/dsmlv2/searchResponse/response_with_0_SRE_1_SRD.xml Fri Jun 17 05:21:34 2011
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<batchResponse xmlns="urn:oasis:names:tc:DSML:2.0:core" resquestID="1234567890">
+  <searchResponse>
+    <searchResultDone>
+      <resultCode code="0" descr="success"/>
+    </searchResultDone>
+  </searchResponse>
+</batchResponse>
\ No newline at end of file