[GitHub] mgodave commented on a change in pull request #1551: Json schema codec

2018-04-12 Thread GitBox
mgodave commented on a change in pull request #1551: Json schema codec
URL: https://github.com/apache/incubator-pulsar/pull/1551#discussion_r181219020
 
 

 ##
 File path: 
pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleTypedProducerConsumerTest.java
 ##
 @@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.client.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.Sets;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import org.apache.pulsar.client.impl.schema.JSONSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class SimpleTypedProducerConsumerTest extends ProducerConsumerBase {
+private static final Logger log = 
LoggerFactory.getLogger(SimpleTypedProducerConsumerTest.class);
+
+@BeforeMethod
+@Override
+protected void setup() throws Exception {
+super.internalSetup();
+super.producerBaseSetup();
+}
+
+@AfterMethod
+@Override
+protected void cleanup() throws Exception {
+super.internalCleanup();
+}
+
+public static class JsonEncodedPojo {
+private String message;
+
+public JsonEncodedPojo() {
+}
+
+public JsonEncodedPojo(String message) {
+this.message = message;
+}
+
+public String getMessage() {
+return message;
+}
+
+public void setMessage(String message) {
+this.message = message;
+}
+
+@Override
+public boolean equals(Object o) {
+if (this == o) {
+return true;
+}
+if (o == null || getClass() != o.getClass()) {
+return false;
+}
+JsonEncodedPojo that = (JsonEncodedPojo) o;
+return Objects.equals(message, that.message);
+}
+
+@Override
+public int hashCode() {
+return Objects.hash(message);
+}
+
+@Override
+public String toString() {
+return MoreObjects.toStringHelper(this)
+.add("message", message)
+.toString();
+}
+}
+
+@Test
+public void testJsonProducerAndConsumer() throws Exception {
 
 Review comment:
   Is this necessary? We have these tests without typing, what is different 
about these tests besides the schema? Could the differences be tested at a 
different level, ie, not having to instantiate a client/server 
producer/consumer just to test (schema name of a partitioned topic is one that 
comes to mind)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mgodave commented on a change in pull request #1551: Json schema codec

2018-04-12 Thread GitBox
mgodave commented on a change in pull request #1551: Json schema codec
URL: https://github.com/apache/incubator-pulsar/pull/1551#discussion_r181219020
 
 

 ##
 File path: 
pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleTypedProducerConsumerTest.java
 ##
 @@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.client.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.Sets;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import org.apache.pulsar.client.impl.schema.JSONSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class SimpleTypedProducerConsumerTest extends ProducerConsumerBase {
+private static final Logger log = 
LoggerFactory.getLogger(SimpleTypedProducerConsumerTest.class);
+
+@BeforeMethod
+@Override
+protected void setup() throws Exception {
+super.internalSetup();
+super.producerBaseSetup();
+}
+
+@AfterMethod
+@Override
+protected void cleanup() throws Exception {
+super.internalCleanup();
+}
+
+public static class JsonEncodedPojo {
+private String message;
+
+public JsonEncodedPojo() {
+}
+
+public JsonEncodedPojo(String message) {
+this.message = message;
+}
+
+public String getMessage() {
+return message;
+}
+
+public void setMessage(String message) {
+this.message = message;
+}
+
+@Override
+public boolean equals(Object o) {
+if (this == o) {
+return true;
+}
+if (o == null || getClass() != o.getClass()) {
+return false;
+}
+JsonEncodedPojo that = (JsonEncodedPojo) o;
+return Objects.equals(message, that.message);
+}
+
+@Override
+public int hashCode() {
+return Objects.hash(message);
+}
+
+@Override
+public String toString() {
+return MoreObjects.toStringHelper(this)
+.add("message", message)
+.toString();
+}
+}
+
+@Test
+public void testJsonProducerAndConsumer() throws Exception {
 
 Review comment:
   Is this necessary? We have these tests without typing, what is different 
about these tests besides the schema? Could the differences be tested at a 
different level (schema name of a partitioned topic is one that comes to mind)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services