Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r24 - trunk: . src/main/java/com/artilekt/modules/utils/io src/test/java/com/artilekt/modules/jetmailer src/test/java/com/artilekt/modules/parsers/csv src/test/java/com/artilekt/modules/template src/test/java/com/artilekt/modules/template/freemarker src/test/java/com/artilekt/modules/template/velocity

jetmailer
Discussion topic

Back to topic list

svn commit: r24 - trunk: . src/main/java/com/artilekt/modules/utils/io src/test/java/com/artilekt/modules/jetmailer src/test/java/com/artilekt/modules/parsers/csv src/test/java/com/artilekt/modules/template src/test/java/com/artilekt/modules/template/freemarker src/test/java/com/artilekt/modules/template/velocity

Reply

Author volenin
Full name Vladimir Olenin
Date 2006-08-27 21:28:17 PDT
Message Author: volenin
Date: 2006-08-27 21:28:17-0700
New Revision: 24

Added:
   trunk/src/main/java/​com/artilekt/modules​/utils/io/PackageRes​ource.java
   trunk/src/test/java/​com/artilekt/modules​/parsers/csv/csvtest​.txt
   trunk/src/test/java/​com/artilekt/modules​/template/AbstractTe​mplateServiceTest.ja​va
      - copied, changed from r23, /trunk/src/test/java​/com/artilekt/module​s/template/TemplateS​erviceTest.java
   trunk/src/test/java/​com/artilekt/modules​/template/templateSe​rviceTest.xml
      - copied, changed from r23, /trunk/src/test/java​/com/artilekt/module​s/template/freemarke​r/freemarkerTestTmpl​.xml
   trunk/src/test/java/​com/artilekt/modules​/template/velocity/
   trunk/src/test/java/​com/artilekt/modules​/template/velocity/T​emplateServiceTest.j​ava
Removed:
   trunk/src/test/java/​com/artilekt/modules​/template/TemplateSe​rviceTest.java
   trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/freemarkerTestTmpl.​xml
Modified:
   trunk/pom.xml
   trunk/src/main/java/​com/artilekt/modules​/utils/io/ResourceLo​cator.java
   trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a
   trunk/src/test/java/​com/artilekt/modules​/parsers/csv/CSVPars​erTest.java
   trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/TemplateServiceTest​.java

Log:


Modified: trunk/pom.xml
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/po​m.xml?view=diff&​rev=24&p1=trunk/​pom.xml&p2=trunk​/pom.xml&r1=23​&r2=24
====================​====================​====================​==================
--- trunk/pom.xml (original)
+++ trunk/pom.xml 2006-08-27 21:28:17-0700
@@ -68,6 +68,15 @@
           </execution>
         </executions>
       </plugin>
+
+ <plugin>
+ <groupId>org.a​pache.maven.plugins​</groupId>
+ <artifactId>ma​ven-surefire-plugin​</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
     </plugins>
   </build>
 

Added: trunk/src/main/java/​com/artilekt/modules​/utils/io/PackageRes​ource.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/main/java/com/arti​lekt/modules/utils/i​o/PackageResource.ja​va?view=auto&rev​=24
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/main/java/​com/artilekt/modules​/utils/io/PackageRes​ource.java 2006-08-27 21:28:17-0700
@@ -0,0 +1,21 @@
+package com.artilekt.modules.utils.io;
+
+import org.springframework.​core.io.ClassPathRes​ource;
+
+
+/**
+ * Author: Vladimir Olenin
+ * Date: 27-Aug-2006
+ * Time: 12:41:23
+ */
+public class PackageResource extends ClassPathResource {
+
+ public PackageResource(Class cl, String filename) {
+ this(cl.getPackage(), filename);
+ }
+
+ public PackageResource(Package pkg, String filename) {
+ super(pkg.getName().​replace('.', '/') + '/' + filename);
+ }
+
+}

Modified: trunk/src/main/java/​com/artilekt/modules​/utils/io/ResourceLo​cator.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/main/java/com/arti​lekt/modules/utils/i​o/ResourceLocator.ja​va?view=diff&rev​=24&p1=trunk/src​/main/java/com/artil​ekt/modules/utils/io​/ResourceLocator.jav​a&p2=trunk/src/m​ain/java/com/artilek​t/modules/utils/io/R​esourceLocator.java​&r1=23&r2=24
====================​====================​====================​==================
--- trunk/src/main/java/​com/artilekt/modules​/utils/io/ResourceLo​cator.java (original)
+++ trunk/src/main/java/​com/artilekt/modules​/utils/io/ResourceLo​cator.java 2006-08-27 21:28:17-0700
@@ -16,6 +16,7 @@
 
 package com.artilekt.modules.utils.io;
 
