http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java index fde41f1..bb13966 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.rest.internal.web.controllers; @@ -116,7 +114,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { } private File findTrustedJKSWithSingleEntry() { - return new File(TestUtil.getResourcePath(RestAPIsWithSSLDUnitTest.class, "/ssl/trusted.keystore")); + return new File( + TestUtil.getResourcePath(RestAPIsWithSSLDUnitTest.class, "/ssl/trusted.keystore")); } private File findTrustStoreJKSForPath(Properties props) { @@ -139,12 +138,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { } @SuppressWarnings("deprecation") - protected int startBridgeServer(String hostName, - int restServicePort, - final String locators, - final String[] regions, - final Properties sslProperties, - boolean clusterLevel) { + protected int startBridgeServer(String hostName, int restServicePort, final String locators, + final String[] regions, final Properties sslProperties, boolean clusterLevel) { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); @@ -189,7 +184,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { region.put("2", new Person(102L, "Sachin", "Ramesh", "Tendulkar", new Date(), Gender.MALE)); region.put("3", new Person(103L, "Saurabh", "Baburav", "Ganguly", new Date(), Gender.MALE)); region.put("4", new Person(104L, "Rahul", "subrymanyam", "Dravid", new Date(), Gender.MALE)); - region.put("5", new Person(105L, "Jhulan", "Chidambaram", "Goswami", new Date(), Gender.FEMALE)); + region.put("5", + new Person(105L, "Jhulan", "Chidambaram", "Goswami", new Date(), Gender.FEMALE)); Map<String, Object> userMap = new HashMap<String, Object>(); userMap.put("6", new Person(101L, "Rahul", "Rajiv", "Gndhi", new Date(), Gender.MALE)); @@ -198,7 +194,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { userMap.put("9", new Person(104L, "Soniya", "Rajiv", "Gandhi", new Date(), Gender.FEMALE)); userMap.put("10", new Person(104L, "Priyanka", "Robert", "Gandhi", new Date(), Gender.FEMALE)); userMap.put("11", new Person(104L, "Murali", "Manohar", "Joshi", new Date(), Gender.MALE)); - userMap.put("12", new Person(104L, "Lalkrishna", "Parmhansh", "Advani", new Date(), Gender.MALE)); + userMap.put("12", + new Person(104L, "Lalkrishna", "Parmhansh", "Advani", new Date(), Gender.MALE)); userMap.put("13", new Person(104L, "Shushma", "kumari", "Swaraj", new Date(), Gender.FEMALE)); userMap.put("14", new Person(104L, "Arun", "raman", "jetly", new Date(), Gender.MALE)); userMap.put("15", new Person(104L, "Amit", "kumar", "shah", new Date(), Gender.MALE)); @@ -210,7 +207,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { } - private String startInfraWithSSL(final Properties sslProperties, boolean clusterLevel) throws Exception { + private String startInfraWithSSL(final Properties sslProperties, boolean clusterLevel) + throws Exception { final Host host = Host.getHost(0); VM locator = host.getVM(0); @@ -230,19 +228,22 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { String locators = locatorHostName + "[" + locatorPort + "]"; // start manager (peer cache) - manager.invoke("StartManager", () -> startManager(locators, new String[] { REGION_NAME }, sslProperties)); + manager.invoke("StartManager", + () -> startManager(locators, new String[] {REGION_NAME}, sslProperties)); // start startBridgeServer With RestService enabled String restEndpoint = server.invoke("startBridgeServerWithRestServiceOnInVM", () -> { final String hostName = server.getHost().getHostName(); final int restServicePort = AvailablePortHelper.getRandomAvailableTCPPort(); - startBridgeServer(hostName, restServicePort, locators, new String[] { REGION_NAME }, sslProperties, clusterLevel); + startBridgeServer(hostName, restServicePort, locators, new String[] {REGION_NAME}, + sslProperties, clusterLevel); return "https://" + hostName + ":" + restServicePort + urlContext + "/v1"; }); // create a client cache client.invoke("Create ClientCache", () -> { - new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(locatorHostName, locatorPort).create(); + new ClientCacheFactory().setPdxReadSerialized(true) + .addPoolLocator(locatorHostName, locatorPort).create(); return null; }); @@ -282,10 +283,12 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { } } - private void sslPropertyConverter(Properties properties, Properties newProperties, String propertyName, String newPropertyName) { + private void sslPropertyConverter(Properties properties, Properties newProperties, + String propertyName, String newPropertyName) { String property = properties.getProperty(propertyName); if (property != null) { - newProperties.setProperty((newPropertyName != null ? newPropertyName : propertyName), property); + newProperties.setProperty((newPropertyName != null ? newPropertyName : propertyName), + property); } } @@ -293,17 +296,23 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { * @Deprecated once the legacy SSL properties have been removed we need to remove this logic. */ @Deprecated() - private Properties configureSSL(Properties props, Properties sslProperties, boolean clusterLevel) { + private Properties configureSSL(Properties props, Properties sslProperties, + boolean clusterLevel) { if (clusterLevel) { sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_ENABLED, CLUSTER_SSL_ENABLED); sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE, CLUSTER_SSL_KEYSTORE); - sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, CLUSTER_SSL_KEYSTORE_PASSWORD); - sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE_TYPE, CLUSTER_SSL_KEYSTORE_TYPE); + sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, + CLUSTER_SSL_KEYSTORE_PASSWORD); + sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE_TYPE, + CLUSTER_SSL_KEYSTORE_TYPE); sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_PROTOCOLS, CLUSTER_SSL_PROTOCOLS); - sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, CLUSTER_SSL_REQUIRE_AUTHENTICATION); - sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_TRUSTSTORE, CLUSTER_SSL_TRUSTSTORE); - sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, CLUSTER_SSL_TRUSTSTORE_PASSWORD); + sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, + CLUSTER_SSL_REQUIRE_AUTHENTICATION); + sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_TRUSTSTORE, + CLUSTER_SSL_TRUSTSTORE); + sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, + CLUSTER_SSL_TRUSTSTORE_PASSWORD); } else { sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_ENABLED, null); sslPropertyConverter(sslProperties, props, HTTP_SERVICE_SSL_KEYSTORE, null); @@ -331,7 +340,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { return props; } - private int startManager(final String locators, final String[] regions, final Properties sslProperties) throws IOException { + private int startManager(final String locators, final String[] regions, + final Properties sslProperties) throws IOException { IgnoredException.addIgnoredException("java.net.BindException"); IgnoredException.addIgnoredException("java.rmi.server.ExportException"); @@ -348,13 +358,16 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { while (true) { try { DistributedSystem ds = getSystem(props); - System.out.println("Creating cache with http-service-port " + props.getProperty(HTTP_SERVICE_PORT, "7070") + " and jmx-manager-port " + props.getProperty(JMX_MANAGER_PORT, "1099")); + System.out.println( + "Creating cache with http-service-port " + props.getProperty(HTTP_SERVICE_PORT, "7070") + + " and jmx-manager-port " + props.getProperty(JMX_MANAGER_PORT, "1099")); cache = CacheFactory.create(ds); System.out.println("Successfully created cache."); break; } catch (ManagementException ex) { - if ((ex.getCause() instanceof BindException) || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) { - //close cache and disconnect + if ((ex.getCause() instanceof BindException) + || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) { + // close cache and disconnect GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance(); if (existingInstance != null) { existingInstance.close(); @@ -363,7 +376,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { if (ids != null) { ids.disconnect(); } - //try a different port + // try a different port int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort(); int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort(); props.setProperty(HTTP_SERVICE_PORT, Integer.toString(httpServicePort)); @@ -399,7 +412,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { private void createRegionInCache() { Cache cache = GemFireCacheImpl.getInstance(); assertNotNull(cache); - RegionFactory<String, Object> regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE); + RegionFactory<String, Object> regionFactory = + cache.createRegionFactory(RegionShortcut.REPLICATE); regionFactory.create(PEOPLE_REGION_NAME); } @@ -415,21 +429,24 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { // this is needed SSLContextBuilder custom = SSLContexts.custom(); - SSLContextBuilder sslContextBuilder = custom.loadTrustMaterial(clientTrust, new TrustSelfSignedStrategy()); - SSLContext sslcontext = sslContextBuilder.loadKeyMaterial(clientKeys, "password".toCharArray(), (aliases, socket) -> { - if (aliases.size() == 1) { - return aliases.keySet().stream().findFirst().get(); - } - if (!StringUtils.isEmpty(properties.getProperty(INVALID_CLIENT_ALIAS))) { - return properties.getProperty(INVALID_CLIENT_ALIAS); - } else { - return properties.getProperty(SSL_WEB_ALIAS); - } - }).build(); + SSLContextBuilder sslContextBuilder = + custom.loadTrustMaterial(clientTrust, new TrustSelfSignedStrategy()); + SSLContext sslcontext = sslContextBuilder + .loadKeyMaterial(clientKeys, "password".toCharArray(), (aliases, socket) -> { + if (aliases.size() == 1) { + return aliases.keySet().stream().findFirst().get(); + } + if (!StringUtils.isEmpty(properties.getProperty(INVALID_CLIENT_ALIAS))) { + return properties.getProperty(INVALID_CLIENT_ALIAS); + } else { + return properties.getProperty(SSL_WEB_ALIAS); + } + }).build(); // Host checking is disabled here , as tests might run on multiple hosts and // host entries can not be assumed - SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory( + sslcontext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build(); } @@ -490,8 +507,10 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSimpleSSLWithMultiKey_KeyStore() throws Exception { Properties props = new Properties(); - props.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks")); - props.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks")); + props.setProperty(SSL_KEYSTORE, + TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks")); + props.setProperty(SSL_TRUSTSTORE, + TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks")); props.setProperty(SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(SSL_TRUSTSTORE_PASSWORD, "password"); props.setProperty(SSL_KEYSTORE_TYPE, "JKS"); @@ -506,8 +525,10 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSimpleSSLWithMultiKey_KeyStore_WithInvalidClientKey() throws Exception { Properties props = new Properties(); - props.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks")); - props.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks")); + props.setProperty(SSL_KEYSTORE, + TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks")); + props.setProperty(SSL_TRUSTSTORE, + TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks")); props.setProperty(SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(SSL_TRUSTSTORE_PASSWORD, "password"); props.setProperty(SSL_KEYSTORE_TYPE, "JKS"); @@ -675,7 +696,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE, "JKS"); String restEndpoint = startInfraWithSSL(props, false); @@ -686,7 +708,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithoutKeyStoreTypeLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); String restEndpoint = startInfraWithSSL(props, false); @@ -697,7 +720,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithSSLProtocolLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL"); @@ -709,7 +733,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithTLSProtocolLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLS"); @@ -721,7 +746,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithTLSv11ProtocolLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.1"); @@ -733,7 +759,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithTLSv12ProtocolLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2"); @@ -745,7 +772,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testWithMultipleProtocolLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL,TLSv1.2"); @@ -758,7 +786,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { System.setProperty("javax.net.debug", "ssl"); Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2"); @@ -777,7 +806,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testSSLWithMultipleCipherSuiteLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2"); @@ -796,12 +826,14 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { public void testMutualAuthenticationLegacy() throws Exception { Properties props = new Properties(); props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true"); - props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password"); props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL"); props.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, "true"); - props.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, findTrustedJKSWithSingleEntry().getCanonicalPath()); + props.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, + findTrustedJKSWithSingleEntry().getCanonicalPath()); props.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, "password");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestTestUtils.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestTestUtils.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestTestUtils.java index 233a6e0..7a70dbe 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestTestUtils.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestTestUtils.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.rest.internal.web.controllers; @@ -38,14 +36,14 @@ import org.springframework.web.util.UriComponentsBuilder; * @see org.springframework.data.gemfire.GemfireTemplate * @since GemFire 8.0 */ -public class RestTestUtils { +public class RestTestUtils { public static final String BASE_URL = "http://localhost:8080"; public static final String GEMFIRE_REST_API_CONTEXT = "/gemfire-api"; public static final String GEMFIRE_REST_API_VERSION = "/v1"; - public static final URI GEMFIRE_REST_API_WEB_SERVICE_URL = URI - .create(BASE_URL + GEMFIRE_REST_API_CONTEXT + GEMFIRE_REST_API_VERSION); + public static final URI GEMFIRE_REST_API_WEB_SERVICE_URL = + URI.create(BASE_URL + GEMFIRE_REST_API_CONTEXT + GEMFIRE_REST_API_VERSION); private static RestTemplate restTemplate; @@ -53,57 +51,57 @@ public class RestTestUtils { if (restTemplate == null) { restTemplate = new RestTemplate(); - final List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); + final List<HttpMessageConverter<?>> messageConverters = + new ArrayList<HttpMessageConverter<?>>(); messageConverters.add(new ByteArrayHttpMessageConverter()); messageConverters.add(new ResourceHttpMessageConverter()); messageConverters.add(new StringHttpMessageConverter()); messageConverters.add(createMappingJackson2HttpMessageConverter()); - + restTemplate.setMessageConverters(messageConverters); } return restTemplate; } public static HttpMessageConverter<Object> createMappingJackson2HttpMessageConverter() { - final Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean(); + final Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = + new Jackson2ObjectMapperFactoryBean(); objectMapperFactoryBean.setFailOnEmptyBeans(true); objectMapperFactoryBean.setIndentOutput(true); objectMapperFactoryBean.setDateFormat(new SimpleDateFormat("MM/dd/yyyy")); - objectMapperFactoryBean - .setFeaturesToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapperFactoryBean - .setFeaturesToEnable( - com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_COMMENTS, - com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES, - com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + objectMapperFactoryBean.setFeaturesToDisable( + com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapperFactoryBean.setFeaturesToEnable( + com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_COMMENTS, + com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES, + com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); objectMapperFactoryBean.afterPropertiesSet(); - final MappingJackson2HttpMessageConverter httpMessageConverter = new MappingJackson2HttpMessageConverter(); + final MappingJackson2HttpMessageConverter httpMessageConverter = + new MappingJackson2HttpMessageConverter(); httpMessageConverter.setObjectMapper(objectMapperFactoryBean.getObject()); return httpMessageConverter; } - - /* - protected static HttpMessageConverter<Object> createMarshallingHttpMessageConverter() { - final Jaxb2Marshaller jaxbMarshaller = new Jaxb2Marshaller(); - jaxbMarshaller.setContextPaths("org.apache.geode.web.rest.domain", - "org.apache.geode.web.controllers.support"); - jaxbMarshaller.setMarshallerProperties(Collections.singletonMap( - "jaxb.formatted.output", Boolean.TRUE)); + /* + * protected static HttpMessageConverter<Object> createMarshallingHttpMessageConverter() { final + * Jaxb2Marshaller jaxbMarshaller = new Jaxb2Marshaller(); + * + * jaxbMarshaller.setContextPaths("org.apache.geode.web.rest.domain", + * "org.apache.geode.web.controllers.support"); + * jaxbMarshaller.setMarshallerProperties(Collections.singletonMap( "jaxb.formatted.output", + * Boolean.TRUE)); + * + * return new MarshallingHttpMessageConverter(jaxbMarshaller); } + */ - return new MarshallingHttpMessageConverter(jaxbMarshaller); - } - */ - public static URI toUri(final String... pathSegments) { return toUri(GEMFIRE_REST_API_WEB_SERVICE_URL, pathSegments); } public static URI toUri(final URI baseUrl, final String... pathSegments) { - return UriComponentsBuilder.fromUri(baseUrl).pathSegment(pathSegments) - .build().toUri(); + return UriComponentsBuilder.fromUri(baseUrl).pathSegment(pathSegments).build().toUri(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/main/java/org/apache/geode/annotations/Experimental.java ---------------------------------------------------------------------- diff --git a/geode-common/src/main/java/org/apache/geode/annotations/Experimental.java b/geode-common/src/main/java/org/apache/geode/annotations/Experimental.java index d628ea5..a0e3483 100755 --- a/geode-common/src/main/java/org/apache/geode/annotations/Experimental.java +++ b/geode-common/src/main/java/org/apache/geode/annotations/Experimental.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.annotations; @@ -23,34 +21,29 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Signifies that a public API (public class, method or field) is subject to - * incompatible changes, or even removal, in a future release. An API bearing - * this annotation is exempt from any compatibility guarantees made by its - * containing library. + * Signifies that a public API (public class, method or field) is subject to incompatible changes, + * or even removal, in a future release. An API bearing this annotation is exempt from any + * compatibility guarantees made by its containing library. * - * <p>Note that the presence of this annotation implies nothing - * about the quality or performance of the API in question, only the fact that - * it is not "API-frozen." + * <p> + * Note that the presence of this annotation implies nothing about the quality or performance of the + * API in question, only the fact that it is not "API-frozen." * - * <p>It is generally safe for <i>applications</i> to depend on beta APIs, at - * the cost of some extra work during upgrades. However, it is generally - * inadvisable for <i>libraries</i> (which get included on users' class paths, - * outside the library developers' control) to do so. + * <p> + * It is generally safe for <i>applications</i> to depend on beta APIs, at the cost of some extra + * work during upgrades. However, it is generally inadvisable for <i>libraries</i> (which get + * included on users' class paths, outside the library developers' control) to do so. * - * <p>Inspired by similar annotations in JGroups, Spark, DataflowJavaSDK. + * <p> + * Inspired by similar annotations in JGroups, Spark, DataflowJavaSDK. */ @Documented @Retention(RetentionPolicy.RUNTIME) -@Target({ - ElementType.ANNOTATION_TYPE, - ElementType.CONSTRUCTOR, - ElementType.FIELD, - ElementType.METHOD, - ElementType.PACKAGE, - ElementType.TYPE}) +@Target({ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD, + ElementType.METHOD, ElementType.PACKAGE, ElementType.TYPE}) public @interface Experimental { - + /** Optional description */ String value() default ""; - + } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/test/java/org/apache/geode/annotations/ExperimentalJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-common/src/test/java/org/apache/geode/annotations/ExperimentalJUnitTest.java b/geode-common/src/test/java/org/apache/geode/annotations/ExperimentalJUnitTest.java index 487106a..ea6008e 100755 --- a/geode-common/src/test/java/org/apache/geode/annotations/ExperimentalJUnitTest.java +++ b/geode-common/src/test/java/org/apache/geode/annotations/ExperimentalJUnitTest.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.annotations; @@ -28,17 +26,16 @@ import org.apache.geode.experimental.nonexperimentalpackage.ClassInNonExperiment import org.apache.geode.test.junit.categories.UnitTest; /** - * Unit tests for the <tt>Experimental</tt> annotation. Verifies that the - * annotation can be applied to Interfaces, Classes, Public and Protected - * Fields, Enums, Enum Constants, Public and Protected Methods, Packages, - * and Constructors. + * Unit tests for the <tt>Experimental</tt> annotation. Verifies that the annotation can be applied + * to Interfaces, Classes, Public and Protected Fields, Enums, Enum Constants, Public and Protected + * Methods, Packages, and Constructors. */ @Category(UnitTest.class) public class ExperimentalJUnitTest { private static final String FIELD_NAME = "field"; private static final String METHOD_NAME = "method"; - + @Test public void shouldIdentifyExperimentalInterface() throws Exception { assertThat(isExperimental(RegularInterface.class)).isFalse(); @@ -50,29 +47,32 @@ public class ExperimentalJUnitTest { assertThat(isExperimental(RegularClass.class)).isFalse(); assertThat(isExperimental(ExperimentalClass.class)).isTrue(); } - + @Test public void shouldIdentifyExperimentalPublicField() throws Exception { assertThat(isExperimental(RegularPublicField.class.getField(FIELD_NAME))).isFalse(); assertThat(isExperimental(ExperimentalPublicField.class.getField(FIELD_NAME))).isTrue(); } - + @Test public void shouldIdentifyExperimentalProtectedField() throws Exception { assertThat(isExperimental(RegularProtectedField.class.getDeclaredField(FIELD_NAME))).isFalse(); - assertThat(isExperimental(ExperimentalProtectedField.class.getDeclaredField(FIELD_NAME))).isTrue(); + assertThat(isExperimental(ExperimentalProtectedField.class.getDeclaredField(FIELD_NAME))) + .isTrue(); } - + @Test public void shouldIdentifyExperimentalEnum() throws Exception { assertThat(isExperimental(RegularEnum.class)).isFalse(); assertThat(isExperimental(ExperimentalEnum.class)).isTrue(); } - + @Test public void shouldIdentifyExperimentalEnumConstant() throws Exception { - assertThat(isExperimental(RegularEnumInstance.class.getField(RegularEnumInstance.THREE.name()))).isFalse(); - assertThat(isExperimental(ExperimentalEnumInstance.class.getField(ExperimentalEnumInstance.THREE.name()))).isTrue(); + assertThat(isExperimental(RegularEnumInstance.class.getField(RegularEnumInstance.THREE.name()))) + .isFalse(); + assertThat(isExperimental( + ExperimentalEnumInstance.class.getField(ExperimentalEnumInstance.THREE.name()))).isTrue(); } @Test @@ -83,8 +83,10 @@ public class ExperimentalJUnitTest { @Test public void shouldIdentifyExperimentalProtectedMethod() throws Exception { - assertThat(isExperimental(RegularProtectedMethod.class.getDeclaredMethod(METHOD_NAME))).isFalse(); - assertThat(isExperimental(ExperimentalProtectedMethod.class.getDeclaredMethod(METHOD_NAME))).isTrue(); + assertThat(isExperimental(RegularProtectedMethod.class.getDeclaredMethod(METHOD_NAME))) + .isFalse(); + assertThat(isExperimental(ExperimentalProtectedMethod.class.getDeclaredMethod(METHOD_NAME))) + .isTrue(); } @Test @@ -92,7 +94,7 @@ public class ExperimentalJUnitTest { assertThat(isExperimental(ClassInNonExperimentalPackage.class.getPackage())).isFalse(); assertThat(isExperimental(ClassInExperimentalPackage.class.getPackage())).isTrue(); } - + @Test public void shouldIdentifyExperimentalPublicConstructor() throws Exception { assertThat(isExperimental(RegularPublicConstructor.class.getConstructor())).isFalse(); @@ -108,7 +110,7 @@ public class ExperimentalJUnitTest { private static boolean isExperimental(final AnnotatedElement element) { return element.getAnnotation(Experimental.class) != null; } - + public static interface RegularInterface { } @Experimental("This is an experimental interface") @@ -128,7 +130,7 @@ public class ExperimentalJUnitTest { @Experimental("This is an experimental public field") public final boolean field = false; } - + public static class RegularProtectedField { protected final boolean field = false; } @@ -149,49 +151,39 @@ public class ExperimentalJUnitTest { ONE, TWO, THREE } public static enum ExperimentalEnumInstance { - ONE, - TWO, - @Experimental("This is an experimental enum constant") + ONE, TWO, @Experimental("This is an experimental enum constant") THREE } - + public static class RegularPublicMethod { - public void method() { - } + public void method() {} } public static class ExperimentalPublicMethod { @Experimental("This is an experimental public method") - public void method() { - } + public void method() {} } public static class RegularProtectedMethod { - public void method() { - } + public void method() {} } public static class ExperimentalProtectedMethod { @Experimental("This is an experimental protected method") - protected void method() { - } + protected void method() {} } - + public static class RegularPublicConstructor { - public RegularPublicConstructor() { - } + public RegularPublicConstructor() {} } public static class ExperimentalPublicConstructor { @Experimental("This is an experimental public constructor") - public ExperimentalPublicConstructor() { - } + public ExperimentalPublicConstructor() {} } public static class RegularProtectedConstructor { - public RegularProtectedConstructor() { - } + public RegularProtectedConstructor() {} } public static class ExperimentalProtectedConstructor { @Experimental("This is an experimental protected constructor") - public ExperimentalProtectedConstructor() { - } + public ExperimentalProtectedConstructor() {} } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/ClassInExperimentalPackage.java ---------------------------------------------------------------------- diff --git a/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/ClassInExperimentalPackage.java b/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/ClassInExperimentalPackage.java index 3b6e7d2..06bc035 100755 --- a/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/ClassInExperimentalPackage.java +++ b/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/ClassInExperimentalPackage.java @@ -1,24 +1,21 @@ /* - * 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 + * 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 + * 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. + * 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.geode.annotations.experimentalpackage; /** - * Used by <tt>ExperimentalJUnitTest</tt>. This is a class in an - * <tt>Experimental</tt> package. + * Used by <tt>ExperimentalJUnitTest</tt>. This is a class in an <tt>Experimental</tt> package. * * @see org.apache.geode.annotations.ExperimentalJUnitTest */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/package-info.java ---------------------------------------------------------------------- diff --git a/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/package-info.java b/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/package-info.java index 288e9aa..d668435 100755 --- a/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/package-info.java +++ b/geode-common/src/test/java/org/apache/geode/annotations/experimentalpackage/package-info.java @@ -1,22 +1,19 @@ /* - * 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 + * 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 + * 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. + * 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. */ /** - * Used by <tt>ExperimentalJUnitTest</tt>. This is an <tt>Experimental</tt> - * package. + * Used by <tt>ExperimentalJUnitTest</tt>. This is an <tt>Experimental</tt> package. * * @see org.apache.geode.annotations.ExperimentalJUnitTest */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/ClassInNonExperimentalPackage.java ---------------------------------------------------------------------- diff --git a/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/ClassInNonExperimentalPackage.java b/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/ClassInNonExperimentalPackage.java index 10f6072..126c6fe 100755 --- a/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/ClassInNonExperimentalPackage.java +++ b/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/ClassInNonExperimentalPackage.java @@ -1,24 +1,21 @@ /* - * 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 + * 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 + * 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. + * 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.geode.experimental.nonexperimentalpackage; /** - * Used by <tt>ExperimentalJUnitTest</tt>. This is a class in an - * <tt>Experimental</tt> package. + * Used by <tt>ExperimentalJUnitTest</tt>. This is a class in an <tt>Experimental</tt> package. * * @see org.apache.geode.annotations.ExperimentalJUnitTest */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/package-info.java ---------------------------------------------------------------------- diff --git a/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/package-info.java b/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/package-info.java index 20236a6..ba13c2c 100755 --- a/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/package-info.java +++ b/geode-common/src/test/java/org/apache/geode/experimental/nonexperimentalpackage/package-info.java @@ -1,22 +1,19 @@ /* - * 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 + * 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 + * 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. + * 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. */ /** - * Used by <tt>ExperimentalJUnitTest</tt>. This is a non-<tt>Experimental</tt> - * package. + * Used by <tt>ExperimentalJUnitTest</tt>. This is a non-<tt>Experimental</tt> package. * * @see org.apache.geode.annotations.ExperimentalJUnitTest */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionFactoryImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionFactoryImpl.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionFactoryImpl.java index d7bcc44..2cba958 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionFactoryImpl.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionFactoryImpl.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra; @@ -23,12 +21,12 @@ import javax.resource.spi.ConnectionManager; import javax.resource.spi.ManagedConnectionFactory; import org.apache.geode.ra.GFConnectionFactory; + /** * * */ -public class GFConnectionFactoryImpl implements GFConnectionFactory -{ +public class GFConnectionFactoryImpl implements GFConnectionFactory { final private ConnectionManager cm; final private ManagedConnectionFactory mcf; @@ -40,25 +38,21 @@ public class GFConnectionFactoryImpl implements GFConnectionFactory this.mcf = mcf; } - public GFConnectionFactoryImpl(ConnectionManager cm, - ManagedConnectionFactory mcf) { + public GFConnectionFactoryImpl(ConnectionManager cm, ManagedConnectionFactory mcf) { this.cm = cm; this.mcf = mcf; } - public GFConnectionImpl getConnection() throws ResourceException - { - return (GFConnectionImpl)cm.allocateConnection(mcf, null); + public GFConnectionImpl getConnection() throws ResourceException { + return (GFConnectionImpl) cm.allocateConnection(mcf, null); } - public void setReference(Reference ref) - { + public void setReference(Reference ref) { this.ref = ref; } - public Reference getReference() throws NamingException - { + public Reference getReference() throws NamingException { return this.ref; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionImpl.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionImpl.java index 7a69293..5ff7a71 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionImpl.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/GFConnectionImpl.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra; @@ -27,8 +25,7 @@ import org.apache.geode.ra.GFConnection; * * */ -public class GFConnectionImpl implements GFConnection -{ +public class GFConnectionImpl implements GFConnection { private JCAManagedConnection mc; private Reference ref; @@ -37,13 +34,11 @@ public class GFConnectionImpl implements GFConnection this.mc = mc; } - public void resetManagedConnection(JCAManagedConnection mc) - { + public void resetManagedConnection(JCAManagedConnection mc) { this.mc = mc; } - public void close() throws ResourceException - { + public void close() throws ResourceException { // Check if the connection is associated with a JTA. If yes, then // we should throw an exception on close being invoked. if (this.mc != null) { @@ -51,19 +46,16 @@ public class GFConnectionImpl implements GFConnection } } - public void invalidate() - { + public void invalidate() { this.mc = null; } - public void setReference(Reference ref) - { + public void setReference(Reference ref) { this.ref = ref; } - public Reference getReference() throws NamingException - { + public Reference getReference() throws NamingException { return this.ref; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java index c7b2223..112f2fa 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra.spi; @@ -35,8 +33,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings; * * */ -public class JCALocalTransaction implements LocalTransaction -{ +public class JCALocalTransaction implements LocalTransaction { private volatile GemFireCacheImpl cache; private volatile TXManagerImpl gfTxMgr; @@ -63,13 +60,11 @@ public class JCALocalTransaction implements LocalTransaction // this ); } - public void begin() throws ResourceException - { + public void begin() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JCALocalTransaction:begin"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -85,8 +80,7 @@ public class JCALocalTransaction implements LocalTransaction } TransactionManager tm = cache.getJTATransactionManager(); if (this.tid != null) { - throw new LocalTransactionException( - " A transaction is already in progress"); + throw new LocalTransactionException(" A transaction is already in progress"); } if (tm != null && tm.getTransaction() != null) { if (logger.fineEnabled()) { @@ -103,19 +97,15 @@ public class JCALocalTransaction implements LocalTransaction if (logger.fineEnabled()) { logger.fine("JCALocalTransaction:begun GFE transaction"); } + } else { + throw new LocalTransactionException("GemFire is already associated with a transaction"); } - else { - throw new LocalTransactionException( - "GemFire is already associated with a transaction"); - } - } - else { + } else { if (logger.fineEnabled()) { logger.fine("JCAManagedConnection: JTA Transaction does not exist."); } } - } - catch (SystemException e) { + } catch (SystemException e) { // this.onError(); throw new ResourceException(e); } @@ -129,13 +119,11 @@ public class JCALocalTransaction implements LocalTransaction } - public void commit() throws ResourceException - { + public void commit() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JCALocalTransaction:commit"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -145,15 +133,13 @@ public class JCALocalTransaction implements LocalTransaction } TXStateProxy tsp = this.gfTxMgr.getTXState(); if (tsp != null && this.tid != tsp.getTransactionId()) { - throw new IllegalStateException( - "Local Transaction associated with Tid = " + this.tid - + " attempting to commit a different transaction"); + throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid + + " attempting to commit a different transaction"); } try { this.gfTxMgr.commit(); this.tid = null; - } - catch (Exception e) { + } catch (Exception e) { throw new LocalTransactionException(e.toString()); } // Iterator<ConnectionEventListener> itr = this.listeners.iterator(); @@ -165,21 +151,18 @@ public class JCALocalTransaction implements LocalTransaction } - public void rollback() throws ResourceException - { + public void rollback() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JJCALocalTransaction:rollback"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } TXStateProxy tsp = this.gfTxMgr.getTXState(); if (tsp != null && this.tid != tsp.getTransactionId()) { - throw new IllegalStateException( - "Local Transaction associated with Tid = " + this.tid - + " attempting to commit a different transaction"); + throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid + + " attempting to commit a different transaction"); } LogWriter logger = cache.getLogger(); if (logger.fineEnabled()) { @@ -187,24 +170,18 @@ public class JCALocalTransaction implements LocalTransaction } try { this.gfTxMgr.rollback(); - } - catch (IllegalStateException ise) { + } catch (IllegalStateException ise) { // It is possible that the GFE transaction has already been rolled back. - if (ise - .getMessage() - .equals( - LocalizedStrings.TXManagerImpl_THREAD_DOES_NOT_HAVE_AN_ACTIVE_TRANSACTION - .toLocalizedString())) { + if (ise.getMessage() + .equals(LocalizedStrings.TXManagerImpl_THREAD_DOES_NOT_HAVE_AN_ACTIVE_TRANSACTION + .toLocalizedString())) { // /ignore; - } - else { + } else { throw new ResourceException(ise); } - } - catch (Exception e) { + } catch (Exception e) { throw new ResourceException(e); - } - finally { + } finally { this.tid = null; } // Iterator<ConnectionEventListener> itr = this.listeners.iterator(); @@ -216,9 +193,8 @@ public class JCALocalTransaction implements LocalTransaction } - private void init() throws SystemException - { - this.cache = (GemFireCacheImpl)CacheFactory.getAnyInstance(); + private void init() throws SystemException { + this.cache = (GemFireCacheImpl) CacheFactory.getAnyInstance(); LogWriter logger = this.cache.getLogger(); if (logger.fineEnabled()) { logger.fine("JCAManagedConnection:init. Inside init"); @@ -227,8 +203,7 @@ public class JCALocalTransaction implements LocalTransaction this.initDone = true; } - boolean transactionInProgress() - { + boolean transactionInProgress() { return this.tid != null; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java index 4a9c903..520f7e2 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra.spi; @@ -71,35 +69,31 @@ public class JCAManagedConnection implements ManagedConnection public JCAManagedConnection(JCAManagedConnectionFactory fact) { this.factory = fact; this.listeners = Collections - .<ConnectionEventListener> synchronizedList(new ArrayList<ConnectionEventListener>()); + .<ConnectionEventListener>synchronizedList(new ArrayList<ConnectionEventListener>()); this.localTran = new JCALocalTransaction(); - this.connections = Collections - .<GFConnectionImpl> synchronizedSet(new HashSet<GFConnectionImpl>()); + this.connections = + Collections.<GFConnectionImpl>synchronizedSet(new HashSet<GFConnectionImpl>()); } - public void addConnectionEventListener(ConnectionEventListener listener) - { + public void addConnectionEventListener(ConnectionEventListener listener) { this.listeners.add(listener); } - public void associateConnection(Object conn) throws ResourceException - { + public void associateConnection(Object conn) throws ResourceException { if (!(conn instanceof GFConnectionImpl)) { throw new ResourceException("Connection is not of type GFConnection"); } - ((GFConnectionImpl)conn).resetManagedConnection(this); - this.connections.add((GFConnectionImpl)conn); + ((GFConnectionImpl) conn).resetManagedConnection(this); + this.connections.add((GFConnectionImpl) conn); } - public void cleanup() throws ResourceException - { + public void cleanup() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JCAManagedConnection:cleanup"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -114,21 +108,18 @@ public class JCAManagedConnection implements ManagedConnection if (this.localTran == null || this.localTran.transactionInProgress()) { if (this.initDone && !this.cache.isClosed()) { this.localTran = new JCALocalTransaction(cache, gfTxMgr); - } - else { + } else { this.localTran = new JCALocalTransaction(); } } } - public void destroy() throws ResourceException - { + public void destroy() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JCAManagedConnection:destroy"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -146,15 +137,11 @@ public class JCAManagedConnection implements ManagedConnection this.listeners.clear(); } - public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) - throws ResourceException - { + public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException { if (DEBUG) { try { - throw new NullPointerException( - "Asif:JCAManagedConnection:getConnection"); - } - catch (NullPointerException npe) { + throw new NullPointerException("Asif:JCAManagedConnection:getConnection"); + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -164,23 +151,20 @@ public class JCAManagedConnection implements ManagedConnection } LogWriter logger = this.cache.getLogger(); if (logger.fineEnabled()) { - logger - .fine("JCAManagedConnection:getConnection. Returning new Connection"); + logger.fine("JCAManagedConnection:getConnection. Returning new Connection"); } GFConnectionImpl conn = new GFConnectionImpl(this); this.connections.add(conn); return conn; - } - catch (SystemException e) { + } catch (SystemException e) { this.onError(e); throw new ResourceException("GemFire Resource unavailable", e); } } - private void init() throws SystemException - { - this.cache = (GemFireCacheImpl)CacheFactory.getAnyInstance(); + private void init() throws SystemException { + this.cache = (GemFireCacheImpl) CacheFactory.getAnyInstance(); LogWriter logger = this.cache.getLogger(); if (logger.fineEnabled()) { logger.fine("JCAManagedConnection:init. Inside init"); @@ -189,14 +173,11 @@ public class JCAManagedConnection implements ManagedConnection this.initDone = true; } - public LocalTransaction getLocalTransaction() throws ResourceException - { + public LocalTransaction getLocalTransaction() throws ResourceException { if (DEBUG) { try { - throw new NullPointerException( - "Asif:JCAManagedConnection:getLocalTransaction"); - } - catch (NullPointerException npe) { + throw new NullPointerException("Asif:JCAManagedConnection:getLocalTransaction"); + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -204,18 +185,15 @@ public class JCAManagedConnection implements ManagedConnection return this.localTran; } - public PrintWriter getLogWriter() throws ResourceException - { + public PrintWriter getLogWriter() throws ResourceException { return this.logger; } - public ManagedConnectionMetaData getMetaData() throws ResourceException - { + public ManagedConnectionMetaData getMetaData() throws ResourceException { if (DEBUG) { try { throw new NullPointerException("Asif:JCAManagedConnection:getMetaData"); - } - catch (NullPointerException npe) { + } catch (NullPointerException npe) { npe.printStackTrace(); } } @@ -229,24 +207,20 @@ public class JCAManagedConnection implements ManagedConnection this.factory.getVersion(), this.factory.getUserName()); } - public XAResource getXAResource() throws ResourceException - { + public XAResource getXAResource() throws ResourceException { throw new NotSupportedException("XA Transaction not supported"); } - public void removeConnectionEventListener(ConnectionEventListener arg0) - { + public void removeConnectionEventListener(ConnectionEventListener arg0) { this.listeners.remove(arg0); } - public void setLogWriter(PrintWriter logger) throws ResourceException - { + public void setLogWriter(PrintWriter logger) throws ResourceException { this.logger = logger; } - private void onError(Exception e) - { + private void onError(Exception e) { this.localTran = null; @@ -257,8 +231,8 @@ public class JCAManagedConnection implements ManagedConnection conn.invalidate(); synchronized (this.listeners) { Iterator<ConnectionEventListener> itr = this.listeners.iterator(); - ConnectionEvent ce = new ConnectionEvent(this, - ConnectionEvent.CONNECTION_ERROR_OCCURRED, e); + ConnectionEvent ce = + new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, e); ce.setConnectionHandle(conn); while (itr.hasNext()) { itr.next().connectionErrorOccurred(ce); @@ -270,14 +244,12 @@ public class JCAManagedConnection implements ManagedConnection } - public void onClose(GFConnectionImpl conn) throws ResourceException - { + public void onClose(GFConnectionImpl conn) throws ResourceException { conn.invalidate(); this.connections.remove(conn); synchronized (this.listeners) { Iterator<ConnectionEventListener> itr = this.listeners.iterator(); - ConnectionEvent ce = new ConnectionEvent(this, - ConnectionEvent.CONNECTION_CLOSED); + ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); ce.setConnectionHandle(conn); while (itr.hasNext()) { itr.next().connectionClosed(ce); @@ -287,8 +259,7 @@ public class JCAManagedConnection implements ManagedConnection // safe to dissociate this managedconnection so that it can go to pool if (this.initDone && !this.cache.isClosed()) { this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr); - } - else { + } else { this.localTran = new JCALocalTransaction(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory.java index fda8707..99cff78 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory.java @@ -1,18 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra.spi; @@ -27,12 +25,12 @@ import javax.resource.spi.ManagedConnectionFactory; import javax.security.auth.Subject; import org.apache.geode.internal.ra.GFConnectionFactoryImpl; + /** * * */ -public class JCAManagedConnectionFactory implements ManagedConnectionFactory -{ +public class JCAManagedConnectionFactory implements ManagedConnectionFactory { private String productName; private String version; @@ -41,103 +39,83 @@ public class JCAManagedConnectionFactory implements ManagedConnectionFactory private PrintWriter logger; - public Object createConnectionFactory() throws ResourceException - { + public Object createConnectionFactory() throws ResourceException { return new GFConnectionFactoryImpl(this); } - public Object createConnectionFactory(ConnectionManager cm) - throws ResourceException - { + public Object createConnectionFactory(ConnectionManager cm) throws ResourceException { return new GFConnectionFactoryImpl(cm, this); } - public ManagedConnection createManagedConnection(Subject arg0, - ConnectionRequestInfo arg1) throws ResourceException - { + public ManagedConnection createManagedConnection(Subject arg0, ConnectionRequestInfo arg1) + throws ResourceException { return new JCAManagedConnection(this); } - public PrintWriter getLogWriter() throws ResourceException - { + public PrintWriter getLogWriter() throws ResourceException { return this.logger; } public ManagedConnection matchManagedConnections(Set arg0, Subject arg1, - ConnectionRequestInfo arg2) throws ResourceException - { + ConnectionRequestInfo arg2) throws ResourceException { // TODO Auto-generated method stub return null; } - public void setLogWriter(PrintWriter logger) throws ResourceException - { + public void setLogWriter(PrintWriter logger) throws ResourceException { this.logger = logger; } - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (obj instanceof JCAManagedConnectionFactory) { return true; - } - else { + } else { return false; } } - public int hashCode() - { + public int hashCode() { return 0; } - public void setUserName(String user) - { + public void setUserName(String user) { if (this.logger != null) { - logger.println("JCAManagedConnectionFactory::setUserName:. user name is=" - + user); + logger.println("JCAManagedConnectionFactory::setUserName:. user name is=" + user); } this.user = user; } - public String getUserName() - { + public String getUserName() { return this.user; } - public void setProductName(String name) - { + public void setProductName(String name) { if (this.logger != null) { - logger - .println("JCAManagedConnectionFactory::setProductName:. Product name is=" - + name); + logger.println("JCAManagedConnectionFactory::setProductName:. Product name is=" + name); } this.productName = name; } - public String getProductName() - { + public String getProductName() { return this.productName; } - public void setVersion(String version) - { + public void setVersion(String version) { if (this.logger != null) { - logger.println("JCAManagedConnectionFactory::setVersion:. version is=" - + version); + logger.println("JCAManagedConnectionFactory::setVersion:. version is=" + version); } this.version = version; } - public String getVersion() - { + public String getVersion() { return this.version; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionMetaData.java ---------------------------------------------------------------------- diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionMetaData.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionMetaData.java index 6a04ac3..e6c7e6a 100644 --- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionMetaData.java +++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnectionMetaData.java @@ -1,65 +1,58 @@ /* - * 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 + * 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 + * 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. + * 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.geode.internal.ra.spi; import javax.resource.ResourceException; import javax.resource.spi.ManagedConnectionMetaData; + /** * * */ -public class JCAManagedConnectionMetaData implements ManagedConnectionMetaData -{ +public class JCAManagedConnectionMetaData implements ManagedConnectionMetaData { private final String prodName; private final String version; private final String user; - public JCAManagedConnectionMetaData(String prodName, String version, - String user) { + public JCAManagedConnectionMetaData(String prodName, String version, String user) { this.prodName = prodName; this.version = version; this.user = user; } - - public String getEISProductName() throws ResourceException - { + + public String getEISProductName() throws ResourceException { return this.prodName; } - - public String getEISProductVersion() throws ResourceException - { + + public String getEISProductVersion() throws ResourceException { return this.version; } - - public int getMaxConnections() throws ResourceException - { + + public int getMaxConnections() throws ResourceException { return 0; } - - public String getUserName() throws ResourceException - { + + public String getUserName() throws ResourceException { return this.user; }
