Click here to Skip to main content
15,880,364 members
Articles / Programming Languages / Java / Java SE / J2EE

Modular J2EE, Using Spring DM, Zk and EclipseLink

Rate me:
Please Sign up or sign in to vote.
4.92/5 (9 votes)
21 Apr 2011CPOL15 min read 52.6K   8  
This article describes how to create a basic modular Java Enterprise Application, by using these Open Source frameworks
package com.cp.adrabi.jln.todo.tests.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;

/**
 * Class Test utils
 * 
 * @author ADRABI Abderrahim (z3vil)
 *
 */
public class TestUtil
{
	private static Logger LOG = Logger.getLogger(TestUtil.class);
	
	/**
	 * Make resources list
	 * 
	 * @param filename
	 * @param rootPath
	 * @return
	 */
	public static List<Resource> makeResources(String filename, String rootPath)
	{
		List<Resource> resources = new ArrayList<Resource>();
		BufferedReader br = new BufferedReader( new InputStreamReader(TestUtil.class.getResourceAsStream(filename)));
		String line  = null;
		try
		{
			while( (line = br.readLine()) != null )
			{
				resources.add( new FileSystemResource(rootPath + line) );
			}
		}
		catch (IOException e)
		{
			LOG.fatal("Can't create resources", e);
		}
		return resources;
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
Morocco Morocco
Adrabi!, Just another Ghost in the Shell =)

Comments and Discussions