コード例 #1
0
 @Test
 public void shouldNotRequireExplicitPort() throws Exception {
   ResourceAddress address =
       addressFactorySpi.newResourceAddress(URI.create("httpx+ssl://localhost/"));
   URI location = address.getResource();
   assertEquals(location.getPort(), 443);
 }
コード例 #2
0
 @Test
 public void shouldCreateAddressWithOptions() {
   ResourceAddress address = addressFactorySpi.newResourceAddress(addressURI, options);
   assertEquals("custom", address.getOption(NEXT_PROTOCOL));
   assertEquals("random", address.getOption(QUALIFIER));
   assertNull(address.getOption(TRANSPORT));
   assertEquals(5000L, address.getOption(KEEP_ALIVE_TIMEOUT).longValue());
   assertEquals("demo", address.getOption(REALM_NAME));
   assertArrayEquals(new String[] {"admin"}, address.getOption(REQUIRED_ROLES));
 }
コード例 #3
0
 @Test
 public void shouldCreateAddressWithDefaultOptions() throws Exception {
   ResourceAddress address = addressFactorySpi.newResourceAddress(addressURI);
   assertNull(address.getOption(NEXT_PROTOCOL));
   assertNull(address.getOption(QUALIFIER));
   assertNull(address.getOption(TRANSPORT));
   assertEquals(address.getOption(KEEP_ALIVE_TIMEOUT).intValue(), 30);
   assertNull(address.getOption(REALM_NAME));
   assertEmpty(address.getOption(REQUIRED_ROLES));
 }
コード例 #4
0
 @Test(expected = IllegalArgumentException.class)
 public void shouldRequireExplicitPath() throws Exception {
   addressFactorySpi.newResourceAddress(URI.create("httpx+ssl://localhost:443"));
 }
コード例 #5
0
 @Test(expected = IllegalArgumentException.class)
 public void shouldRequireHttpxSslSchemeName() throws Exception {
   addressFactorySpi.newResourceAddress(URI.create("test://opaque"));
 }
コード例 #6
0
 @Test
 public void shouldHaveHttpxSslSchemeName() throws Exception {
   assertEquals("httpx+ssl", addressFactorySpi.getSchemeName());
 }
コード例 #7
0
 @Test
 public void shouldCreateAddressWithTransport() throws Exception {
   ResourceAddress address = addressFactorySpi.newResourceAddress(addressURI, options);
   assertNotNull(address.getOption(TRANSPORT_URI));
   assertEquals(URI.create("wsn+ssl://localhost:2121/"), address.getOption(TRANSPORT_URI));
 }