Merge remote-tracking branch 'origin/jetty-9.4.x'

This commit is contained in:
Jan Bartel 2016-08-05 18:27:39 +10:00
commit d9669e7282
4 changed files with 42 additions and 3 deletions

View File

@ -52,7 +52,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
@Test
public void testOneConcurrentStream() throws Exception
{
long sleep = 1000;
long sleep = 2000;
start(1, new AbstractHandler()
{
@Override

View File

@ -268,7 +268,7 @@ public class ByteArrayEndPointTest
@Test
public void testIdle() throws Exception
{
long idleTimeout = 500;
long idleTimeout = 1500;
ByteArrayEndPoint endp = new ByteArrayEndPoint(_scheduler, idleTimeout);
endp.addInput("test");
endp.setGrowOutput(false);
@ -284,7 +284,7 @@ public class ByteArrayEndPointTest
FutureCallback fcb = new FutureCallback();
endp.fillInterested(fcb);
fcb.get(100,TimeUnit.MILLISECONDS);
fcb.get(idleTimeout,TimeUnit.MILLISECONDS);
assertTrue(fcb.isDone());
assertEquals(null, fcb.get());
assertEquals(4, endp.fill(buffer));

View File

@ -55,9 +55,18 @@ public abstract class NamingEntry
}
/**
* Create a naming entry.
*
* @param scope an object representing the scope of the name to be bound into jndi, where null means jvm scope.
* @param jndiName the name that will be associated with an object bound into jndi
* @throws NamingException
*/
protected NamingEntry (Object scope, String jndiName)
throws NamingException
{
if (jndiName == null)
throw new NamingException("jndi name is null");
this._scope=scope;
this._jndiName = jndiName;
}

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Hashtable;
@ -238,6 +239,35 @@ public class TestNamingEntries
testLink();
}
@Test
public void testNullJndiName () throws Exception
{
try
{
InitialContext icontext = new InitialContext();
Resource resource = new Resource (null,"foo");
fail ("Null jndi name should not be permitted");
}
catch (NamingException e)
{
//expected
}
}
@Test
public void testNullObject () throws Exception
{
InitialContext icontext = new InitialContext();
Resource resource = new Resource ("foo/bar", null);
NamingEntry ne = NamingEntryUtil.lookupNamingEntry(null, "foo/bar");
assertNotNull(ne);
Object o = icontext.lookup("foo/bar");
assertNull(o);
}
@Test
public void testLink () throws Exception
{