Project

General

Profile

« Previous | Next » 

Revision 46540

use logs, not sysouts

View differences:

modules/dnet-openaire-projects-exporter/trunk/src/test/java/eu/dnetlib/openaire/exporter/ProjectsControllerTest.java
4 4

  
5 5
import org.antlr.stringtemplate.StringTemplate;
6 6
import org.apache.commons.io.IOUtils;
7
import org.apache.commons.logging.Log;
8
import org.apache.commons.logging.LogFactory;
7 9
import org.junit.Before;
8 10
import org.junit.Test;
9 11
import org.springframework.core.io.ClassPathResource;
......
13 15

  
14 16
public class ProjectsControllerTest {
15 17

  
18
	private static final Log log = LogFactory.getLog(ProjectsControllerTest.class);
16 19
	private String queryTemplate = "/eu/dnetlib/openaire/exporter/sql/projects_fundings.sql.st";
17 20

  
18 21
	private Resource expectedQueryTemplate = new ClassPathResource("/eu/dnetlib/openaire/exporter/sql/expected_projects_fundings.sql.st");
......
36 39
		String res = controller.obtainQuery(params);
37 40
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
38 41
		st.setAttribute("fundingprefix", "ec__________::EC::FP7");
39
		System.out.println(res);
40
		System.out.println(st);
42
		log.debug(res);
43
		log.debug(st);
41 44
		assertEquals(st.toString(), res);
42 45
	}
43 46

  
......
48 51
		String res = controller.obtainQuery(params);
49 52
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
50 53
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::SP1");
51
		System.out.println(res);
54
		log.debug(res);
52 55
		assertEquals(st.toString(), res);
53 56
	}
54 57

  
......
59 62
		String res = controller.obtainQuery(params);
60 63
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
61 64
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::SP1::HEALTH");
62
		System.out.println(res);
65
		log.debug(res);
63 66
		assertEquals(st.toString(), res);
64 67
	}
65 68

  
......
70 73
		String res = controller.obtainQuery(params);
71 74
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
72 75
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::%::HEALTH");
73
		System.out.println(res);
76
		log.debug(res);
74 77
		assertEquals(st.toString(), res);
75 78
	}
76 79

  
......
81 84
		String res = controller.obtainQuery(params);
82 85
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
83 86
		st.setAttribute("fundingprefix", "wt__________::WT");
84
		System.out.println(res);
87
		log.debug(res);
85 88
		assertEquals(st.toString(), res);
86 89
	}
87 90

  
......
92 95
		String res = controller.obtainQuery(params);
93 96
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
94 97
		st.setAttribute("fundingprefix", "fct_________::FCT");
95
		System.out.println(res);
98
		log.debug(res);
96 99
		assertEquals(st.toString(), res);
97 100
	}
98 101

  
......
102 105
		params.setFundingPath(null);
103 106
		params.setStartFrom("2015-05-04");
104 107
		String res = controller.obtainQuery(params);
105
		System.out.println(res);
108
		log.debug(res);
106 109
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
107 110
		st.setAttribute("fundingprefix", "wt__________::WT");
108 111
		String q = st.toString() + " AND startdate >= '2015-05-04'";
......
116 119
		String res = controller.obtainQuery(params);
117 120
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream(),  ProjectsController.UTF8));
118 121
		st.setAttribute("fundingprefix", "snsf________::SNSF");
119
		System.out.println(res);
122
		log.debug(res);
120 123
		assertEquals(st.toString(), res);
121 124
	}
122 125

  
modules/dnet-openaire-projects-exporter/trunk/src/test/resources/log4j.properties
1
### Root Level ###
2
log4j.rootLogger=WARN, CONSOLE
3

  
4
### Configuration for the CONSOLE appender ###
5
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
6
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
7
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %d %c - %m%n
8

  
9
org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger
10

  
11
### Application Level ###
12
log4j.logger.eu.dnetlib=INFO
13
log4j.logger.eu.dnetlib.openaire.exporter=DEBUG

Also available in: Unified diff