فهرست منبع

add test cases

Shinsuke Sugaya 9 سال پیش
والد
کامیت
ccd9a3a371

+ 1 - 1
pom.xml

@@ -53,7 +53,7 @@
 
 		<!-- Testing -->
 		<junit.version>4.8.2</junit.version>
-		<utflute.version>0.5.0-sp8</utflute.version>
+		<utflute.version>0.5.1-RC2</utflute.version>
 
 		<!-- S2Robot -->
 		<s2robot.version>1.0.0-SNAPSHOT</s2robot.version>

+ 46 - 0
src/test/java/org/codelibs/fess/mylasta/FessActionDefTest.java

@@ -0,0 +1,46 @@
+package org.codelibs.fess.mylasta;
+
+import org.codelibs.fess.unit.UnitFessTestCase;
+
+public class FessActionDefTest extends UnitFessTestCase {
+
+    // ===================================================================================
+    //                                                                           Component
+    //                                                                           =========
+    /*
+    public void test_component() throws Exception {
+        // ## Arrange ##
+        String appWebPkg = ".app.web.";
+        String actionSuffix = "Action";
+    
+        // ## Act ##
+        policeStoryOfJavaClassChase((srcFile, clazz) -> {
+            if (clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers())) { // e.g. BaseAction
+                return;
+            }
+            final String className = clazz.getName();
+            if (className.contains(appWebPkg) && className.endsWith(actionSuffix)) {
+                // ## Assert ##
+                markHere("exists");
+                getComponent(clazz); // expect no exception
+            }
+        });
+        assertMarked("exists");
+    }
+    */
+
+    // ===================================================================================
+    //                                                                            Document
+    //                                                                            ========
+    /*
+    public void test_document() throws Exception {
+        DocumentGenerator documentGenerator = new DocumentGenerator();
+        documentGenerator.saveLastaDocMeta();
+    }
+    */
+
+    public void test_dummy() throws Exception {
+        // TODO remove
+        assertTrue(true);
+    }
+}

+ 10 - 0
src/test/java/org/codelibs/fess/unit/UnitFessTestCase.java

@@ -0,0 +1,10 @@
+package org.codelibs.fess.unit;
+
+import org.dbflute.utflute.lastaflute.WebContainerTestCase;
+
+public abstract class UnitFessTestCase extends WebContainerTestCase {
+    @Override
+    protected String prepareConfigFile() {
+        return "test_app.xml";
+    }
+}

+ 7 - 0
src/test/resources/test_app.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
+	"http://dbflute.org/meta/lastadi10.dtd">
+<components>
+	<include path="convention.xml" />
+	<include path="lastaflute.xml" />
+</components>

+ 0 - 32
src/test/resources/tomcat-users.xml

@@ -1,32 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You 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.
--->
-<tomcat-users>
-  <role rolename="fess"/>
-  <role rolename="solr"/>
-  <role rolename="manager-script"/>
-  <user username="admin" password="admin" roles="fess"/>
-  <user username="solradmin" password="solradmin" roles="solr"/>
-  <user username="manager" password="manager" roles="manager-script"/>
-<!--
-  <role rolename="tomcat"/>
-  <role rolename="role1"/>
-  <user username="tomcat" password="tomcat" roles="tomcat"/>
-  <user username="both" password="tomcat" roles="tomcat,role1"/>
-  <user username="role1" password="tomcat" roles="role1"/>
--->
-</tomcat-users>