svn commit: r742491 - in /lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya: cms/publication/ cms/workflow/ net/ transaction/

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Feb  9 13:44:22 2009
New Revision: 742491

URL: http://svn.apache.org/viewvc?rev=742491&view=rev
Log:
Continuing test migration.

Removed:
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/workflow/
Modified:
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DefaultDocumentTest.java
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentFactoryTest.java
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentManagerTest.java
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/TestPageEnvelope.java
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/net/InetAddressUtilTest.java
    lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/transaction/TransactionTest.java

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DefaultDocumentTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DefaultDocumentTest.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DefaultDocumentTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DefaultDocumentTest.java Mon Feb  9 13:44:22 2009
@@ -20,6 +20,8 @@
 
 package org.apache.lenya.cms.publication;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.lenya.ac.impl.AbstractAccessControlTest;
 
 /**
@@ -28,6 +30,8 @@
  * Generation>Code and Comments
  */
 public class DefaultDocumentTest extends AbstractAccessControlTest {
+    
+    private static final Log logger = LogFactory.getLog(DefaultDocumentTest.class);
 
     protected static final DocumentTestSet[] testSets = {
             new DocumentTestSet("/index.html", "/index", Publication.AUTHORING_AREA, "en", "html"),
@@ -83,7 +87,7 @@
         String uuid = pub.getArea(testSet.getArea()).getSite().getNode(testSet.getPath()).getUuid();
         DocumentIdentifier id = new DocumentIdentifier(pub.getId(), testSet.getArea(), uuid, testSet
                 .getLanguage());
-        DocumentImpl document = new DocumentImpl(getManager(), getFactory(), id, -1, getLogger());
+        DocumentImpl document = new DocumentImpl(getFactory(), id, -1, logger);
         document.setExtension(testSet.getExtension());
 
         return document;

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentFactoryTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentFactoryTest.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentFactoryTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentFactoryTest.java Mon Feb  9 13:44:22 2009
@@ -17,22 +17,26 @@
  */
 package org.apache.lenya.cms.publication;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
 
 /**
  * Document factory test.
  */
 public class DocumentFactoryTest extends AbstractAccessControlTest {
+    
+    private static final Log logger = LogFactory.getLog(DocumentFactoryTest.class);
+    
+    private Repository repository;
 
     /**
      * Tests the meta data.
      * @throws Exception
      */
     public void testDocumentFactory() throws Exception {
-        Session session = RepositoryUtil.getSession(getManager(), getRequest());
-        DocumentFactory factoryA = DocumentUtil.createDocumentFactory(getManager(), session);
+        Session session = this.repository.getSession(getRequest());
+        DocumentFactory factoryA = new DocumentFactoryImpl(session.getDocumentFactory().getSession(), logger);
 
         Publication publication = getPublication("test");
         
@@ -40,11 +44,15 @@
         Document docA2 = factoryA.get(publication, Publication.AUTHORING_AREA, "/index", "en");
         assertSame(docA1, docA2);
         
-        DocumentFactory factoryB = DocumentUtil.createDocumentFactory(getManager(), session);
+        DocumentFactory factoryB = new DocumentFactoryImpl(session.getDocumentFactory().getSession(), logger);
 
         Document docB1 = factoryB.get(publication, Publication.AUTHORING_AREA, "/index", "en");
         
         assertSame(docA1, docB1);
     }
 
+    public void setRepository(Repository repository) {
+        this.repository = repository;
+    }
+
 }

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentManagerTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentManagerTest.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentManagerTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/DocumentManagerTest.java Mon Feb  9 13:44:22 2009
@@ -124,7 +124,7 @@
 
         SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
         
-        NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
+        NodeSet nodes = SiteUtil.getSubSite(sourceNode);
         Document[] docs = nodes.getDocuments();
         Map doc2path = new HashMap();
 
@@ -171,7 +171,7 @@
         SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
         String[] sourceNames = getChildNames(sourceNode);
 
-        NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
+        NodeSet nodes = SiteUtil.getSubSite(sourceNode);
         Document[] docs = nodes.getDocuments();
         Map doc2path = new HashMap();
 

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/TestPageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/TestPageEnvelope.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/TestPageEnvelope.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/publication/TestPageEnvelope.java Mon Feb  9 13:44:22 2009
@@ -20,30 +20,34 @@
 
 package org.apache.lenya.cms.publication;
 
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.repository.SessionImpl;
 
 /**
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
  * Generation>Code and Comments
  */
 public class TestPageEnvelope extends PageEnvelope {
+
+    private static final Log logger = LogFactory.getLog(TestPageEnvelope.class);
+
     /**
      * Constructs a test page envelope.
      * @param publication The publication.
      * @param url The document url (starting with a slash).
      * @throws PageEnvelopeException when something goes wrong.
      */
-    public TestPageEnvelope(Publication publication, String url, ServiceManager manager,
-            Logger logger) throws PageEnvelopeException {
+    public TestPageEnvelope(Publication publication, String url, ServiceManager manager)
+            throws PageEnvelopeException {
         super();
         setContext("");
 
         try {
-            Session session = RepositoryUtil.createSession(manager, null, false);
-            DocumentFactory map = DocumentUtil.createDocumentFactory(manager, session);
+            Session session = new SessionImpl(null, false, logger);
+            DocumentFactory map = DocumentUtil.createDocumentFactory(session);
             setDocument(map.getFromURL(url));
         } catch (Exception e) {
             throw new PageEnvelopeException(e);

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/net/InetAddressUtilTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/net/InetAddressUtilTest.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/net/InetAddressUtilTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/net/InetAddressUtilTest.java Mon Feb  9 13:44:22 2009
@@ -20,11 +20,15 @@
 import java.net.UnknownHostException;
 
 import org.apache.cocoon.core.container.ContainerTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Inet address util test
  */
 public class InetAddressUtilTest extends ContainerTestCase {
+    
+    private static final Log logger = LogFactory.getLog(InetAddressUtilTest.class);
 
     public void testInetAddressUtil() throws UnknownHostException {
 
@@ -39,7 +43,7 @@
         InetAddress subnet = InetAddress.getByName(args[1]); // "255.255.255.0");
         InetAddress ip = InetAddress.getByName(args[2]); // "195.226.6.70");
         
-        InetAddressUtil util = new InetAddressUtil(getLogger());
+        InetAddressUtil util = new InetAddressUtil(logger);
         System.out.println(util.contains(network, subnet, ip));
     }
 }

Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/transaction/TransactionTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/transaction/TransactionTest.java?rev=742491&r1=742490&r2=742491&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/transaction/TransactionTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/transaction/TransactionTest.java Mon Feb  9 13:44:22 2009
@@ -18,24 +18,28 @@
 package org.apache.lenya.transaction;
 
 import org.apache.cocoon.core.container.ContainerTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.lenya.ac.Identity;
 
 public class TransactionTest extends ContainerTestCase {
+    
+    private Log logger = LogFactory.getLog(TransactionTest.class);
 
     public void testTransaction() throws TransactionException {
 
-        Identity lenya = new Identity(getLogger());
+        Identity lenya = new Identity(logger);
         lenya.addIdentifiable(new MockUser("lenya"));
 
-        Identity alice = new Identity(getLogger());
+        Identity alice = new Identity(logger);
         alice.addIdentifiable(new MockUser("alice"));
 
-        IdentityMap lenyaMap = new IdentityMapImpl(getLogger());
-        UnitOfWork lenyaUnit = new UnitOfWorkImpl(lenyaMap, lenya, getLogger());
+        IdentityMap lenyaMap = new IdentityMapImpl(logger);
+        UnitOfWork lenyaUnit = new UnitOfWorkImpl(lenyaMap, lenya, logger);
         IdentifiableFactory lenyaFactory = new MockFactory(lenyaUnit);
 
-        IdentityMap aliceMap = new IdentityMapImpl(getLogger());
-        UnitOfWork aliceUnit = new UnitOfWorkImpl(aliceMap, alice, getLogger());
+        IdentityMap aliceMap = new IdentityMapImpl(logger);
+        UnitOfWork aliceUnit = new UnitOfWorkImpl(aliceMap, alice, logger);
         IdentifiableFactory aliceFactory = new MockFactory(aliceUnit);
 
         MockTransactionable lenyaT1 = (MockTransactionable) lenyaMap.get(lenyaFactory, "t1");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.