Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit 6bc92a4

Browse files
committed
Pull request #5: MISPDEV-31 directory structure maven style
Merge in X-ROAD/misp2-web-app from MISPDEV-31_directory_structure_maven_style to develop * commit '72266fa9ab478428d0735e05c5ba288a1f5a7f1a': MISPDEV-31 fix paths in web.xml MISPDEV-28 war name is misp2.war - no version MISPDEV-28 StrutsJunit testing discontinued for a while MISPDEV-28 return of .cfg-files MISPDEV-28 mvn dir restruture - test / java & resources MISPDEV-28 package*.properties to resources MISPDEV-28 mvn dir restruture - webcontent -> webapp, root-> resources MISPDEV-28 mvn dir restruture - java source
2 parents 26e1124 + 72266fa commit 6bc92a4

File tree

591 files changed

+83
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

591 files changed

+83
-111
lines changed

.project

+11
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,15 @@
5151
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
5252
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
5353
</natures>
54+
<filteredResources>
55+
<filter>
56+
<id>1604491927361</id>
57+
<name></name>
58+
<type>30</type>
59+
<matcher>
60+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
61+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
62+
</matcher>
63+
</filter>
64+
</filteredResources>
5465
</projectDescription>

.settings/org.eclipse.core.resources.prefs

-2
This file was deleted.

LICENSE

-21
This file was deleted.
File renamed without changes.

pom.xml

+35-59
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,23 @@
138138
</exclusion>
139139
</exclusions>
140140
</dependency>
141+
<dependency>
142+
<groupId>org.apache.struts</groupId>
143+
<artifactId>struts2-junit-plugin</artifactId>
144+
<version>${struts.version}</version>
145+
</dependency>
146+
<dependency>
147+
<groupId>javax.servlet</groupId>
148+
<artifactId>javax.servlet-api</artifactId>
149+
<version>3.1.0</version>
150+
<scope>test</scope>
151+
</dependency>
152+
<dependency>
153+
<groupId>javax.servlet.jsp</groupId>
154+
<artifactId>javax.servlet.jsp-api</artifactId>
155+
<version>2.3.3</version>
156+
<scope>test</scope>
157+
</dependency>
141158
<dependency>
142159
<groupId>org.apache.struts</groupId>
143160
<artifactId>struts2-sitemesh-plugin</artifactId>
@@ -280,7 +297,7 @@
280297
<artifactId>esteidtestcerts</artifactId>
281298
<version>3.7.2.652</version>
282299
<scope>system</scope>
283-
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/esteidtestcerts.jar</systemPath>
300+
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/esteidtestcerts.jar</systemPath>
284301
</dependency>
285302

286303
<dependency>
@@ -298,28 +315,28 @@
298315
<artifactId>orbeon</artifactId>
299316
<scope>system</scope>
300317
<version>1.0</version>
301-
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/orbeon-xforms-filter.jar</systemPath>
318+
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/orbeon-xforms-filter.jar</systemPath>
302319
</dependency>
303320
<dependency>
304321
<groupId>core-renderer</groupId>
305322
<artifactId>core-renderer</artifactId>
306323
<scope>system</scope>
307324
<version>1.0</version>
308-
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/core-renderer.jar</systemPath>
325+
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/core-renderer.jar</systemPath>
309326
</dependency>
310327
<dependency>
311328
<groupId>iaikPkcs11Wrapper</groupId>
312329
<artifactId>iaikPkcs11Wrapper</artifactId>
313330
<scope>system</scope>
314331
<version>1.0</version>
315-
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/iaikPkcs11Wrapper.jar</systemPath>
332+
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/iaikPkcs11Wrapper.jar</systemPath>
316333
</dependency>
317334
<dependency>
318335
<groupId>iText</groupId>
319336
<artifactId>iText</artifactId>
320337
<scope>system</scope>
321338
<version>2.1.7</version>
322-
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/iText-2.1.7.jar</systemPath>
339+
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/iText-2.1.7.jar</systemPath>
323340
</dependency>
324341
<dependency>
325342
<groupId>javax.servlet</groupId>
@@ -381,81 +398,40 @@
381398

