diff options
author | Joakim Erdfelt | 2014-11-25 19:09:09 +0000 |
---|---|---|
committer | Joakim Erdfelt | 2014-11-25 19:09:21 +0000 |
commit | ed594425d32395c58c8a6c359a5fb67c781dce53 (patch) | |
tree | 83e01db51d8b862a16b639757d89291f33401bef /jetty-xml | |
parent | f853adb43c073bf4f569dde6af026d990c89407d (diff) | |
parent | 07647e8a5f01ad3bc8adc368c5a4d4e1499e293d (diff) | |
download | org.eclipse.jetty.project-ed594425d32395c58c8a6c359a5fb67c781dce53.tar.gz org.eclipse.jetty.project-ed594425d32395c58c8a6c359a5fb67c781dce53.tar.xz org.eclipse.jetty.project-ed594425d32395c58c8a6c359a5fb67c781dce53.zip |
Merge branch 'jetty-9.2.x'
Conflicts:
jetty-server/src/main/config/etc/jetty.xml
jetty-server/src/main/config/modules/server.mod
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java
jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java
Diffstat (limited to 'jetty-xml')
-rw-r--r-- | jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index d4bb45d056..8dec310204 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; public class XmlConfigurationTest @@ -646,4 +647,136 @@ public class XmlConfigurationTest Assert.assertEquals("nested second parameter not wired correctly","arg2", atc.getNested().getSecond()); Assert.assertEquals("nested third parameter not wired correctly","arg3", atc.getNested().getThird()); } + + public static class NativeHolder + { + private boolean _boolean; + private int _integer; + private float _float; + + public boolean getBoolean() + { + return _boolean; + } + + public void setBoolean(boolean value) + { + this._boolean = value; + } + + public int getInteger() + { + return _integer; + } + + public void setInteger(int integer) + { + _integer = integer; + } + + public float getFloat() + { + return _float; + } + + public void setFloat(float f) + { + _float = f; + } + + } + + @Test + public void testSetBooleanTrue() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"boolean\">true</Set>" + + "</Configure>"); + + NativeHolder bh = (NativeHolder)xmlConfiguration.configure(); + Assert.assertTrue(bh.getBoolean()); + } + + @Test + public void testSetBooleanFalse() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"boolean\">false</Set>" + + "</Configure>"); + + NativeHolder bh = (NativeHolder)xmlConfiguration.configure(); + Assert.assertFalse(bh.getBoolean()); + } + + @Test + @Ignore + public void testSetBadBoolean() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"boolean\">tru</Set>" + + "</Configure>"); + + NativeHolder bh = (NativeHolder)xmlConfiguration.configure(); + Assert.assertTrue(bh.getBoolean()); + } + + @Test + public void testSetBadInteger() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"integer\">bad</Set>" + + "</Configure>"); + + try + { + xmlConfiguration.configure(); + Assert.fail(); + } + catch (Exception e) + { + + } + } + + @Test + public void testSetBadExtraInteger() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"integer\">100 bas</Set>" + + "</Configure>"); + + try + { + xmlConfiguration.configure(); + Assert.fail(); + } + catch (Exception e) + { + + } + } + + @Test + public void testSetBadFloatInteger() throws Exception + { + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + "<Configure class=\"org.eclipse.jetty.xml.XmlConfigurationTest$NativeHolder\">" + + " <Set name=\"integer\">1.5</Set>" + + "</Configure>"); + + try + { + xmlConfiguration.configure(); + Assert.fail(); + } + catch (Exception e) + { + + } + } } |