ZEST-175 Only run HTTP library vhost tests on Java < 9
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/8fd9d5ac Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/8fd9d5ac Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/8fd9d5ac Branch: refs/heads/develop Commit: 8fd9d5ac0e300926003e5cd27d863d6045758f91 Parents: 954f5a4 Author: Paul Merlin <[email protected]> Authored: Sun Sep 4 18:45:36 2016 -0700 Committer: Paul Merlin <[email protected]> Committed: Sun Sep 4 18:45:36 2016 -0700 ---------------------------------------------------------------------- libraries/http/build.gradle | 37 +++++- .../zest/library/http/JettyTestSuite.java | 1 - .../http/VirtualHostJettyServiceTest.java | 88 ------------- .../zest/library/http/dns/LocalManagedDns.java | 125 ------------------- .../http/dns/LocalManagedDnsDescriptor.java | 48 ------- ...un.net.spi.nameservice.NameServiceDescriptor | 36 ------ .../http/VirtualHostJettyServiceTest.java | 90 +++++++++++++ .../zest/library/http/dns/LocalManagedDns.java | 125 +++++++++++++++++++ .../http/dns/LocalManagedDnsDescriptor.java | 48 +++++++ ...un.net.spi.nameservice.NameServiceDescriptor | 17 +++ .../http/src/vhost-test/resources/logback.xml | 37 ++++++ 11 files changed, 348 insertions(+), 304 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/http/build.gradle b/libraries/http/build.gradle index d7e3cdc..c049c65 100644 --- a/libraries/http/build.gradle +++ b/libraries/http/build.gradle @@ -22,11 +22,6 @@ description = "Apache Zest⢠Http Library provides embedded Jetty for Apache Ze jar { manifest { name = "Apache Zest⢠Library - Http" }} -test { - systemProperties 'networkaddress.cache.ttl': '0' - systemProperties 'sun.net.spi.nameservice.provider.1': 'dns,LocalManagedDns' -} - dependencies { compile( project( ":org.apache.zest.core:org.apache.zest.core.api" ) ) @@ -38,9 +33,39 @@ dependencies { testCompile( project( ":org.apache.zest.core:org.apache.zest.core.testsupport" ) ) testCompile( libraries.http_client ) - testCompile( libraries.dnsjava ) testRuntime( project( ":org.apache.zest.core:org.apache.zest.core.runtime" ) ) testRuntime( libraries.logback ) } + +// Do not run vhost tests on Java >= 9 because they use internal JDK apis +if(JavaVersion.current() < JavaVersion.VERSION_1_9) { + sourceSets { + vhostTest { + java { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/vhost-test/java') + } + resources { + srcDir file('src/vhost-test/resources') + } + } + } + configurations { + vhostTestCompile.extendsFrom testCompile + vhostTestRuntime.extendsFrom testRuntime + } + dependencies { + vhostTestCompile( libraries.dnsjava ) + } + task vhostTest(type: Test) { + testClassesDir = sourceSets.vhostTest.output.classesDir + classpath = sourceSets.vhostTest.runtimeClasspath + systemProperties 'networkaddress.cache.ttl': '0' + systemProperties 'sun.net.spi.nameservice.provider.1': 'dns,LocalManagedDns' + } + check.dependsOn vhostTest + vhostTest.mustRunAfter test +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/test/java/org/apache/zest/library/http/JettyTestSuite.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/test/java/org/apache/zest/library/http/JettyTestSuite.java b/libraries/http/src/test/java/org/apache/zest/library/http/JettyTestSuite.java index e96e402..5d59563 100644 --- a/libraries/http/src/test/java/org/apache/zest/library/http/JettyTestSuite.java +++ b/libraries/http/src/test/java/org/apache/zest/library/http/JettyTestSuite.java @@ -24,7 +24,6 @@ import org.junit.runners.Suite; @RunWith( Suite.class ) @Suite.SuiteClasses( { - VirtualHostJettyServiceTest.class, JettyServiceTest.class, JettyJMXStatisticsTest.class, SecureJettyServiceTest.class, http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java b/libraries/http/src/test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java deleted file mode 100644 index 87b869d..0000000 --- a/libraries/http/src/test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.library.http; - -import java.io.IOException; -import org.apache.http.client.methods.HttpGet; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.apache.zest.api.common.Visibility; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.library.http.dns.LocalManagedDns; -import org.apache.zest.test.EntityTestAssembler; - -import static org.junit.Assert.assertEquals; -import static org.apache.zest.library.http.Servlets.addServlets; -import static org.apache.zest.library.http.Servlets.serve; -import static org.apache.zest.test.util.Assume.assumeNoIbmJdk; - -public class VirtualHostJettyServiceTest - extends AbstractJettyTest -{ - private static final String HOST1 = "host1.http.library.zest"; - private static final String HOST2 = "host2.http.library.zest"; - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - ModuleAssembly configModule = module; - new EntityTestAssembler().assemble( configModule ); - new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); - - SecureJettyConfiguration config = configModule.forMixin( SecureJettyConfiguration.class ).declareDefaults(); - config.hostName().set( "127.0.0.1" ); - config.port().set( HTTP_PORT ); - config.virtualHosts().set( HOST1 + "," + HOST2 ); - - addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module ); - } - - @BeforeClass - public static void beforeVirtualHostsClass() - { - assumeNoIbmJdk(); - LocalManagedDns.putName( HOST1, "127.0.0.1" ); - LocalManagedDns.putName( HOST2, "127.0.0.1" ); - } - - @AfterClass - public static void afterVirtualHostsClass() - { - LocalManagedDns.removeName( HOST1 ); - LocalManagedDns.removeName( HOST2 ); - } - - @Test - public void test() - throws IOException - { - // Available on HOST1 and HOST2 - String output = defaultHttpClient.execute( new HttpGet( "http://" + HOST1 + ":8041/hello" ), - stringResponseHandler ); - assertEquals( "Hello World", output ); - - output = defaultHttpClient.execute( new HttpGet( "http://" + HOST2 + ":8041/hello" ), - stringResponseHandler ); - assertEquals( "Hello World", output ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDns.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDns.java b/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDns.java deleted file mode 100644 index 68b208d..0000000 --- a/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDns.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.library.http.dns; - -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import org.xbill.DNS.spi.DNSJavaNameServiceDescriptor; -import sun.net.spi.nameservice.NameService; - -public class LocalManagedDns - implements NameService -{ - - private static final NameService DEFAULT_DNS = new DNSJavaNameServiceDescriptor().createNameService(); - private static final Map<String, String> NAMES = new ConcurrentHashMap<String, String>(); - - public static void clearNames() - { - NAMES.clear(); - } - - public static String putName( String name, String ip ) - { - return NAMES.put( name, ip ); - } - - public static String removeName( String name ) - { - return NAMES.remove( name ); - } - - public String getHostByAddr( byte[] bytes ) - throws UnknownHostException - { - return DEFAULT_DNS.getHostByAddr( bytes ); - } - - public InetAddress[] lookupAllHostAddr( String name ) - throws UnknownHostException - { - String log = "[CDNS] Lookup request"; - String ip = NAMES.get( name ); - InetAddress[] result = new InetAddress[ 0 ]; - if ( ip != null && ip.length() > 0 ) { - log += " on managed name (" + name + ")"; - byte[] ipBytes = ipStringToBytes( ip ); - result = new InetAddress[]{ Inet4Address.getByAddress( ipBytes ) }; - } else { - log += " on non-managed name (" + name + ")"; - result = DEFAULT_DNS.lookupAllHostAddr( name ); - } - return result; - } - - private static byte[] ipStringToBytes( String ipString ) - { - if ( ipString == null || ipString.length() == 0 ) { - return null; - } - - int inetAddrSize = 4; - int octets; - char ch; - byte[] dst = new byte[ inetAddrSize ]; - char[] srcb = ipString.toCharArray(); - boolean saw_digit = false; - - octets = 0; - int i = 0; - int cur = 0; - while ( i < srcb.length ) { - ch = srcb[i++]; - if ( Character.isDigit( ch ) ) { - int sum = dst[cur] * 10 + ( Character.digit( ch, 10 ) & 0xff ); - - if ( sum > 255 ) { - return null; - } - - dst[cur] = ( byte ) ( sum & 0xff ); - if ( !saw_digit ) { - if ( ++octets > inetAddrSize ) { - return null; - } - saw_digit = true; - } - } else if ( ch == '.' && saw_digit ) { - if ( octets == inetAddrSize ) { - return null; - } - cur++; - dst[cur] = 0; - saw_digit = false; - } else { - return null; - } - } - - if ( octets < inetAddrSize ) { - return null; - } - return dst; - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java b/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java deleted file mode 100644 index a2ae722..0000000 --- a/libraries/http/src/test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.library.http.dns; - -import sun.net.spi.nameservice.NameService; -import sun.net.spi.nameservice.NameServiceDescriptor; - -public class LocalManagedDnsDescriptor - implements NameServiceDescriptor -{ - - public static final String PROVIDER_NAME = "LocalManagedDns"; - private static final NameService nameService = new LocalManagedDns(); - - public NameService createNameService() - throws Exception - { - return nameService; - } - - public String getProviderName() - { - return PROVIDER_NAME; - } - - public String getType() - { - return "dns"; - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor ---------------------------------------------------------------------- diff --git a/libraries/http/src/test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor b/libraries/http/src/test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor deleted file mode 100644 index a8a8434..0000000 --- a/libraries/http/src/test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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. -# -# -# - -# 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. - -org.apache.zest.library.http.dns.LocalManagedDnsDescriptor \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java new file mode 100644 index 0000000..1bf526c --- /dev/null +++ b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java @@ -0,0 +1,90 @@ +/* + * 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. + * + * + */ +package org.apache.zest.library.http; + +import java.io.IOException; +import org.apache.http.client.methods.HttpGet; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.library.http.dns.LocalManagedDns; +import org.apache.zest.test.EntityTestAssembler; + +import static org.junit.Assert.assertEquals; +import static org.apache.zest.library.http.Servlets.addServlets; +import static org.apache.zest.library.http.Servlets.serve; +import static org.apache.zest.test.util.Assume.assumeNoIbmJdk; + +// TODO Compilation fails with Java 9 +// TODO Move this to a separate source set that's enabled only when Java < 9 +public class VirtualHostJettyServiceTest + extends AbstractJettyTest +{ + private static final String HOST1 = "host1.http.library.zest"; + private static final String HOST2 = "host2.http.library.zest"; + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + ModuleAssembly configModule = module; + new EntityTestAssembler().assemble( configModule ); + new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); + + SecureJettyConfiguration config = configModule.forMixin( SecureJettyConfiguration.class ).declareDefaults(); + config.hostName().set( "127.0.0.1" ); + config.port().set( HTTP_PORT ); + config.virtualHosts().set( HOST1 + "," + HOST2 ); + + addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module ); + } + + @BeforeClass + public static void beforeVirtualHostsClass() + { + assumeNoIbmJdk(); + LocalManagedDns.putName( HOST1, "127.0.0.1" ); + LocalManagedDns.putName( HOST2, "127.0.0.1" ); + } + + @AfterClass + public static void afterVirtualHostsClass() + { + LocalManagedDns.removeName( HOST1 ); + LocalManagedDns.removeName( HOST2 ); + } + + @Test + public void test() + throws IOException + { + // Available on HOST1 and HOST2 + String output = defaultHttpClient.execute( new HttpGet( "http://" + HOST1 + ":8041/hello" ), + stringResponseHandler ); + assertEquals( "Hello World", output ); + + output = defaultHttpClient.execute( new HttpGet( "http://" + HOST2 + ":8041/hello" ), + stringResponseHandler ); + assertEquals( "Hello World", output ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java new file mode 100644 index 0000000..68b208d --- /dev/null +++ b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java @@ -0,0 +1,125 @@ +/* + * 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. + * + * + */ +package org.apache.zest.library.http.dns; + +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.xbill.DNS.spi.DNSJavaNameServiceDescriptor; +import sun.net.spi.nameservice.NameService; + +public class LocalManagedDns + implements NameService +{ + + private static final NameService DEFAULT_DNS = new DNSJavaNameServiceDescriptor().createNameService(); + private static final Map<String, String> NAMES = new ConcurrentHashMap<String, String>(); + + public static void clearNames() + { + NAMES.clear(); + } + + public static String putName( String name, String ip ) + { + return NAMES.put( name, ip ); + } + + public static String removeName( String name ) + { + return NAMES.remove( name ); + } + + public String getHostByAddr( byte[] bytes ) + throws UnknownHostException + { + return DEFAULT_DNS.getHostByAddr( bytes ); + } + + public InetAddress[] lookupAllHostAddr( String name ) + throws UnknownHostException + { + String log = "[CDNS] Lookup request"; + String ip = NAMES.get( name ); + InetAddress[] result = new InetAddress[ 0 ]; + if ( ip != null && ip.length() > 0 ) { + log += " on managed name (" + name + ")"; + byte[] ipBytes = ipStringToBytes( ip ); + result = new InetAddress[]{ Inet4Address.getByAddress( ipBytes ) }; + } else { + log += " on non-managed name (" + name + ")"; + result = DEFAULT_DNS.lookupAllHostAddr( name ); + } + return result; + } + + private static byte[] ipStringToBytes( String ipString ) + { + if ( ipString == null || ipString.length() == 0 ) { + return null; + } + + int inetAddrSize = 4; + int octets; + char ch; + byte[] dst = new byte[ inetAddrSize ]; + char[] srcb = ipString.toCharArray(); + boolean saw_digit = false; + + octets = 0; + int i = 0; + int cur = 0; + while ( i < srcb.length ) { + ch = srcb[i++]; + if ( Character.isDigit( ch ) ) { + int sum = dst[cur] * 10 + ( Character.digit( ch, 10 ) & 0xff ); + + if ( sum > 255 ) { + return null; + } + + dst[cur] = ( byte ) ( sum & 0xff ); + if ( !saw_digit ) { + if ( ++octets > inetAddrSize ) { + return null; + } + saw_digit = true; + } + } else if ( ch == '.' && saw_digit ) { + if ( octets == inetAddrSize ) { + return null; + } + cur++; + dst[cur] = 0; + saw_digit = false; + } else { + return null; + } + } + + if ( octets < inetAddrSize ) { + return null; + } + return dst; + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java ---------------------------------------------------------------------- diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java new file mode 100644 index 0000000..a2ae722 --- /dev/null +++ b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java @@ -0,0 +1,48 @@ +/* + * 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. + * + * + */ +package org.apache.zest.library.http.dns; + +import sun.net.spi.nameservice.NameService; +import sun.net.spi.nameservice.NameServiceDescriptor; + +public class LocalManagedDnsDescriptor + implements NameServiceDescriptor +{ + + public static final String PROVIDER_NAME = "LocalManagedDns"; + private static final NameService nameService = new LocalManagedDns(); + + public NameService createNameService() + throws Exception + { + return nameService; + } + + public String getProviderName() + { + return PROVIDER_NAME; + } + + public String getType() + { + return "dns"; + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor ---------------------------------------------------------------------- diff --git a/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor b/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor new file mode 100644 index 0000000..723c58d --- /dev/null +++ b/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor @@ -0,0 +1,17 @@ +# 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. + +org.apache.zest.library.http.dns.LocalManagedDnsDescriptor http://git-wip-us.apache.org/repos/asf/zest-java/blob/8fd9d5ac/libraries/http/src/vhost-test/resources/logback.xml ---------------------------------------------------------------------- diff --git a/libraries/http/src/vhost-test/resources/logback.xml b/libraries/http/src/vhost-test/resources/logback.xml new file mode 100644 index 0000000..c390645 --- /dev/null +++ b/libraries/http/src/vhost-test/resources/logback.xml @@ -0,0 +1,37 @@ +<?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. + ~ + ~ + --> +<configuration> + + <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>[ZEST] @%-20thread %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <root level="info"> + <appender-ref ref="stdout" /> + </root> + + <logger name="org.apache.zest.library.http" level="trace"/> + <logger name="org.eclipse.jetty" level="info"/> + <logger name="org.jetty" level="info"/> + +</configuration>
