manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1181757 - in /incubator/lcf/branches/CONNECTORS-256: connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
Date Tue, 11 Oct 2011 12:49:36 GMT
Author: kwright
Date: Tue Oct 11 12:49:36 2011
New Revision: 1181757

URL: http://svn.apache.org/viewvc?rev=1181757&view=rev
Log:
Move the stub for the mock wiki service to the right place.

Added:
    incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
  (with props)
Modified:
    incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java

Modified: incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java?rev=1181757&r1=1181756&r2=1181757&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java
(original)
+++ incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/Base.java
Tue Oct 11 12:49:36 2011
@@ -23,16 +23,6 @@ import org.apache.manifoldcf.agents.inte
 import org.apache.manifoldcf.crawler.interfaces.*;
 import org.apache.manifoldcf.crawler.system.ManifoldCF;
 
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.*;
-import java.util.*;
 import org.junit.*;
 
 /** This is a testing base class that is responsible for setting up/tearing down the agents
framework. */
@@ -49,71 +39,5 @@ public class Base extends org.apache.man
     return new String[]{"org.apache.manifoldcf.crawler.connectors.wiki.WikiConnector"};
   }
 
-  /** Mock wiki service */
-  static class MockWikiService
-  {
-    Server server;
-    
-    public MockWikiService()
-    {
-      server = new Server(8089);
-      Context asContext = new Context(server,"/w",Context.SESSIONS);
-      asContext.addServlet(new ServletHolder(new WikiAPIServlet()), "/api.php");
-    }
-    
-    public void start() throws Exception {
-      server.start();
-    }
-    
-    public void stop() throws Exception {
-      server.stop();
-    }
-
-    public static class WikiAPIServlet extends HttpServlet
-    {
-      @Override
-      public void service(HttpServletRequest req, HttpServletResponse res)
-          throws IOException
-      {
-        String format = req.getParameter("format");
-        if (!format.equals("xml"))
-          throw new IOException("Format parameter incorrect: "+format);
-        String list = req.getParameter("list");
-        String action = req.getParameter("action");
-        if (action == null && list == null)
-          throw new IOException("Must have either action or list");
-        if (action != null && list != null)
-          throw new IOException("Cannot have both action and list");
-        if (action != null)
-        {
-          if (!action.equals("query"))
-            throw new IOException("Action parameter incorrect: "+query);
-          String prop = req.getParameter("prop");
-          String pageIds = req.getParameter("pageids");
-          String rvprop = req.getParameter("rvprop");
-          String inprop = req.getParameter("inprop");
-          // MHL
-        }
-        else if (list != null)
-        {
-          if (!list.equals("allpages"))
-            throw new IOException("List parameter incorrect: "+list);
-          String apfrom = req.getParameter("apfrom");
-          String aplimit = req.getParameter("aplimit");
-          // MHL
-        }
-        
-        // MHL
-        String user = req.getParameter("username");
-        res.setStatus(HttpServletResponse.SC_OK);
-        if(user.equals("user1") || user.equals("user2") || user.equals("user3"))
-          res.getWriter().printf("TOKEN:token1\n");
-        if(user.equals("user2") || user.equals("user3"))
-          res.getWriter().printf("TOKEN:token2\n");
-        if(user.equals("user3"))
-          res.getWriter().printf("TOKEN:token3\n");
-      }
-    }
-  }
 
 }

Added: incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java?rev=1181757&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
(added)
+++ incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
Tue Oct 11 12:49:36 2011
@@ -0,0 +1,99 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.wiki_tests;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.ServletHolder;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import java.io.*;
+import java.util.*;
+
+/** Mock wiki service */
+public class MockWikiService
+{
+  Server server;
+    
+  public MockWikiService()
+  {
+    server = new Server(8089);
+    Context asContext = new Context(server,"/w",Context.SESSIONS);
+    asContext.addServlet(new ServletHolder(new WikiAPIServlet()), "/api.php");
+  }
+    
+  public void start() throws Exception
+  {
+    server.start();
+  }
+    
+  public void stop() throws Exception
+  {
+    server.stop();
+  }
+
+  public static class WikiAPIServlet extends HttpServlet
+  {
+    @Override
+    public void service(HttpServletRequest req, HttpServletResponse res)
+      throws IOException
+    {
+      String format = req.getParameter("format");
+      if (!format.equals("xml"))
+        throw new IOException("Format parameter incorrect: "+format);
+      String list = req.getParameter("list");
+      String action = req.getParameter("action");
+      if (action == null && list == null)
+        throw new IOException("Must have either action or list");
+      if (action != null && list != null)
+        throw new IOException("Cannot have both action and list");
+      if (action != null)
+      {
+        if (!action.equals("query"))
+          throw new IOException("Action parameter incorrect: "+query);
+        String prop = req.getParameter("prop");
+        String pageIds = req.getParameter("pageids");
+        String rvprop = req.getParameter("rvprop");
+        String inprop = req.getParameter("inprop");
+        // MHL
+      }
+      else if (list != null)
+      {
+        if (!list.equals("allpages"))
+          throw new IOException("List parameter incorrect: "+list);
+        String apfrom = req.getParameter("apfrom");
+        String aplimit = req.getParameter("aplimit");
+        // MHL
+      }
+        
+      // MHL
+      String user = req.getParameter("username");
+      res.setStatus(HttpServletResponse.SC_OK);
+      if(user.equals("user1") || user.equals("user2") || user.equals("user3"))
+        res.getWriter().printf("TOKEN:token1\n");
+      if(user.equals("user2") || user.equals("user3"))
+        res.getWriter().printf("TOKEN:token2\n");
+      if(user.equals("user3"))
+        res.getWriter().printf("TOKEN:token3\n");
+    }
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-256/tests/wiki/src/test/java/org/apache/manifoldcf/wiki_tests/MockWikiService.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message