incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r365999 - in /incubator/graffito/trunk/jcr/spring/src: java/org/apache/portals/graffito/jcr/spring/demo/application/ test/ test/org/ test/org/apache/ test/org/apache/portals/ test/org/apache/portals/graffito/ test/org/apache/portals/graffit...
Date Wed, 04 Jan 2006 21:23:32 GMT
Author: clombart
Date: Wed Jan  4 13:23:24 2006
New Revision: 365999

URL: http://svn.apache.org/viewcvs?rev=365999&view=rev
Log:
Transform the main app demo into unit test

Added:
    incubator/graffito/trunk/jcr/spring/src/test/
    incubator/graffito/trunk/jcr/spring/src/test/org/
    incubator/graffito/trunk/jcr/spring/src/test/org/apache/
    incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/
    incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/
    incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/
    incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
  (with props)
Removed:
    incubator/graffito/trunk/jcr/spring/src/java/org/apache/portals/graffito/jcr/spring/demo/application/Main.java

Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java?rev=365999&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
(added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
Wed Jan  4 13:23:24 2006
@@ -0,0 +1,105 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.portals.graffito.jcr;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import org.apache.portals.graffito.jcr.spring.demo.components.ArticleService;
+import org.apache.portals.graffito.jcr.spring.demo.components.NewsService;
+import org.apache.portals.graffito.jcr.spring.demo.model.Article;
+import org.apache.portals.graffito.jcr.spring.demo.model.News;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.ResourceLoader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test Mapper
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class SimpleTest extends TestCase
+{
+
+    
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public SimpleTest(String testName)
+    {
+        super(testName);
+    }
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(SimpleTest.class);
+    }
+
+    public void testComponents()    
+    {
+		System.out.println("Init Spring");
+		AbstractApplicationContext context = new FileSystemXmlApplicationContext("conf/applicationContext-repository.xml");
+		//ResourceLoader loader = new DefaultResourceLoader();
+
+		System.out.println("Add article");
+		ArticleService service = (ArticleService) context .getBean("org.apache.portals.graffito.jcr.spring.demo.components.ArticleService");
+		Article article = new Article();
+		article.setPath("/article1");
+		article.setAuthor("Christophe");
+		article.setContent("This is an interesting content");
+		article.setCreationDate(new Date());
+		article.setDescription("This is the article description");
+		article.setTitle("Article Title");
+
+		service.createArticle(article);
+
+		System.out.println("Check News");
+		NewsService newsService = (NewsService) context .getBean("org.apache.portals.graffito.jcr.spring.demo.components.NewsService");
+		Iterator news = newsService.getNews().iterator();
+		while (news.hasNext())
+		{
+			News newsFound = (News) news.next();
+			System.out.println("News found : " + newsFound.getContent());
+		}
+		context.close();
+    	
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message