382399
<build>
383400
<plugins>
384-
<plugin>
401+
<plugin>
385402
<groupId>org.apache.maven.plugins</groupId>
386403
<artifactId>maven-war-plugin</artifactId>
404+
<version>2.2</version>
387405
<configuration>
388-
<webappDirectory>${project.build.directory}/misp2</webappDirectory>
389406
<warName>misp2</warName>
390-
<webXml>WebContent/WEB-INF/web.xml</webXml>
391-
<webResources>
392-
<resource>
393-
<directory>WebContent</directory>
394-
<filtering>false</filtering>
395-
</resource>
396-
<resource>
397-
<directory>src/</directory>
398-
<targetPath>WEB-INF/classes</targetPath>
399-
<excludes>
400-
<exclude>**/*.java</exclude>
401-
</excludes>
402-
</resource>
403-
</webResources>
404407
</configuration>
405-
</plugin>
408+
</plugin>
406409
<plugin>
410+
<groupId>org.apache.maven.plugins</groupId>
407411
<artifactId>maven-compiler-plugin</artifactId>
412+
<version>3.8.1</version>
408413
<configuration>
409414
<source>1.8</source>
410415
<target>1.8</target>
411416
</configuration>
412417
</plugin>
413418
<plugin>
414-
<groupId>org.codehaus.mojo</groupId>
415-
<artifactId>build-helper-maven-plugin</artifactId>
419+
<groupId>org.jacoco</groupId>
420+
<artifactId>jacoco-maven-plugin</artifactId>
421+
<version>0.8.5</version>
416422
<executions>
417-
<!-- Add source directory -->
418423
<execution>
419-
<id>add-source-directory</id>
420-
<phase>generate-sources</phase>
424+
<id>default-prepare-agent</id>
421425
<goals>
422-
<goal>add-source</goal>
426+
<goal>prepare-agent</goal>
423427
</goals>
424-
<configuration>
425-
<sources>
426-
<source>src/</source>
427-
</sources>
428-
</configuration>
429428
</execution>
430-
<!-- Add test source directory -->
431429
<execution>
432-
<id>add-test-source</id>
433-
<phase>generate-test-sources</phase>
430+
<id>default-report</id>
434431
<goals>
435-
<goal>add-test-source</goal>
432+
<goal>report</goal>
436433
</goals>
437-
<configuration>
438-
<sources>
439-
<source>test/</source>
440-
</sources>
441-
</configuration>
442-
</execution>
443-
<!-- Add /test directory also as resource directory,
444-
meaning resource files can be read from it as well -->
445-
<execution>
446-
<id>add-test-resource</id>
447-
<phase>generate-test-sources</phase>
448-
<goals>
449-
<goal>add-test-resource</goal>
450-
</goals>
451-
<configuration>
452-
<resources>
453-
<resource>
454-
<directory>test</directory>
455-
</resource>
456-
</resources>
457-
</configuration>
458-
</execution>
434+
</execution>
459435
</executions>
460436
</plugin>
461437
</plugins>

src/ee/aktors/misp2/action/HelpAction.java renamed to src/main/java/ee/aktors/misp2/action/HelpAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public String execute() throws FileNotFoundException {
8787

8888
private String getUserGuideFilePath(String lang, String targetDemographic, ServletContext servletContext) {
8989
return servletContext.getRealPath(
90-
"/pages/user_guide/" + targetDemographic + "/" + lang + "/kasutusjuhend.pdf");
90+
"/../src/main/webapp/pages/user_guide/" + targetDemographic + "/" + lang + "/kasutusjuhend.pdf");
9191
}
9292

9393
/**

src/ee/aktors/misp2/action/QueryAction.java renamed to src/main/java/ee/aktors/misp2/action/QueryAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ public String executeXforms() throws Exception {
640640
setQueryUUID(UUID.randomUUID().toString());
641641
setQueryId(getQueryUUID());
642642
File runXForms = new File(ServletActionContext.getServletContext().getRealPath("/")
643-
+ "/xforms-jsp/runq_" + getQuery().getName() + "_" + getQueryId() + ".xhtml");
643+
+ "/../src/main/webapp/xforms-jsp/runq_" + getQuery().getName() + "_" + getQueryId() + ".xhtml");
644644
// create temporary file for xforms
645645
if (runXForms.exists()) {
646646
runXForms.delete();

src/ee/aktors/misp2/action/VersionAction.java renamed to src/main/java/ee/aktors/misp2/action/VersionAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ private static Properties getPomProperties() throws IOException {
107107

108108
String rootPath;
109109
// in case deployed in external Tomcat server
110-
if (classPath.contains("/WEB-INF/")) {
111-
rootPath = getBeforeLast(classPath, "/WEB-INF/") + "/";
110+
if (classPath.contains("/../src/main/webapp/WEB-INF/")) {
111+
rootPath = getBeforeLast(classPath, "/../src/main/webapp/WEB-INF/") + "/";
112112
}
113113
// in case deployed internally in Eclipse
114114
else if (classPath.contains("/classes/")) {

src/ee/aktors/misp2/action/admin/ManagerAction.java renamed to src/main/java/ee/aktors/misp2/action/admin/ManagerAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public String saveUserAdmin() throws Exception {
264264
}
265265
}
266266
t3.getT3sec().setUserTo(person.getSsn());
267-
t3.getT3sec().setUserFrom("admin");
267+
t3.getT3sec().setUserFrom("../src/main/webapp/admin");
268268

269269
if (!log(t3)) {
270270
addActionError(getText("text.fail.save.log"));
@@ -296,7 +296,7 @@ public String saveUserAdmin() throws Exception {
296296
// --- Log portal manager setting
297297
T3SecWrapper t3 = initT3(LogQuery.MANAGER_SETTING);
298298
t3.getT3sec().setUserTo(person.getSsn());
299-
t3.getT3sec().setUserFrom("admin");
299+
t3.getT3sec().setUserFrom("../src/main/webapp/admin");
300300
if (!log(t3)) {
301301
addActionError(getText("text.fail.save.log"));
302302
LOGGER.warn("Setting manager failed because of logging problems.");
@@ -358,7 +358,7 @@ public String deleteManager() throws Exception {
358358
// --- Log portal manager setting
359359
T3SecWrapper t3 = initT3(LogQuery.MANAGER_DELETE);
360360
t3.getT3sec().setUserTo(orgPerson.getPersonId().getSsn());
361-
t3.getT3sec().setUserFrom("admin");
361+
t3.getT3sec().setUserFrom("../src/main/webapp/admin");
362362
if (!log(t3)) {
363363
addActionError(getText("text.fail.delete.log"));
364364
LOGGER.warn("Deleting manager failed because of logging problems.");

src/ee/aktors/misp2/filters/LoginCheckFilter.java renamed to src/main/java/ee/aktors/misp2/filters/LoginCheckFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filte
6363
HttpServletRequest request = (HttpServletRequest)req;
6464
HttpServletResponse response = (HttpServletResponse)resp;
6565
String servletPath = request.getServletPath();
66-
if (servletPath.startsWith("/xforms-jsp")
66+
if (servletPath.startsWith("/../src/main/webapp/xforms-jsp")
6767
|| servletPath.startsWith("/orbeon")) {
6868
HttpSession session = request.getSession();
6969

src/ee/aktors/misp2/model/GeneralBean.java renamed to src/main/java/ee/aktors/misp2/model/GeneralBean.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void updateTimeStamps() {
7474
if (session != null && getUsername() == null) {
7575
Person p = (Person) session.get(Const.SESSION_USER_HANDLE);
7676
if (p != null)
77-
setUsername(p.getSsn() == null ? "admin" : p.getSsn());
77+
setUsername(p.getSsn() == null ? "../src/main/webapp/admin" : p.getSsn());
7878
} else if (session == null && getUsername() == null) {
7979
LogManager.getLogger(BaseService.class).warn("Session is null. Username not set.");
8080
}

src/ee/aktors/misp2/util/FileUtil.java renamed to src/main/java/ee/aktors/misp2/util/FileUtil.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,7 @@ protected static String getCurrentClassPath() {
119119
return className;
120120
}
121121

122-
/**
123-
* Get file input stream from /src/ directory NB! Only for use in unit-tests.
124-
*
125-
* @param fileName
126-
* file path from /src/ folder.
127-
* @return file path from given directory
128-
*/
129-
public static String getConfigPathForTest(String fileName) {
130-
String currentPath = getCurrentClassPath();
131-
String configPath = currentPath.split("target")[0] + "src/" + fileName;
132-
LOGGER.trace("Config path: " + configPath);
133-
return configPath;
134-
}
122+
135123

136124
/**
137125
* Get file name with the following format

0 commit comments

Comments
 (0)