+import com.artilekt.modules​.common.Initializati​onException;
 import org.springframework.core.io.*;
 
 import java.io.File;
@@ -23,15 +24,13 @@
 import java.io.InputStream;
 import java.net.URL;
 
-import com.artilekt.modules​.common.Initializati​onException;
-
 
 /**
  * Author: Vladimir Olenin
  * Date: 16-Oct-2005
  * Time: 14:39:25
  */
-public class ResourceLocator extends AbstractResource implements InputStreamSource {
+public class ResourceLocator extends AbstractResource {
   String path;
   Resource res;
 

Modified: trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/jetmail​er/SimpleEmailDispat​cherTest.java?view=d​iff&rev=24&p​1=trunk/src/test/jav​a/com/artilekt/modul​es/jetmailer/SimpleE​mailDispatcherTest.j​ava&p2=trunk/src​/test/java/com/artil​ekt/modules/jetmaile​r/SimpleEmailDispatc​herTest.java&r1=​23&r2=24
====================​====================​====================​==================
--- trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a (original)
+++ trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a 2006-08-27 21:28:17-0700
@@ -19,8 +19,7 @@
 import com.artilekt.modules​.jetmailer.model.Att​achment;
 import com.artilekt.modules​.jetmailer.model.Mes​sage;
 import com.artilekt.modules​.test.AbstractDepend​encyInjectionBeanFac​toryTests;
-import com.artilekt.modules​.utils.PathConverter​s;
-import org.springframework.​core.io.ClassPathRes​ource;
+import com.artilekt.modules​.utils.io.PackageRes​ource;
 import org.springframework.​core.io.Resource;
 
 import java.util.ArrayList;
@@ -42,7 +41,7 @@
     msg.setBody("Hello, WORLD");
     msg.setSubject("HELLO!");
     msg.setReplyTo("mail​@scientechs.com");
- Resource res = new ClassPathResource(Pa​thConverters.toFileS​ystemPath(getClass()​.getPackage())+getCl​ass().getSimpleName(​)+".class");
+ Resource res = new PackageResource(getClass(), getClass().getSimple​Name()+".class");
     Attachment attach = new Attachment();
     attach.setPath(res.g​etFile().getCanonica​lPath());
     List attachs = new ArrayList();

Modified: trunk/src/test/java/​com/artilekt/modules​/parsers/csv/CSVPars​erTest.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/parsers​/csv/CSVParserTest.j​ava?view=diff&re​v=24&p1=trunk/sr​c/test/java/com/arti​lekt/modules/parsers​/csv/CSVParserTest.j​ava&p2=trunk/src​/test/java/com/artil​ekt/modules/parsers/​csv/CSVParserTest.ja​va&r1=23&r2=​24
====================​====================​====================​==================
--- trunk/src/test/java/​com/artilekt/modules​/parsers/csv/CSVPars​erTest.java (original)
+++ trunk/src/test/java/​com/artilekt/modules​/parsers/csv/CSVPars​erTest.java 2006-08-27 21:28:17-0700
@@ -16,6 +16,7 @@
 
 package com.artilekt.modules​.parsers.csv;
 
+import com.artilekt.modules​.utils.io.PackageRes​ource;
 import junit.framework.TestCase;
 
 import java.io.InputStream;
@@ -31,7 +32,8 @@
   InputStream in;
 
   protected void setUp() throws Exception {
- in = getClass().getResour​ceAsStream("/test/re​sources/csv.txt");
+ PackageResource res = new PackageResource(getClass(), "csvtest.txt");
+ in = res.getInputStream();
   }
 
   protected void tearDown() throws Exception {

Added: trunk/src/test/java/​com/artilekt/modules​/parsers/csv/csvtest​.txt
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/parsers​/csv/csvtest.txt?vie​w=auto&rev=24
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/test/java/​com/artilekt/modules​/parsers/csv/csvtest​.txt 2006-08-27 21:28:17-0700
@@ -0,0 +1,8 @@
+# delims: ,;|
+# tokens: $alias $name $email
+
+Schumi, Michael Schumacher, schumi at formula1 dot com
+007; James Bond; 007 at mi2 dot co dot uk
+Billy Boy | Bill Gates | billy at microsoft dot com
+Zorro, , zorro at hollywood dot com
+, Vladimir Olenin ; vlad at vladsite dot com

Copied: trunk/src/test/java/​com/artilekt/modules​/template/AbstractTe​mplateServiceTest.ja​va (from r23, /trunk/src/test/java​/com/artilekt/module​s/template/TemplateS​erviceTest.java)
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/AbstractTemplateSe​rviceTest.java?view=​diff&rev=24&​p1=/trunk/src/test/j​ava/com/artilekt/mod​ules/template/Templa​teServiceTest.java​&p2=trunk/src/test​/java/com/artilekt/m​odules/template/Abst​ractTemplateServiceT​est.java&r1=23​&r2=24
====================​====================​====================​==================
--- /trunk/src/test/java​/com/artilekt/module​s/template/TemplateS​erviceTest.java (original)
+++ trunk/src/test/java/​com/artilekt/modules​/template/AbstractTe​mplateServiceTest.ja​va 2006-08-27 21:28:17-0700
@@ -16,10 +16,9 @@
 
 package com.artilekt.modules.template;
 
-import com.artilekt.modules​.template.TemplateSe​rvice;
-import com.artilekt.modules​.template.velocity.V​elocityEngineImpl;
+import com.artilekt.modules​.utils.io.PackageRes​ource;
+import com.artilekt.modules​.utils.io.StreamUtil​s;
 import junit.framework.TestCase;
-import org.apache.velocity.​app.VelocityEngine;
 
 import java.io.BufferedReader;
 import java.io.InputStream;
@@ -32,34 +31,20 @@
  * Date: 28-Mar-2006
  * Time: 21:40:07
  */
-public class TemplateServiceTest extends TestCase {
- TemplateService tmplService;
-
+public abstract class AbstractTemplateServiceTest extends TestCase {
 
   public void test() throws Exception {
     Map values = new HashMap();
- values.put("email", "kot at kot dot kot");
- values.put("alias", "K.O.T.");
- InputStream in = tmplService.merge(values, "classes/test/messag​eTemplate.xml");
- BufferedReader reader =new BufferedReader(new InputStreamReader(in));
- String line = null;
- while ((line = reader.readLine()) != null) {
- System.out.println(line);
- }
- }
+ values.put("test", "This is a value of 'test' variable");
+ values.put("abc", "This is a value of 'abc' variable");
 
+ PackageResource res = new PackageResource(Abst​ractTemplateServiceT​est.class, "templateServiceTest.xml");
+ StreamUtils.reader2writer(new BufferedReader(new InputStreamReader(re​s.getInputStream()))​, System.out);
 
- protected void setUp() throws Exception {
- VelocityEngineImpl tmplService = new VelocityEngineImpl();
- VelocityEngine engine = new VelocityEngine();
- engine.setProperty(V​elocityEngine.RUNTIM​E_LOG_LOGSYSTEM, this);
- engine.init();
- tmplService.setEngine(engine);
- this.tmplService = tmplService;
+ InputStream in = getTemplateService()​.merge(values, res.getFile().getPath());
+ StreamUtils.reader2writer(new BufferedReader(new InputStreamReader(in)), System.out);
   }
 
- protected void tearDown() throws Exception {
-
- }
+ protected abstract TemplateService getTemplateService() throws Exception;
 
 }

Removed: trunk/src/test/java/​com/artilekt/modules​/template/TemplateSe​rviceTest.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/TemplateServiceTes​t.java?view=auto​&rev=23

Modified: trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/TemplateServiceTest​.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/freemarker/Templat​eServiceTest.java?vi​ew=diff&rev=24​&p1=trunk/src/test​/java/com/artilekt/m​odules/template/free​marker/TemplateServi​ceTest.java&p2=t​runk/src/test/java/c​om/artilekt/modules/​template/freemarker/​TemplateServiceTest.​java&r1=23&r​2=24
====================​====================​====================​==================
--- trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/TemplateServiceTest​.java (original)
+++ trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/TemplateServiceTest​.java 2006-08-27 21:28:17-0700
@@ -1,45 +1,26 @@
 package com.artilekt.modules​.template.freemarker​;
 
-import org.springframework.​test.AbstractDepende​ncyInjectionSpringCo​ntextTests;
+import com.artilekt.modules​.template.AbstractTe​mplateServiceTest;
 import com.artilekt.modules​.template.TemplateSe​rvice;
-import com.artilekt.modules​.utils.PathConverter​s;
-import com.artilekt.modules​.utils.io.StreamUtil​s;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.io.*;
 
 /**
  * Author: Vladimir Olenin
  * Date: 12-Jun-2006
  * Time: 21:37:14
  */
-public class TemplateServiceTest extends AbstractDependencyIn​jectionSpringContext​Tests {
- protected TemplateService freemarkerTemplateService;
-
- public void test() throws Exception {
- Map values = new HashMap();
- values.put("test", "This is a value of 'test' variable");
- values.put("abc", "This is a value of 'abc' variable");
-
- String tmplPath = getTemplatePath("fre​emarkerTestTmpl.xml"​);
- StreamUtils.reader2writer(new BufferedReader(new FileReader("./"+tmplPath)), System.out);
-
- InputStream in = freemarkerTemplateSe​rvice.merge(values, tmplPath);
- StreamUtils.reader2writer(new BufferedReader(new InputStreamReader(in)), System.out);
- }
-
+public class TemplateServiceTest extends AbstractTemplateServiceTest {
 
- private String getTemplatePath(String tmplName) {
- return "test/classes/" + PathConverters.toFil​eSystemPath(getClass​().getPackage()) + tmplName;
- }
+ protected TemplateService templateService;
+ protected TemplateService getTemplateService() throws Exception {
+ if (templateService != null) return templateService;
+
+ ConfigurationFactory cfgFactory = new ConfigurationFactory();
+ cfgFactory.setTemplatePath("");
+ FreemarkerEngineImpl fmEngine = new FreemarkerEngineImpl();
+ fmEngine.setConfigur​ation(cfgFactory.cre​ateInstance());
+ templateService = fmEngine;
 
- //====== Test setup ======//
- protected String[] getConfigLocations() {
- return new String[]{"classpath*​:**/beans.xml"};
+ return templateService;
   }
 
- public boolean isPopulateProtectedVariables() {
- return true;
- }
 }

Removed: trunk/src/test/java/​com/artilekt/modules​/template/freemarker​/freemarkerTestTmpl.​xml
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/freemarker/freemar​kerTestTmpl.xml?view​=auto&rev=23

Copied: trunk/src/test/java/​com/artilekt/modules​/template/templateSe​rviceTest.xml (from r23, /trunk/src/test/java​/com/artilekt/module​s/template/freemarke​r/freemarkerTestTmpl​.xml)
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/templateServiceTes​t.xml?view=diff&​rev=24&p1=/trunk​/src/test/java/com/a​rtilekt/modules/temp​late/freemarker/free​markerTestTmpl.xml​&p2=trunk/src/test​/java/com/artilekt/m​odules/template/temp​lateServiceTest.xml​&r1=23&r2=24
====================​====================​====================​==================

Added: trunk/src/test/java/​com/artilekt/modules​/template/velocity/T​emplateServiceTest.j​ava
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/templat​e/velocity/TemplateS​erviceTest.java?view​=auto&rev=24
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/test/java/​com/artilekt/modules​/template/velocity/T​emplateServiceTest.j​ava 2006-08-27 21:28:17-0700
@@ -0,0 +1,27 @@
+package com.artilekt.modules​.template.velocity;
+
+import com.artilekt.modules​.template.AbstractTe​mplateServiceTest;
+import com.artilekt.modules​.template.TemplateSe​rvice;
+import org.apache.velocity.​app.VelocityEngine;
+
+/**
+ * Author: Vladimir Olenin
+ * Date: 27-Aug-2006
+ * Time: 21:07:01
+ */
+public class TemplateServiceTest extends AbstractTemplateServiceTest {
+
+ TemplateService templateService;
+ protected TemplateService getTemplateService() throws Exception {
+ if (templateService != null) return templateService;
+
+ VelocityEngineImpl tmplService = new VelocityEngineImpl();
+ VelocityEngine engine = new VelocityEngine();
+ engine.setProperty(V​elocityEngine.RUNTIM​E_LOG_LOGSYSTEM, this);
+ engine.init();
+ tmplService.setEngine(engine);
+ this.templateService = tmplService;
+
+ return templateService;
+ }
+}

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r24 - trunk: . src/main/java/com/artilekt/modules/utils/io src/test/java/com/artilekt/modules/jetmailer src/test/java/com/artilekt/modules/parsers/csv src/test/java/com/artilekt/modules/te... volenin Vladimir Olenin 2006-08-27 21:28:17 PDT
Messages per page: