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:47:54 UTC
svn commit: r414366 - in
/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test:
components/impl/ components/impl/ArticleServiceImpl.java
components/impl/NewsServiceImpl.java model/ model/Article.java
model/News.java
Author: clombart
Date: Wed Jun 14 12:47:54 2006
New Revision: 414366
URL: http://svn.apache.org/viewvc?rev=414366&view=rev
Log:
Add component impl & model used in the unit tests
Added:
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java (with props)
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java (with props)
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java (with props)
incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java (with props)
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java?rev=414366&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java Wed Jun 14 12:47:54 2006
@@ -0,0 +1,97 @@
+/*
+ * 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.impl;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.query.Filter;
+import org.apache.portals.graffito.jcr.query.Query;
+import org.apache.portals.graffito.jcr.query.QueryManager;
+import org.apache.portals.graffito.jcr.spring.JcrMappingTemplate;
+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;
+
+/**
+ * Default implementation for {@link org.apache.portals.graffito.jcr.spring.test.components.ArticleService}
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public class ArticleServiceImpl implements ArticleService {
+ private static final Log log = LogFactory.getLog(ArticleServiceImpl.class);
+
+ private JcrMappingTemplate jcrMappingtemplate;
+ private NewsService newsService;
+
+
+ public void createArticle(Article article)
+ {
+
+ jcrMappingtemplate.insert(article);
+ jcrMappingtemplate.save();
+
+
+ News news = new News();
+ news.setContent("A new article has been created by " + article.getAuthor());
+ news.setCreationDate(new Date());
+ news.setPath("/news-" + System.currentTimeMillis());
+ newsService.createNews(news);
+ }
+
+ public Collection getArticles()
+ {
+
+ QueryManager queryManager = jcrMappingtemplate.createQueryManager();
+ Filter filter = queryManager.createFilter(Article.class);
+
+ Query query = queryManager.createQuery(filter);
+ return jcrMappingtemplate.getObjects(query);
+ }
+
+
+ public NewsService getNewsService()
+ {
+ return newsService;
+ }
+
+ public void setNewsService(NewsService newsService)
+ {
+ this.newsService = newsService;
+ }
+
+ /**
+ * @return Returns the template.
+ */
+ public JcrMappingTemplate getJcrMappingTemplate() {
+ return jcrMappingtemplate;
+ }
+
+ /**
+ * @param template The template to set.
+ */
+ public void setJcrMappingTemplate(JcrMappingTemplate template) {
+ this.jcrMappingtemplate = template;
+ }
+
+
+
+}
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/ArticleServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java?rev=414366&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java Wed Jun 14 12:47:54 2006
@@ -0,0 +1,75 @@
+/*
+ * 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.impl;
+
+import java.util.Collection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.query.Filter;
+import org.apache.portals.graffito.jcr.query.Query;
+import org.apache.portals.graffito.jcr.query.QueryManager;
+import org.apache.portals.graffito.jcr.spring.JcrMappingTemplate;
+import org.apache.portals.graffito.jcr.spring.test.components.NewsService;
+import org.apache.portals.graffito.jcr.spring.test.model.News;
+
+/**
+ * Default implementation for {@link org.apache.portals.graffito.jcr.spring.test.components.ArticleService}
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public class NewsServiceImpl implements NewsService {
+ private static final Log log = LogFactory.getLog(NewsServiceImpl.class);
+
+ private JcrMappingTemplate jcrMappingtemplate;
+
+ public void createNews(News news)
+ {
+ jcrMappingtemplate.insert(news);
+ jcrMappingtemplate.save();
+
+ }
+
+ public Collection getNews()
+ {
+
+ QueryManager queryManager = jcrMappingtemplate.createQueryManager();
+ Filter filter = queryManager.createFilter(News.class);
+
+ Query query = queryManager.createQuery(filter);
+ return jcrMappingtemplate.getObjects(query);
+ }
+
+
+ /**
+ * @return Returns the template.
+ */
+ public JcrMappingTemplate getJcrMappingTemplate() {
+ return jcrMappingtemplate;
+ }
+
+ /**
+ * @param template The template to set.
+ */
+ public void setJcrMappingTemplate(JcrMappingTemplate template) {
+ this.jcrMappingtemplate = template;
+ }
+
+
+
+}
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/components/impl/NewsServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java?rev=414366&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java Wed Jun 14 12:47:54 2006
@@ -0,0 +1,93 @@
+/*
+ * 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.model;
+
+
+import java.util.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Simple Article class
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class Article
+{
+ protected final static Log log = LogFactory.getLog(Article.class);
+
+ protected String path;
+ protected String title;
+ protected String description;
+ protected String author;
+ protected Date creationDate;
+ protected String content;
+
+
+ public String getPath()
+ {
+ return path;
+ }
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+ public String getAuthor()
+ {
+ return author;
+ }
+ public void setAuthor(String author)
+ {
+ this.author = author;
+ }
+ public String getContent()
+ {
+ return content;
+ }
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+ public Date getCreationDate()
+ {
+ return creationDate;
+ }
+ public void setCreationDate(Date creationDate)
+ {
+ this.creationDate = creationDate;
+ }
+ public String getDescription()
+ {
+ return description;
+ }
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+ public String getTitle()
+ {
+ return title;
+ }
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+
+}
+
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/Article.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java?rev=414366&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java (added)
+++ incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java Wed Jun 14 12:47:54 2006
@@ -0,0 +1,66 @@
+/*
+ * 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.model;
+
+
+import java.util.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Simple New class
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class News
+{
+ protected final static Log log = LogFactory.getLog(News.class);
+
+ protected String path;
+ protected Date creationDate;
+ protected String content;
+
+
+
+ public String getPath()
+ {
+ return path;
+ }
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+ public String getContent()
+ {
+ return content;
+ }
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+ public Date getCreationDate()
+ {
+ return creationDate;
+ }
+ public void setCreationDate(Date creationDate)
+ {
+ this.creationDate = creationDate;
+ }
+
+}
+
Propchange: incubator/graffito/trunk/jcr/spring/src/test/org/apache/portals/graffito/jcr/spring/test/model/News.java
------------------------------------------------------------------------------
svn:executable = *