Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6A3A5200BBB for ; Thu, 27 Oct 2016 00:48:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 68BAF160AEE; Wed, 26 Oct 2016 22:48:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5BB3B160B04 for ; Thu, 27 Oct 2016 00:48:52 +0200 (CEST) Received: (qmail 52312 invoked by uid 500); 26 Oct 2016 22:48:51 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 52302 invoked by uid 99); 26 Oct 2016 22:48:51 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 22:48:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E150DC76A6 for ; Wed, 26 Oct 2016 22:48:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id S1uEIZWr933h for ; Wed, 26 Oct 2016 22:48:46 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id D54F15FC8C for ; Wed, 26 Oct 2016 22:48:30 +0000 (UTC) Received: (qmail 50552 invoked by uid 99); 26 Oct 2016 22:48:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 22:48:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 73293E186F; Wed, 26 Oct 2016 22:48:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Wed, 26 Oct 2016 22:49:05 -0000 Message-Id: <75973b5c0b7044e388f9f4341189b0e3@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [39/93] [partial] incubator-geode git commit: Added Spotless plugin to enforce formatting standards. Added Google Java Style guide formatter templates, removed existing formatter templates. archived-at: Wed, 26 Oct 2016 22:48:54 -0000 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Customer.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Customer.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Customer.java index 801c5a7..263e6c7 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Customer.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Customer.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; @@ -22,6 +20,7 @@ import org.apache.geode.internal.lang.ObjectUtils; /** * The Customer class models a customer entity. *

+ * * @since GemFire 8.0 */ @@ -31,8 +30,7 @@ public class Customer implements Serializable { private String firstName; private String lastName; - public Customer() { - } + public Customer() {} public Customer(final Long custId) { this.customerId = custId; @@ -81,8 +79,8 @@ public class Customer implements Serializable { final Customer that = (Customer) obj; return (ObjectUtils.equals(this.getCustomerId(), that.getCustomerId()) - && ObjectUtils.equals(this.getLastName(), that.getLastName()) && ObjectUtils - .equals(this.getFirstName(), that.getFirstName())); + && ObjectUtils.equals(this.getLastName(), that.getLastName()) + && ObjectUtils.equals(this.getFirstName(), that.getFirstName())); } @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/DateTimeUtils.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/DateTimeUtils.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/DateTimeUtils.java index 1467821..2701608 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/DateTimeUtils.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/DateTimeUtils.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; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Gender.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Gender.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Gender.java index 774d83c..4c92aae 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Gender.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Gender.java @@ -1,29 +1,27 @@ /* - * 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; /** * The Gender enum is a enumeration of genders (sexes). *

+ * * @since GemFire 8.0 */ @SuppressWarnings("unused") public enum Gender { - FEMALE, - MALE + FEMALE, MALE } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetAllEntries.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetAllEntries.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetAllEntries.java index c047f12..082f69d 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetAllEntries.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetAllEntries.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; @@ -25,6 +23,7 @@ import org.apache.geode.cache.execute.FunctionContext; /** * The GetAllEntries is function that will return a map as a result of its execution. *

+ * * @since GemFire 8.0 */ @@ -38,8 +37,8 @@ public class GetAllEntries implements Function { myMap.put("k13", "v3"); myMap.put("k14", "v4"); myMap.put("k15", "v5"); - - //return map as a function result + + // return map as a function result context.getResultSender().lastResult(myMap); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetDeliveredOrders.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetDeliveredOrders.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetDeliveredOrders.java index e224777..a09d7fe 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetDeliveredOrders.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetDeliveredOrders.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; @@ -33,14 +31,15 @@ import org.apache.geode.cache.query.TypeMismatchException; /** -* The GetDeliveredOrders class is a gemfire function that gives details about delivered orders. -*

-* @since GemFire 8.0 -*/ + * The GetDeliveredOrders class is a gemfire function that gives details about delivered orders. + *

+ * + * @since GemFire 8.0 + */ -public class GetDeliveredOrders implements Function { +public class GetDeliveredOrders implements Function { public void execute(FunctionContext context) { - + Cache c = null; ArrayList vals = new ArrayList(); try { @@ -49,37 +48,46 @@ public class GetDeliveredOrders implements Function { vals.add("NoCacheFoundResult"); context.getResultSender().lastResult(vals); } - - String oql = "SELECT o.purchaseOrderNo, o.deliveryDate FROM /orders o WHERE o.deliveryDate != NULL"; + + String oql = + "SELECT o.purchaseOrderNo, o.deliveryDate FROM /orders o WHERE o.deliveryDate != NULL"; final Query query = c.getQueryService().newQuery(oql); - + SelectResults result = null; try { result = (SelectResults) query.execute(); int resultSize = result.size(); - - if(result instanceof Collection) - for(Object item : result){ + + if (result instanceof Collection) + for (Object item : result) { vals.add(item); } } catch (FunctionDomainException e) { - if(c != null) - c.getLogger().info("Caught FunctionDomainException while executing function GetDeliveredOrders: " + e.getMessage()); - + if (c != null) + c.getLogger() + .info("Caught FunctionDomainException while executing function GetDeliveredOrders: " + + e.getMessage()); + } catch (TypeMismatchException e) { - if(c != null) - c.getLogger().info("Caught TypeMismatchException while executing function GetDeliveredOrders: " + e.getMessage()); - + if (c != null) + c.getLogger() + .info("Caught TypeMismatchException while executing function GetDeliveredOrders: " + + e.getMessage()); + } catch (NameResolutionException e) { - if(c != null) - c.getLogger().info("Caught NameResolutionException while executing function GetDeliveredOrders: " + e.getMessage()); - + if (c != null) + c.getLogger() + .info("Caught NameResolutionException while executing function GetDeliveredOrders: " + + e.getMessage()); + } catch (QueryInvocationTargetException e) { - if(c != null) - c.getLogger().info("Caught QueryInvocationTargetException while executing function GetDeliveredOrders: " + e.getMessage()); - + if (c != null) + c.getLogger().info( + "Caught QueryInvocationTargetException while executing function GetDeliveredOrders: " + + e.getMessage()); + } - + context.getResultSender().lastResult(vals); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetRegions.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetRegions.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetRegions.java index 9e261a7..be3e90b 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetRegions.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetRegions.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; @@ -27,17 +25,18 @@ import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionContext; /** -* The GetRegions class is an gemfire function that gives data about available regions. -*

-* @since GemFire 8.0 -*/ + * The GetRegions class is an gemfire function that gives data about available regions. + *

+ * + * @since GemFire 8.0 + */ -public class GetRegions implements Function { +public class GetRegions implements Function { public void execute(FunctionContext context) { - + ArrayList vals = new ArrayList(); - + Cache c = null; try { c = CacheFactory.getAnyInstance(); @@ -50,7 +49,7 @@ public class GetRegions implements Function { for (Region r : regionSet) { vals.add(r.getName()); } - + context.getResultSender().lastResult(vals); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetValueForKey.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetValueForKey.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetValueForKey.java index eb461fb..a8c2f08 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetValueForKey.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/GetValueForKey.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; @@ -24,38 +22,38 @@ import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionContext; public class GetValueForKey implements Function { - + @Override - public void execute(FunctionContext context) { + public void execute(FunctionContext context) { Object args = context.getArguments(); - + Cache cache = null; - - try{ + + try { cache = CacheFactory.getAnyInstance(); - - if(args.toString().equalsIgnoreCase("1") ){ + + if (args.toString().equalsIgnoreCase("1")) { Region r = cache.getRegion("Products"); Object result = r.get("1"); context.getResultSender().lastResult(result); - - }else if(args.toString().equalsIgnoreCase("2")){ + + } else if (args.toString().equalsIgnoreCase("2")) { Region r = cache.getRegion("People"); Object result = r.get("2"); - context.getResultSender().lastResult(result); - }else{ - //Default case - int i=10; + context.getResultSender().lastResult(result); + } else { + // Default case + int i = 10; context.getResultSender().lastResult(i); } - }catch(CacheClosedException e){ + } catch (CacheClosedException e) { context.getResultSender().lastResult("Error: CacheClosedException"); } - + } @Override - public String getId() { + public String getId() { return "GetValueForKey"; } @@ -72,6 +70,6 @@ public class GetValueForKey implements Function { @Override public boolean isHA() { return false; - } + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Item.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Item.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Item.java index e8d4f01..9a5d070 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Item.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Item.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; @@ -26,6 +24,7 @@ import org.apache.geode.pdx.PdxWriter; /** * The Item class models item entity in the real world. *

+ * * @since GemFire 8.0 */ @@ -86,14 +85,15 @@ public class Item implements PdxSerializable { this.itemNo = itemNumber; } - public Item(final Long itemNumber, final String desc, final int qty, final float uprice, final float tprice) { + public Item(final Long itemNumber, final String desc, final int qty, final float uprice, + final float tprice) { this.itemNo = itemNumber; this.description = desc; this.quantity = qty; this.unitPrice = uprice; this.totalPrice = tprice; } - + @Override public boolean equals(final Object obj) { if (obj == this) { @@ -153,7 +153,7 @@ public class Item implements PdxSerializable { quantity = reader.readInt("quantity"); unitPrice = reader.readFloat("unitPrice"); totalPrice = reader.readFloat("totalPrice"); - + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Order.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Order.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Order.java index bcf5c3b..708b0b3 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Order.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Order.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; @@ -26,13 +24,14 @@ import org.apache.geode.pdx.PdxSerializable; import org.apache.geode.pdx.PdxWriter; /** -* The Order class is an abstraction modeling a order. -*

-* @since GemFire 8.0 -*/ + * The Order class is an abstraction modeling a order. + *

+ * + * @since GemFire 8.0 + */ public class Order implements PdxSerializable { - + private Long purchaseOrderNo; private Long customerId; private String description; @@ -41,8 +40,8 @@ public class Order implements PdxSerializable { private String contact; private String email; private String phone; - private List items; - private double totalPrice; + private List items; + private double totalPrice; public Order() { items = new ArrayList(); @@ -52,9 +51,9 @@ public class Order implements PdxSerializable { this.purchaseOrderNo = orderNo; } - public Order(final Long orderNo, final Long custId, final String desc, - final Date odate, final Date ddate, final String contact, final String email, - final String phone, final List items, final double tprice) { + public Order(final Long orderNo, final Long custId, final String desc, final Date odate, + final Date ddate, final String contact, final String email, final String phone, + final List items, final double tprice) { this.purchaseOrderNo = orderNo; this.customerId = custId; this.description = desc; @@ -131,11 +130,11 @@ public class Order implements PdxSerializable { public List getItems() { return items; } - + public void setItems(List items) { - if(this.items == null) + if (this.items == null) this.items = new ArrayList(); - + for (Item it : items) this.items.add(it); } @@ -180,9 +179,9 @@ public class Order implements PdxSerializable { contact = reader.readString("contact"); email = reader.readString("email"); phone = reader.readString("phone"); - items = (List)reader.readObject("items"); + items = (List) reader.readObject("items"); totalPrice = reader.readDouble("totalPrice"); - + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Person.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Person.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Person.java index b995ec2..be465f9 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Person.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/Person.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; @@ -25,39 +23,39 @@ import org.apache.geode.pdx.PdxWriter; import java.io.Serializable; /** -* The Person class is an abstraction modeling a person. -*

-* @since GemFire 8.0 -*/ + * The Person class is an abstraction modeling a person. + *

+ * + * @since GemFire 8.0 + */ @SuppressWarnings("unused") public class Person implements PdxSerializable { private static final long serialVersionUID = 42108163264l; - + protected static final String DOB_FORMAT_PATTERN = "MM/dd/yyyy"; - - private Long id; - + + private Long id; + private Date birthDate; - + private Gender gender; - + private String firstName; private String middleName; private String lastName; - - public Person() { - } - + + public Person() {} + public Person(final Long id) { this.id = id; } - + public Person(final String firstName, final String lastName) { this.firstName = firstName; this.lastName = lastName; } - + public Person(Long id, String fn, String mn, String ln, Date bDate, Gender g) { this.id = id; this.firstName = fn; @@ -66,73 +64,73 @@ public class Person implements PdxSerializable { this.birthDate = bDate; this.gender = g; } - + public Long getId() { return id; } - + public void setId(final Long id) { this.id = id; } - + public String getFirstName() { return firstName; } - + public void setFirstName(final String firstName) { this.firstName = firstName; } - + public String getLastName() { return lastName; } - + public void setLastName(final String lastName) { this.lastName = lastName; } - + public String getMiddleName() { return middleName; } - + public void setMiddleName(final String middleName) { this.middleName = middleName; } - + public Date getBirthDate() { return birthDate; } - + public void setBirthDate(final Date birthDate) { this.birthDate = birthDate; } - + public Gender getGender() { return gender; } - + public void setGender(final Gender gender) { this.gender = gender; } - + @Override public boolean equals(final Object obj) { if (obj == this) { return true; } - + if (!(obj instanceof Person)) { return false; } - + final Person that = (Person) obj; - + return (ObjectUtils.equals(this.getId(), that.getId()) - || (ObjectUtils.equals(this.getBirthDate(), that.getBirthDate()) - && ObjectUtils.equals(this.getLastName(), that.getLastName()) - && ObjectUtils.equals(this.getFirstName(), that.getFirstName()))); + || (ObjectUtils.equals(this.getBirthDate(), that.getBirthDate()) + && ObjectUtils.equals(this.getLastName(), that.getLastName()) + && ObjectUtils.equals(this.getFirstName(), that.getFirstName()))); } - + @Override public int hashCode() { int hashValue = 17; @@ -142,7 +140,7 @@ public class Person implements PdxSerializable { hashValue = 37 * hashValue + ObjectUtils.hashCode(getFirstName()); return hashValue; } - + @Override public String toString() { final StringBuilder buffer = new StringBuilder("{ type = "); @@ -151,12 +149,13 @@ public class Person implements PdxSerializable { buffer.append(", firstName = ").append(getFirstName()); buffer.append(", middleName = ").append(getMiddleName()); buffer.append(", lastName = ").append(getLastName()); - buffer.append(", birthDate = ").append(DateTimeUtils.format(getBirthDate(), DOB_FORMAT_PATTERN)); + buffer.append(", birthDate = ") + .append(DateTimeUtils.format(getBirthDate(), DOB_FORMAT_PATTERN)); buffer.append(", gender = ").append(getGender()); buffer.append(" }"); return buffer.toString(); } - + @Override public void toData(PdxWriter writer) { writer.writeString("@type", getClass().getName()); @@ -166,9 +165,9 @@ public class Person implements PdxSerializable { writer.writeString("lastName", lastName); writer.writeObject("gender", gender); writer.writeDate("birthDate", birthDate); - + } - + @Override public void fromData(PdxReader reader) { String type = reader.readString("@type"); @@ -176,9 +175,9 @@ public class Person implements PdxSerializable { firstName = reader.readString("firstName"); middleName = reader.readString("middleName"); lastName = reader.readString("lastName"); - gender = (Gender)reader.readObject("gender"); + gender = (Gender) reader.readObject("gender"); birthDate = reader.readDate("birthDate"); - + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/PutKeyFunction.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/PutKeyFunction.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/PutKeyFunction.java index ab0f7d0..0275961 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/PutKeyFunction.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/PutKeyFunction.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; @@ -25,8 +23,7 @@ import org.apache.geode.cache.execute.RegionFunctionContext; /** - * Function that puts the value from the argument at the key passed in through - * the filter. + * Function that puts the value from the argument at the key passed in through the filter. */ public class PutKeyFunction implements Function { @@ -34,7 +31,7 @@ public class PutKeyFunction implements Function { private static final String ID = "PutKeyFunction"; public void execute(FunctionContext context) { - RegionFunctionContext regionContext = (RegionFunctionContext)context; + RegionFunctionContext regionContext = (RegionFunctionContext) context; Region dataSet = regionContext.getDataSet(); Object key = regionContext.getFilter().iterator().next(); Object value = regionContext.getArguments(); @@ -50,12 +47,12 @@ public class PutKeyFunction implements Function { return true; } - public void init(Properties p) { - } + public void init(Properties p) {} public boolean optimizeForWrite() { return true; } + public boolean isHA() { return true; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java index b45b683..5cae692 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.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; @@ -57,6 +55,7 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor /** * Dunit Test to validate OnRegion function execution with REST APIs + * * @since GemFire 8.0 */ @@ -86,7 +85,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(policy); - Region region = CacheFactory.getAnyInstance().createRegion(REPLICATE_REGION_NAME, factory.create()); + Region region = + CacheFactory.getAnyInstance().createRegion(REPLICATE_REGION_NAME, factory.create()); org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("Region Created :" + region); assertNotNull(region); } @@ -106,7 +106,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { } private void populatePRRegion() { - PartitionedRegion pr = (PartitionedRegion) CacheFactory.getAnyInstance().getRegion(PR_REGION_NAME); + PartitionedRegion pr = + (PartitionedRegion) CacheFactory.getAnyInstance().getRegion(PR_REGION_NAME); DistributedSystem.setThreadsSocketPolicy(false); for (int i = (pr.getTotalNumberOfBuckets() * 3); i > 0; i--) { @@ -139,19 +140,23 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { } private void createCacheAndRegisterFunction() { - restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost() - .getHostName(), null, urlContext))); - restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost() - .getHostName(), null, urlContext))); - restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost() - .getHostName(), null, urlContext))); - restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3.getHost() - .getHostName(), null, urlContext))); - - vm0.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction())); - vm1.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction())); - vm2.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction())); - vm3.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction())); + restURLs.add(vm0.invoke("createCacheWithGroups", + () -> createCacheWithGroups(vm0.getHost().getHostName(), null, urlContext))); + restURLs.add(vm1.invoke("createCacheWithGroups", + () -> createCacheWithGroups(vm1.getHost().getHostName(), null, urlContext))); + restURLs.add(vm2.invoke("createCacheWithGroups", + () -> createCacheWithGroups(vm2.getHost().getHostName(), null, urlContext))); + restURLs.add(vm3.invoke("createCacheWithGroups", + () -> createCacheWithGroups(vm3.getHost().getHostName(), null, urlContext))); + + vm0.invoke("registerFunction(new SampleFunction())", + () -> FunctionService.registerFunction(new SampleFunction())); + vm1.invoke("registerFunction(new SampleFunction())", + () -> FunctionService.registerFunction(new SampleFunction())); + vm2.invoke("registerFunction(new SampleFunction())", + () -> FunctionService.registerFunction(new SampleFunction())); + vm3.invoke("registerFunction(new SampleFunction())", + () -> FunctionService.registerFunction(new SampleFunction())); } @Test @@ -165,7 +170,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { vm3.invoke("populateRRRegion", () -> populateRRRegion()); - CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", REPLICATE_REGION_NAME, null, null, null, null); + CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", + REPLICATE_REGION_NAME, null, null, null, null); assertEquals(200, response.getStatusLine().getStatusCode()); assertNotNull(response.getEntity()); @@ -183,7 +189,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { vm3.invoke("populatePRRegion", () -> populatePRRegion()); - CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, null, null, null); + CloseableHttpResponse response = + executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, null, null, null); assertEquals(200, response.getStatusLine().getStatusCode()); assertNotNull(response.getEntity()); @@ -200,7 +207,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { vm3.invoke("populatePRRegion", () -> populatePRRegion()); - CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", null, null, null); + CloseableHttpResponse response = + executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", null, null, null); assertEquals(200, response.getStatusLine().getStatusCode()); assertNotNull(response.getEntity()); @@ -223,20 +231,28 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { vm3.invoke("populatePRRegion", () -> populatePRRegion()); - String jsonBody = "[" + "{\"@type\": \"double\",\"@value\": 210}" + ",{\"@type\":\"org.apache.geode.rest.internal.web.controllers.Item\"," + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\"," + "\"quantity\":\"2\"," + "\"unitprice\":\"5\"," + "\"totalprice\":\"10.00\"}" + "]"; + String jsonBody = "[" + "{\"@type\": \"double\",\"@value\": 210}" + + ",{\"@type\":\"org.apache.geode.rest.internal.web.controllers.Item\"," + + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\"," + + "\"quantity\":\"2\"," + "\"unitprice\":\"5\"," + "\"totalprice\":\"10.00\"}" + "]"; - CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, jsonBody, null, null); + CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", + PR_REGION_NAME, null, jsonBody, null, null); assertEquals(200, response.getStatusLine().getStatusCode()); assertNotNull(response.getEntity()); // Assert that only 1 node has executed the function. assertCorrectInvocationCount(4, vm0, vm1, vm2, vm3); - jsonBody = "[" + "{\"@type\": \"double\",\"@value\": 220}" + ",{\"@type\":\"org.apache.geode.rest.internal.web.controllers.Item\"," + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\"," + "\"quantity\":\"3\"," + "\"unitprice\":\"9\"," + "\"totalprice\":\"12.00\"}" + "]"; + jsonBody = "[" + "{\"@type\": \"double\",\"@value\": 220}" + + ",{\"@type\":\"org.apache.geode.rest.internal.web.controllers.Item\"," + + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\"," + + "\"quantity\":\"3\"," + "\"unitprice\":\"9\"," + "\"totalprice\":\"12.00\"}" + "]"; resetInvocationCounts(vm0, vm1, vm2, vm3); - response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", jsonBody, null, null); + response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", jsonBody, + null, null); assertEquals(200, response.getStatusLine().getStatusCode()); assertNotNull(response.getEntity()); @@ -255,19 +271,16 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { invocationCount++; if (context instanceof RegionFunctionContext) { RegionFunctionContext rfContext = (RegionFunctionContext) context; - rfContext.getDataSet() - .getCache() - .getLogger() - .info("Executing function : SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + " " + rfContext); + rfContext.getDataSet().getCache().getLogger() + .info("Executing function : SampleFunction.execute(hasResult=true) with filter: " + + rfContext.getFilter() + " " + rfContext); if (rfContext.getArguments() instanceof Boolean) { /* return rfContext.getArguments(); */ if (hasResult()) { rfContext.getResultSender().lastResult((Serializable) rfContext.getArguments()); } else { - rfContext.getDataSet() - .getCache() - .getLogger() - .info("Executing function : SampleFunction.execute(hasResult=false) " + rfContext); + rfContext.getDataSet().getCache().getLogger() + .info("Executing function : SampleFunction.execute(hasResult=false) " + rfContext); while (!rfContext.getDataSet().isDestroyed()) { rfContext.getDataSet().getCache().getLogger().info("For Bug43513 "); try { @@ -285,17 +298,17 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { try { Thread.sleep(2000); } catch (InterruptedException e) { - rfContext.getDataSet().getCache().getLogger().warning("Got Exception : Thread Interrupted" + e); + rfContext.getDataSet().getCache().getLogger() + .warning("Got Exception : Thread Interrupted" + e); } } if (PartitionRegionHelper.isPartitionedRegion(rfContext.getDataSet())) { /* - * return - * (Serializable)PartitionRegionHelper.getLocalDataForContext( + * return (Serializable)PartitionRegionHelper.getLocalDataForContext( * rfContext).get(key); */ - rfContext.getResultSender() - .lastResult((Serializable) PartitionRegionHelper.getLocalDataForContext(rfContext).get(key)); + rfContext.getResultSender().lastResult( + (Serializable) PartitionRegionHelper.getLocalDataForContext(rfContext).get(key)); } else { rfContext.getResultSender().lastResult((Serializable) rfContext.getDataSet().get(key)); } @@ -313,7 +326,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { /* return vals; */ } else if (rfContext.getArguments() instanceof HashMap) { HashMap putData = (HashMap) rfContext.getArguments(); - for (Iterator i = putData.entrySet().iterator(); i.hasNext(); ) { + for (Iterator i = putData.entrySet().iterator(); i.hasNext();) { Map.Entry me = (Map.Entry) i.next(); rfContext.getDataSet().put(me.getKey(), me.getValue()); } @@ -327,7 +340,8 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase { } else { DistributedSystem ds = InternalDistributedSystem.getAnyInstance(); LogWriter logger = ds.getLogWriter(); - logger.info("Executing in SampleFunction on Server : " + ds.getDistributedMember() + "with Context : " + context); + logger.info("Executing in SampleFunction on Server : " + ds.getDistributedMember() + + "with Context : " + context); while (ds.isConnected()) { logger.fine("Just executing function in infinite loop for Bug43513"); try { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java index d35744f..b1b490e 100644 --- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java +++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java @@ -1,19 +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; @@ -83,8 +80,7 @@ class RestAPITestBase extends JUnit4DistributedTestCase { postSetUpRestAPITestBase(); } - private void postSetUpRestAPITestBase() throws Exception { - } + private void postSetUpRestAPITestBase() throws Exception {} /** * close the clients and teh servers @@ -129,16 +125,13 @@ class RestAPITestBase extends JUnit4DistributedTestCase { } private int getInvocationCount() { - RestFunctionTemplate function = (RestFunctionTemplate) FunctionService.getFunction(getFunctionID()); + RestFunctionTemplate function = + (RestFunctionTemplate) FunctionService.getFunction(getFunctionID()); return function.invocationCount; } - CloseableHttpResponse executeFunctionThroughRestCall(String function, - String regionName, - String filter, - String jsonBody, - String groups, - String members) { + CloseableHttpResponse executeFunctionThroughRestCall(String function, String regionName, + String filter, String jsonBody, String groups, String members) { System.out.println("Entering executeFunctionThroughRestCall"); CloseableHttpResponse value = null; try { @@ -146,7 +139,8 @@ class RestAPITestBase extends JUnit4DistributedTestCase { Random randomGenerator = new Random(); int restURLIndex = randomGenerator.nextInt(restURLs.size()); - HttpPost post = createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody); + HttpPost post = + createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody); System.out.println("Request: POST " + post.toString()); value = httpclient.execute(post); @@ -156,15 +150,11 @@ class RestAPITestBase extends JUnit4DistributedTestCase { return value; } - private HttpPost createHTTPPost(String function, - String regionName, - String filter, - int restUrlIndex, - String groups, - String members, - String jsonBody) { + private HttpPost createHTTPPost(String function, String regionName, String filter, + int restUrlIndex, String groups, String members, String jsonBody) { StringBuilder restURLBuilder = new StringBuilder(); - restURLBuilder.append(restURLs.get(restUrlIndex)).append("/functions/").append(function).append("?"); + restURLBuilder.append(restURLs.get(restUrlIndex)).append("/functions/").append(function) + .append("?"); if (regionName != null && !regionName.isEmpty()) { restURLBuilder.append("onRegion=").append(regionName); } else if (groups != null && !groups.isEmpty()) { @@ -190,20 +180,21 @@ class RestAPITestBase extends JUnit4DistributedTestCase { throw new RuntimeException("This method should be overridden"); } - void assertHttpResponse(CloseableHttpResponse response, int httpCode, int expectedServerResponses) { + void assertHttpResponse(CloseableHttpResponse response, int httpCode, + int expectedServerResponses) { assertEquals(httpCode, response.getStatusLine().getStatusCode()); - //verify response has body flag, expected is true. + // verify response has body flag, expected is true. assertNotNull(response.getEntity()); try { String httpResponseString = processHttpResponse(response); response.close(); System.out.println("Response : " + httpResponseString); - //verify function execution result + // verify function execution result JSONArray resultArray = new JSONArray(httpResponseString); assertEquals(expectedServerResponses, resultArray.length()); } catch (Exception e) { - //fail("exception", e); + // fail("exception", e); } }