Преглед изворни кода

update xml factory testcase

jrivard@gmail.com пре 6 година
родитељ
комит
9e65a00db2

+ 4 - 0
build/checkstyle-header.xml

@@ -31,6 +31,10 @@
 
 <module name="Checker">
 
+    <module name="SuppressionFilter">
+        <property name="file" value="${basedir}/build/checkstyle-suppression.xml" />
+    </module>
+
     <module name="Header">
         <property name="headerFile" value="${basedir}/build/license-header-jsp.txt"/>
         <property name="fileExtensions" value="jsp"/>

+ 28 - 0
build/checkstyle-suppression.xml

@@ -0,0 +1,28 @@
+<!--
+  ~ Password Management Servlets (PWM)
+  ~ http://www.pwm-project.org
+  ~
+  ~ Copyright (c) 2006-2009 Novell, Inc.
+  ~ Copyright (c) 2009-2016 The PWM Project
+  ~
+  ~ This program is free software; you can redistribute it and/or modify
+  ~ it under the terms of the GNU General Public License as published by
+  ~ the Free Software Foundation; either version 2 of the License, or
+  ~ (at your option) any later version.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  ~ GNU General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  -->
+<!DOCTYPE suppressions PUBLIC
+        "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+        "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+    <suppress files="XmlFactoryTest\.xml" checks="[a-zA-Z0-9]*"/>
+</suppressions>

+ 3 - 0
build/checkstyle.xml

@@ -31,6 +31,9 @@
 
 <module name="Checker">
 
+    <module name="SuppressionFilter">
+        <property name="file" value="${basedir}/build/checkstyle-suppression.xml" />
+    </module>
 
     <!-- Checks that each Java package has a Javadoc file used for commenting. -->
     <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage       -->

+ 15 - 3
server/src/test/java/password/pwm/util/XmlElementTest.java → server/src/test/java/password/pwm/util/java/XmlFactoryTest.java

@@ -20,15 +20,27 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-package password.pwm.util;
+package password.pwm.util.java;
 
+import org.junit.Assert;
 import org.junit.Test;
+import password.pwm.error.PwmUnrecoverableException;
 
-public class XmlElementTest
+import java.io.InputStream;
+import java.util.List;
+
+public class XmlFactoryTest
 {
     @Test
     public void testLoadXml()
+            throws PwmUnrecoverableException
     {
-
+        final InputStream xmlFactoryTestXmlFile = this.getClass().getResourceAsStream( "XmlFactoryTest.xml" );
+        final XmlDocument xmlDocument = XmlFactory.getFactory().parseXml( xmlFactoryTestXmlFile );
+        Assert.assertEquals( "PwmConfiguration", xmlDocument.getRootElement().getName() );
+        final XmlElement configIsEditable = xmlDocument.evaluateXpathToElement( "//property[@key='configIsEditable']" );
+        Assert.assertEquals( "false", configIsEditable.getText() );
+        final List<XmlElement> allSettings = xmlDocument.evaluateXpathToElements( "//setting" );
+        Assert.assertEquals( 280, allSettings.size() );
     }
 }

Разлика између датотеке није приказан због своје велике величине
+ 84 - 0
server/src/test/resources/password/pwm/util/java/XmlFactoryTest.xml


Неке датотеке нису приказане због велике количине промена