You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/16 14:21:09 UTC

[GitHub] [geode-native] mmartell opened a new pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

mmartell opened a new pull request #714:
URL: https://github.com/apache/geode-native/pull/714


   This adds a new C++ serialization test for using a class as a key.
   
   Notes:
   * This test leverages the new gfsh execute function support in the C++ test framework.
   * A .NET serialization test for using a class as a key has been added in a previous PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r544788402



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -41,19 +41,19 @@ Position::Position(std::string id, int32_t outstandingShares) {
 
 void Position::init() {

Review comment:
       Good C++ practice would sanitize this to an list of initializations on a common constructor. `std::string` initializes to `""` already.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545257130



##########
File path: cppcache/integration/test/PositionKey.cpp
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "PositionKey.hpp"
+
+#include <wchar.h>

Review comment:
       Good catch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545262273



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() :
+  avg20DaysVol(0),
+  convRatio(0.0),
+  valueGain(0.0),
+  industry(0),
+  issuer(0),
+  mktValue(0.0),
+  qty(0.0),
+  sharesOutstanding(0),
+  volatility(0),
+  pid(0) {}
+
+Position::Position(std::string id, int32_t outstandingShares) : Position() {
+  secId = std::move(id);
+  secType = "a";
+  sharesOutstanding = outstandingShares;
+  qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
+  mktValue = qty * 1.2345998;
+  pid = cnt++;
+}
+
+void Position::toData(apache::geode::client::DataOutput& output) const {
+  output.writeInt(avg20DaysVol);
+  output.writeString(bondRating);
+  output.writeDouble(convRatio);
+  output.writeString(country);
+  output.writeDouble(valueGain);
+  output.writeInt(industry);
+  output.writeInt(issuer);
+  output.writeDouble(mktValue);
+  output.writeDouble(qty);
+  output.writeString(secId);
+  output.writeString(secLinks);
+  output.writeString(secType);
+  output.writeInt(sharesOutstanding);
+  output.writeString(underlyer);
+  output.writeInt(volatility);
+  output.writeInt(pid);
+}
+
+void Position::fromData(apache::geode::client::DataInput& input) {
+  avg20DaysVol = input.readInt64();
+  bondRating = std::string(input.readString());
+  convRatio = input.readDouble();
+  country = std::string(input.readString());
+  valueGain = input.readDouble();
+  industry = input.readInt64();
+  issuer = input.readInt64();
+  mktValue = input.readDouble();
+  qty = input.readDouble();
+  secId = std::string(input.readString());
+  secLinks = std::string(input.readString());

Review comment:
       Good catch. You're kind of like an optimizing compiler.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] codecov-io commented on pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #714:
URL: https://github.com/apache/geode-native/pull/714#issuecomment-747534119


   # [Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=h1) Report
   > Merging [#714](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=desc) (8893e0b) into [develop](https://codecov.io/gh/apache/geode-native/commit/4dd2ceb9ef0dd081039bad76cdb78a3a6cc0a2fd?el=desc) (4dd2ceb) will **decrease** coverage by `0.08%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/geode-native/pull/714/graphs/tree.svg?width=650&height=150&src=pr&token=plpAqoqGag)](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #714      +/-   ##
   ===========================================
   - Coverage    74.05%   73.97%   -0.09%     
   ===========================================
     Files          642      642              
     Lines        50812    50812              
   ===========================================
   - Hits         37629    37586      -43     
   - Misses       13183    13226      +43     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cppcache/src/ReadWriteLock.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1JlYWRXcml0ZUxvY2suY3Bw) | `81.25% <0.00%> (-18.75%)` | :arrow_down: |
   | [...test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvaW50ZWdyYXRpb24tdGVzdC90ZXN0VGhpbkNsaWVudFBvb2xFeGVjdXRlSEFGdW5jdGlvblByU0hPUC5jcHA=) | `91.20% <0.00%> (-3.71%)` | :arrow_down: |
   | [cppcache/src/ClientMetadataService.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0NsaWVudE1ldGFkYXRhU2VydmljZS5jcHA=) | `61.78% <0.00%> (-3.67%)` | :arrow_down: |
   | [cppcache/src/TcrEndpoint.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RjckVuZHBvaW50LmNwcA==) | `53.94% <0.00%> (-0.85%)` | :arrow_down: |
   | [cppcache/src/ThinClientRedundancyManager.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RoaW5DbGllbnRSZWR1bmRhbmN5TWFuYWdlci5jcHA=) | `75.11% <0.00%> (-0.79%)` | :arrow_down: |
   | [cppcache/src/ThinClientLocatorHelper.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RoaW5DbGllbnRMb2NhdG9ySGVscGVyLmNwcA==) | `92.14% <0.00%> (-0.72%)` | :arrow_down: |
   | [cppcache/src/TcrConnection.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RjckNvbm5lY3Rpb24uY3Bw) | `71.11% <0.00%> (-0.51%)` | :arrow_down: |
   | [cppcache/src/LRUEntriesMap.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0xSVUVudHJpZXNNYXAuY3Bw) | `60.08% <0.00%> (-0.43%)` | :arrow_down: |
   | [cppcache/src/ExecutionImpl.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0V4ZWN1dGlvbkltcGwuY3Bw) | `69.92% <0.00%> (-0.40%)` | :arrow_down: |
   | [cppcache/src/ThinClientRegion.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RoaW5DbGllbnRSZWdpb24uY3Bw) | `56.28% <0.00%> (-0.06%)` | :arrow_down: |
   | ... and [2 more](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=footer). Last update [4dd2ceb...c8d9a76](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r547049836



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>

Review comment:
       Dang. Thought I removed those already. Good catch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r546789006



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>

Review comment:
       Still need these wide char includes?

##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position()
+    : avg20DaysVol(0),
+      convRatio(0.0),
+      valueGain(0.0),
+      industry(0),
+      issuer(0),
+      mktValue(0.0),

Review comment:
       I would still like to see more readable variable names. The compiler doesn't care how long the names are? ;) Also we should be following the naming convention adopted by this project for new files.
   
   ```C++
   ...
   marketValue_(0.0)
   ...
   ```

##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;

Review comment:
       Since this is a new class, even if it is copied from some older sources, it should conform to our naming conventions.
   ```C++
   int64_t positionId_;
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545134974



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -41,19 +41,19 @@ Position::Position(std::string id, int32_t outstandingShares) {
 
 void Position::init() {

Review comment:
       Good catch. Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r544384826



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }
+
+Position::Position(const char* id, int32_t out) {

Review comment:
       This source smells like it was lifted from somewhere without care to bring it up to our high standards. Can you please:
   * Use `std::string` rather than `char *`.
   * Readable and descriptive variable names. (What is `out`?)
   * Inner class members should not be `CacheableX` types.
   * Don't use C methods where C++ methods exist, like `sprintf`.

##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;

Review comment:
       Use `std::string`.

##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;
+  double convRatio;
+  std::shared_ptr<CacheableString> country;
+  double delta;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::shared_ptr<CacheableString> secId;
+  std::shared_ptr<CacheableString> secLinks;
+  // wchar_t* secType;

Review comment:
       Delete commented code.

##########
File path: tests/javaobject/cli/InstantiateDataSerializable.java
##########
@@ -32,15 +32,16 @@
 public class InstantiateDataSerializable extends FunctionAdapter implements Declarable{
 
 public void execute(FunctionContext context) {
-  Instantiator.register(new Instantiator(javaobject.cli.Position.class, 22) {
+
+  Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, 21) {
     public DataSerializable newInstance() {
-      return new javaobject.cli.Position();
+      return new javaobject.cli.PositionKey();
     }
   });
 
-  Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, 77) {

Review comment:
       Why change the ID from 77 to 21? Have all the older tests expecting 77 been updated?

##########
File path: cppcache/integration/test/PositionKey.cpp
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "PositionKey.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+void PositionKey::toData(DataOutput& output) const {
+  output.writeInt(m_positionId);
+}
+
+void PositionKey::fromData(apache::geode::client::DataInput& input) {
+  m_positionId = input.readInt64();
+}
+
+bool PositionKey::operator==(const CacheableKey& other) const {
+  return m_positionId == ((PositionKey&)other).getPositionId();
+}
+
+int PositionKey::hashcode() const {
+  int hash = 11;
+  hash = 31 * hash + (int)m_positionId;

Review comment:
       This hash function does not match the Java version of this type. This should be fixed or partitioning will be off. Also very odd both just down cast `positionId`. Regardless you should use `static_cast<int32_t>()` not C-style casts.

##########
File path: tests/javaobject/cli/PositionKey.java
##########
@@ -26,7 +26,7 @@
   private long positionId;
 
   static {
-     Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, (byte) 77) {
+     Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, (byte) 21) {

Review comment:
       I don't know why it casts this literal to a `byte`, the method takes an `int`. Remove the cast.

##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;
+  double convRatio;
+  std::shared_ptr<CacheableString> country;
+  double delta;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::shared_ptr<CacheableString> secId;
+  std::shared_ptr<CacheableString> secLinks;
+  // wchar_t* secType;
+  std::wstring secType;
+  int32_t sharesOutstanding;
+  std::shared_ptr<CacheableString> underlyer;
+  int64_t volatility;
+  int32_t pid;
+
+  inline size_t getObjectSize(const std::shared_ptr<Serializable>& obj) const {
+    return (obj == nullptr ? 0 : obj->objectSize());
+  }
+
+ public:
+  static int32_t cnt;
+
+  Position();
+  Position(const char* id, int32_t out);
+  // This constructor is just for some internal data validation test
+  explicit Position(int32_t iForExactVal);
+  ~Position() override = default;
+  void toData(DataOutput& output) const override;
+  void fromData(DataInput& input) override;
+  std::string toString() const override;
+
+  size_t objectSize() const override {

Review comment:
       Unless this or any other test is using usage based eviction we should eliminate the noise of `objectSize`. 

##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;
+
+ public:
+  PositionKey() {}
+  PositionKey(int64_t positionId) { m_positionId = positionId; }
+  ~PositionKey() override = default;
+
+  bool operator==(const CacheableKey& other) const;
+  int32_t hashcode() const;

Review comment:
       Missing `override`.

##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;
+  double convRatio;
+  std::shared_ptr<CacheableString> country;
+  double delta;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;

Review comment:
       Readable fully qualified variable names please.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r547049677



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position()
+    : avg20DaysVol(0),
+      convRatio(0.0),
+      valueGain(0.0),
+      industry(0),
+      issuer(0),
+      mktValue(0.0),

Review comment:
       Good catch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r547049750



##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;

Review comment:
       Missed that.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545119737



##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;
+
+ public:
+  PositionKey() {}
+  PositionKey(int64_t positionId) { m_positionId = positionId; }
+  ~PositionKey() override = default;
+
+  bool operator==(const CacheableKey& other) const;
+  int32_t hashcode() const;

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r544790053



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }

Review comment:
       Replace with:
   ```C++
   Position::Position() :
     avg20DaysVol(0),
     convRatio(0.0),
     valueGain(0.0),
     industry(0),
     issuer(0),
     mktValue(0.0),
     qty(0.0),
     sharesOutstanding(0),
     volatility(0),
     pid(0) {}
   ```

##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }
+
+Position::Position(std::string id, int32_t outstandingShares) {

Review comment:
       Replace with:
   ```C++
   Position::Position(std::string id, int32_t outstandingShares) :
     Position(),
     secId(std::move(id)),
     secType(L"a"),
     sharesOutstanding(outstandingShares) {
     qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
     mktValue = qty * 1.2345998;
     pid = cnt++;
   }
   ```

##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::string bondRating;
+  double convRatio;
+  std::string country;
+  double valueGain;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::string secId;
+  std::string secLinks;
+  std::wstring secType;

Review comment:
       We shouldn't be continuing the use of the platform ambiguous `std::wstring`. Instead we should use `std::u16string` or just `std::string` with utf8 encoding. In either case the stream just needs to serialize the correct string type for the the Java side to deserialize. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545185746



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() {
+  avg20DaysVol = 0;

Review comment:
       Use initializer list rather than method body.

##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;
+
+ public:
+  PositionKey() {}
+  PositionKey(int64_t positionId) { m_positionId = positionId; }

Review comment:
       Initializer list.

##########
File path: cppcache/integration/test/PositionKey.hpp
##########
@@ -0,0 +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
+ *
+ *      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.
+ */
+
+#pragma once
+
+#ifndef POSITIONKEY_H_
+#define POSITIONKEY_H_
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableKey;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class PositionKey : public DataSerializable, public CacheableKey {
+ private:
+  int64_t m_positionId;
+
+ public:
+  PositionKey() {}

Review comment:
       Use `default`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545176282



##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::string bondRating;
+  double convRatio;
+  std::string country;
+  double valueGain;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::string secId;
+  std::string secLinks;
+  std::wstring secType;

Review comment:
       Agreed. Just ratholed on this issue for 30 minutes. Not sure this test is the right place to be testing string types. I've changed this variable to just be std::string, and serializing with readString/writeString. The corresponding Position.java code uses String and readUTF/writeUTF for all of the string variables. Doesn't break any tests.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545176603



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }
+
+Position::Position(std::string id, int32_t outstandingShares) {

Review comment:
       This doesn't compile on Windows: C3511: "a call to a delegating constructor shall be the only member-initializer". Moved variable initialization inside {}.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545136440



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell merged pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell merged pull request #714:
URL: https://github.com/apache/geode-native/pull/714


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545213373



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>

Review comment:
       Do we need `wchar.h` and `cwchar` anymore?

##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() :
+  avg20DaysVol(0),
+  convRatio(0.0),
+  valueGain(0.0),
+  industry(0),
+  issuer(0),
+  mktValue(0.0),
+  qty(0.0),
+  sharesOutstanding(0),
+  volatility(0),
+  pid(0) {}
+
+Position::Position(std::string id, int32_t outstandingShares) : Position() {
+  secId = std::move(id);
+  secType = "a";
+  sharesOutstanding = outstandingShares;
+  qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
+  mktValue = qty * 1.2345998;
+  pid = cnt++;
+}
+
+void Position::toData(apache::geode::client::DataOutput& output) const {
+  output.writeInt(avg20DaysVol);
+  output.writeString(bondRating);
+  output.writeDouble(convRatio);
+  output.writeString(country);
+  output.writeDouble(valueGain);
+  output.writeInt(industry);
+  output.writeInt(issuer);
+  output.writeDouble(mktValue);
+  output.writeDouble(qty);
+  output.writeString(secId);
+  output.writeString(secLinks);
+  output.writeString(secType);
+  output.writeInt(sharesOutstanding);
+  output.writeString(underlyer);
+  output.writeInt(volatility);
+  output.writeInt(pid);
+}
+
+void Position::fromData(apache::geode::client::DataInput& input) {
+  avg20DaysVol = input.readInt64();
+  bondRating = std::string(input.readString());
+  convRatio = input.readDouble();
+  country = std::string(input.readString());
+  valueGain = input.readDouble();
+  industry = input.readInt64();
+  issuer = input.readInt64();
+  mktValue = input.readDouble();
+  qty = input.readDouble();
+  secId = std::string(input.readString());
+  secLinks = std::string(input.readString());

Review comment:
       These reconstruction of `std::string` from `readString` seem redundant. 

##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() :
+  avg20DaysVol(0),
+  convRatio(0.0),
+  valueGain(0.0),
+  industry(0),
+  issuer(0),
+  mktValue(0.0),
+  qty(0.0),
+  sharesOutstanding(0),
+  volatility(0),
+  pid(0) {}
+
+Position::Position(std::string id, int32_t outstandingShares) : Position() {
+  secId = std::move(id);
+  secType = "a";
+  sharesOutstanding = outstandingShares;
+  qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
+  mktValue = qty * 1.2345998;
+  pid = cnt++;
+}
+
+void Position::toData(apache::geode::client::DataOutput& output) const {
+  output.writeInt(avg20DaysVol);
+  output.writeString(bondRating);
+  output.writeDouble(convRatio);
+  output.writeString(country);
+  output.writeDouble(valueGain);
+  output.writeInt(industry);
+  output.writeInt(issuer);
+  output.writeDouble(mktValue);
+  output.writeDouble(qty);
+  output.writeString(secId);
+  output.writeString(secLinks);
+  output.writeString(secType);

Review comment:
       Needs to remain `writeUTF` to match Java side.

##########
File path: cppcache/integration/test/PositionKey.cpp
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "PositionKey.hpp"
+
+#include <wchar.h>

Review comment:
       Headers?

##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() :
+  avg20DaysVol(0),
+  convRatio(0.0),
+  valueGain(0.0),
+  industry(0),
+  issuer(0),
+  mktValue(0.0),
+  qty(0.0),
+  sharesOutstanding(0),
+  volatility(0),
+  pid(0) {}
+
+Position::Position(std::string id, int32_t outstandingShares) : Position() {
+  secId = std::move(id);
+  secType = "a";
+  sharesOutstanding = outstandingShares;
+  qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
+  mktValue = qty * 1.2345998;
+  pid = cnt++;
+}
+
+void Position::toData(apache::geode::client::DataOutput& output) const {
+  output.writeInt(avg20DaysVol);
+  output.writeString(bondRating);
+  output.writeDouble(convRatio);
+  output.writeString(country);
+  output.writeDouble(valueGain);
+  output.writeInt(industry);
+  output.writeInt(issuer);
+  output.writeDouble(mktValue);
+  output.writeDouble(qty);
+  output.writeString(secId);
+  output.writeString(secLinks);
+  output.writeString(secType);
+  output.writeInt(sharesOutstanding);
+  output.writeString(underlyer);
+  output.writeInt(volatility);
+  output.writeInt(pid);
+}
+
+void Position::fromData(apache::geode::client::DataInput& input) {
+  avg20DaysVol = input.readInt64();
+  bondRating = std::string(input.readString());
+  convRatio = input.readDouble();
+  country = std::string(input.readString());
+  valueGain = input.readDouble();
+  industry = input.readInt64();
+  issuer = input.readInt64();
+  mktValue = input.readDouble();
+  qty = input.readDouble();
+  secId = std::string(input.readString());
+  secLinks = std::string(input.readString());
+  secType = input.readString();

Review comment:
       Needs to remain `readUTF` to match Java side.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545107692



##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;
+  double convRatio;
+  std::shared_ptr<CacheableString> country;
+  double delta;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::shared_ptr<CacheableString> secId;
+  std::shared_ptr<CacheableString> secLinks;
+  // wchar_t* secType;

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r544649782



##########
File path: tests/javaobject/cli/InstantiateDataSerializable.java
##########
@@ -32,15 +32,16 @@
 public class InstantiateDataSerializable extends FunctionAdapter implements Declarable{
 
 public void execute(FunctionContext context) {
-  Instantiator.register(new Instantiator(javaobject.cli.Position.class, 22) {
+
+  Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, 21) {
     public DataSerializable newInstance() {
-      return new javaobject.cli.Position();
+      return new javaobject.cli.PositionKey();
     }
   });
 
-  Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, 77) {

Review comment:
       Yes. All tests updated and pass. I had to use something other than 77, as it was causing a conflict (don't remember where). Chose 21 for PositionKey since it was unused and close to Position (22).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] codecov-io edited a comment on pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #714:
URL: https://github.com/apache/geode-native/pull/714#issuecomment-747534119


   # [Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=h1) Report
   > Merging [#714](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=desc) (28b445c) into [develop](https://codecov.io/gh/apache/geode-native/commit/4dd2ceb9ef0dd081039bad76cdb78a3a6cc0a2fd?el=desc) (4dd2ceb) will **decrease** coverage by `0.07%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/geode-native/pull/714/graphs/tree.svg?width=650&height=150&src=pr&token=plpAqoqGag)](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #714      +/-   ##
   ===========================================
   - Coverage    74.05%   73.98%   -0.08%     
   ===========================================
     Files          642      642              
     Lines        50812    50812              
   ===========================================
   - Hits         37629    37592      -37     
   - Misses       13183    13220      +37     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cppcache/src/ReadWriteLock.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1JlYWRXcml0ZUxvY2suY3Bw) | `62.50% <0.00%> (-37.50%)` | :arrow_down: |
   | [...test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvaW50ZWdyYXRpb24tdGVzdC90ZXN0VGhpbkNsaWVudFBvb2xFeGVjdXRlSEFGdW5jdGlvblByU0hPUC5jcHA=) | `91.20% <0.00%> (-3.71%)` | :arrow_down: |
   | [cppcache/src/PdxTypeRegistry.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1BkeFR5cGVSZWdpc3RyeS5jcHA=) | `77.94% <0.00%> (-2.21%)` | :arrow_down: |
   | [cppcache/src/TcrEndpoint.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RjckVuZHBvaW50LmNwcA==) | `53.94% <0.00%> (-0.85%)` | :arrow_down: |
   | [cppcache/src/TcrConnection.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RjckNvbm5lY3Rpb24uY3Bw) | `71.11% <0.00%> (-0.51%)` | :arrow_down: |
   | [cppcache/src/LRUEntriesMap.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0xSVUVudHJpZXNNYXAuY3Bw) | `60.08% <0.00%> (-0.43%)` | :arrow_down: |
   | [cppcache/src/ExecutionImpl.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0V4ZWN1dGlvbkltcGwuY3Bw) | `69.92% <0.00%> (-0.40%)` | :arrow_down: |
   | [cppcache/src/ThinClientPoolDM.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RoaW5DbGllbnRQb29sRE0uY3Bw) | `76.24% <0.00%> (-0.36%)` | :arrow_down: |
   | [cppcache/src/ThinClientRedundancyManager.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL1RoaW5DbGllbnRSZWR1bmRhbmN5TWFuYWdlci5jcHA=) | `75.58% <0.00%> (-0.32%)` | :arrow_down: |
   | [cppcache/src/ClientMetadataService.cpp](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree#diff-Y3BwY2FjaGUvc3JjL0NsaWVudE1ldGFkYXRhU2VydmljZS5jcHA=) | `65.21% <0.00%> (-0.23%)` | :arrow_down: |
   | ... and [1 more](https://codecov.io/gh/apache/geode-native/pull/714/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=footer). Last update [4dd2ceb...c8d9a76](https://codecov.io/gh/apache/geode-native/pull/714?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545108674



##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;
+  double convRatio;
+  std::shared_ptr<CacheableString> country;
+  double delta;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::shared_ptr<CacheableString> secId;
+  std::shared_ptr<CacheableString> secLinks;
+  // wchar_t* secType;
+  std::wstring secType;
+  int32_t sharesOutstanding;
+  std::shared_ptr<CacheableString> underlyer;
+  int64_t volatility;
+  int32_t pid;
+
+  inline size_t getObjectSize(const std::shared_ptr<Serializable>& obj) const {
+    return (obj == nullptr ? 0 : obj->objectSize());
+  }
+
+ public:
+  static int32_t cnt;
+
+  Position();
+  Position(const char* id, int32_t out);
+  // This constructor is just for some internal data validation test
+  explicit Position(int32_t iForExactVal);
+  ~Position() override = default;
+  void toData(DataOutput& output) const override;
+  void fromData(DataInput& input) override;
+  std::string toString() const override;
+
+  size_t objectSize() const override {

Review comment:
       Removed. Didn't realize that.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545108928



##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::shared_ptr<CacheableString> bondRating;

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545256734



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() :
+  avg20DaysVol(0),
+  convRatio(0.0),
+  valueGain(0.0),
+  industry(0),
+  issuer(0),
+  mktValue(0.0),
+  qty(0.0),
+  sharesOutstanding(0),
+  volatility(0),
+  pid(0) {}
+
+Position::Position(std::string id, int32_t outstandingShares) : Position() {
+  secId = std::move(id);
+  secType = "a";
+  sharesOutstanding = outstandingShares;
+  qty = outstandingShares - (cnt % 2 == 0 ? 1000 : 100);
+  mktValue = qty * 1.2345998;
+  pid = cnt++;
+}
+
+void Position::toData(apache::geode::client::DataOutput& output) const {
+  output.writeInt(avg20DaysVol);
+  output.writeString(bondRating);
+  output.writeDouble(convRatio);
+  output.writeString(country);
+  output.writeDouble(valueGain);
+  output.writeInt(industry);
+  output.writeInt(issuer);
+  output.writeDouble(mktValue);
+  output.writeDouble(qty);
+  output.writeString(secId);
+  output.writeString(secLinks);
+  output.writeString(secType);

Review comment:
       Good catch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545109860



##########
File path: cppcache/integration/test/PositionKey.cpp
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "PositionKey.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+void PositionKey::toData(DataOutput& output) const {
+  output.writeInt(m_positionId);
+}
+
+void PositionKey::fromData(apache::geode::client::DataInput& input) {
+  m_positionId = input.readInt64();
+}
+
+bool PositionKey::operator==(const CacheableKey& other) const {
+  return m_positionId == ((PositionKey&)other).getPositionId();
+}
+
+int PositionKey::hashcode() const {
+  int hash = 11;
+  hash = 31 * hash + (int)m_positionId;

Review comment:
       Now they match, and switched to static_cast.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545110016



##########
File path: tests/javaobject/cli/PositionKey.java
##########
@@ -26,7 +26,7 @@
   private long positionId;
 
   static {
-     Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, (byte) 77) {
+     Instantiator.register(new Instantiator(javaobject.cli.PositionKey.class, (byte) 21) {

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545256543



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>

Review comment:
       Good catch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on pull request #714:
URL: https://github.com/apache/geode-native/pull/714#issuecomment-747525361


   pivotal-jbarrett, thanks for the detailed review!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545185090



##########
File path: cppcache/integration/test/Position.hpp
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef POSITION_H
+#define POSITION_H
+
+/*
+ * @brief User class for testing the put functionality for object.
+ */
+
+#include <string>
+
+#include <geode/CacheableString.hpp>
+#include <geode/DataSerializable.hpp>
+
+namespace DataSerializableTest {
+
+using apache::geode::client::CacheableString;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+
+class Position : public DataSerializable {
+ private:
+  int64_t avg20DaysVol;
+  std::string bondRating;
+  double convRatio;
+  std::string country;
+  double valueGain;
+  int64_t industry;
+  int64_t issuer;
+  double mktValue;
+  double qty;
+  std::string secId;
+  std::string secLinks;
+  std::wstring secType;

Review comment:
       You should continue to use `writeUTF` even with `std::string` if the Java side uses `writeUTF`. This method has a very specific way of encoding strings that is non-standard. While it won't affect this test it could encourage us towards doing the wrong things in the future or worse encouraging a consumer to.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r544494013



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }
+
+Position::Position(const char* id, int32_t out) {

Review comment:
       You're right. This was just copied from the testobject folder, which is used by the old legacy framework tests. I agree to include it in the new framework tests it needs to be sanitized.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode-native] mmartell commented on a change in pull request #714: GEODE-8562: Adds new C++ test for using a class as a key

Posted by GitBox <gi...@apache.org>.
mmartell commented on a change in pull request #714:
URL: https://github.com/apache/geode-native/pull/714#discussion_r545176603



##########
File path: cppcache/integration/test/Position.cpp
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Position.hpp"
+
+#include <wchar.h>
+
+#include <cwchar>
+
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+
+namespace DataSerializableTest {
+
+int32_t Position::cnt = 0;
+
+Position::Position() { init(); }
+
+Position::Position(std::string id, int32_t outstandingShares) {

Review comment:
       Switched to this style.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org