You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2006/06/14 19:14:16 UTC
svn commit: r414361 - in
/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring:
./ SimpleTest.java test/ test/components/
test/components/ArticleService.java test/components/NewsService.java
Author: clombart
Date: Wed Jun 14 12:14:16 2006
New Revision: 414361
URL: http://svn.apache.org/viewvc?rev=414361&view=rev
Log:
Review OCM/JCR Spring support - Review the unit tests
Added:
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java (contents, props changed)
- copied, changed from r408764, incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java (with props)
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java (with props)
Copied: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java (from r408764, incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java)
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java?p2=incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java&p1=incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java&r1=408764&r2=414361&rev=414361&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/SimpleTest.java (original)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java Wed Jun 14 12:14:16 2006
@@ -14,15 +14,16 @@
* limitations under the License.
* ========================================================================
*/
-package org.apache.portals.graffito.jcr;
+package org.apache.portals.graffito.jcr.spring;
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.apache.portals.graffito.jcr.spring.test.components.ArticleService;
+import org.apache.portals.graffito.jcr.spring.test.components.NewsService;
+import org.apache.portals.graffito.jcr.spring.test.model.Article;
+import org.apache.portals.graffito.jcr.spring.test.model.News;
+import org.springframework.beans.BeansException;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.DefaultResourceLoader;
@@ -74,31 +75,36 @@
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());
+ try {
+ System.out.println("Init Spring");
+ AbstractApplicationContext context = new FileSystemXmlApplicationContext("src/spring-config/applicationContext-repository.xml");
+ //ResourceLoader loader = new DefaultResourceLoader();
+
+ System.out.println("Add article");
+ ArticleService service = (ArticleService) context .getBean("org.apache.portals.graffito.jcr.spring.test.components.ArticleService");
+ Article article = new Article();
+ article.setPath("/article");
+ 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.test.components.NewsService");
+ Iterator news = newsService.getNews().iterator();
+ while (news.hasNext())
+ {
+ News newsFound = (News) news.next();
+ System.out.println("News found : " + newsFound.getContent());
+ }
+ context.close();
+ } catch (Exception e) {
+
+ e.printStackTrace();
}
- context.close();
}
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/SimpleTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java?rev=414361&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java Wed Jun 14 12:14:16 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-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.spring.test.components;
+
+import java.util.Collection;
+
+import org.apache.portals.graffito.jcr.spring.test.model.Article;
+/**
+ *
+ * VERY Simple article management
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public interface ArticleService
+{
+ public void createArticle(Article article);
+
+ public Collection getArticles();
+}
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/ArticleService.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java?rev=414361&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java Wed Jun 14 12:14:16 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-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.spring.test.components;
+
+import java.util.Collection;
+
+import org.apache.portals.graffito.jcr.spring.test.model.News;
+/**
+ *
+ * VERY Simple news management
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public interface NewsService
+{
+ public void createNews(News news);
+
+ public Collection getNews();
+}
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/NewsService.java
------------------------------------------------------------------------------
svn:executable = *