eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ralp...@apache.org
Subject incubator-eagle git commit: Remove useless kafka adminUtil dependency; Add ignoreUnkonwProperties for models to help compatibility
Date Wed, 31 Aug 2016 10:14:58 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop a66f64cf9 -> 8de69a88d


Remove useless kafka adminUtil dependency;
Add ignoreUnkonwProperties for models to help compatibility

Author:ralphsu


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/8de69a88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/8de69a88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/8de69a88

Branch: refs/heads/develop
Commit: 8de69a88df0df12363007a47a801e71c29269953
Parents: a66f64c
Author: Ralph, Su <suliangfei@gmail.com>
Authored: Wed Aug 31 18:12:56 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Wed Aug 31 18:12:56 2016 +0800

----------------------------------------------------------------------
 .../engine/coordinator/PolicyDefinition.java    |  3 +
 .../alert/engine/coordinator/Publishment.java   |  2 +
 .../engine/coordinator/PublishmentType.java     |  2 +
 .../engine/coordinator/StreamPartition.java     |  2 +
 .../engine/coordinator/StreamSortSpec.java      |  6 +-
 .../eagle/correlation/meta/LocalKafkaTest.java  | 63 --------------------
 .../alert/engine/spout/CreateTopicUtils.java    | 23 +++----
 .../eagle/alert/engine/e2e/Integration1.java    | 21 -------
 8 files changed, 21 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
index 827172f..e2dfb6f 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
@@ -19,6 +19,7 @@ package org.apache.eagle.alert.engine.coordinator;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -29,6 +30,7 @@ import java.util.Objects;
  * @since Apr 5, 2016
  *
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class PolicyDefinition implements Serializable{
     private static final long serialVersionUID = 377581499339572414L;
     // unique identifier
@@ -157,6 +159,7 @@ public class PolicyDefinition implements Serializable{
         return false;
     }
 
+    @JsonIgnoreProperties(ignoreUnknown = true)
     public static class Definition implements Serializable{
         private static final long serialVersionUID = -622366527887848346L;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/Publishment.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/Publishment.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/Publishment.java
index b16714f..3c1da58 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/Publishment.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/Publishment.java
@@ -17,6 +17,7 @@
 package org.apache.eagle.alert.engine.coordinator;
 
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 
 import java.util.List;
 import java.util.Map;
@@ -26,6 +27,7 @@ import java.util.Objects;
  * @since Apr 11, 2016
  *
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class Publishment {
 
     private String name;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PublishmentType.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PublishmentType.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PublishmentType.java
index f34b971..a3f2356 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PublishmentType.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PublishmentType.java
@@ -21,7 +21,9 @@ package org.apache.eagle.alert.engine.coordinator;
 import java.util.Objects;
 
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class PublishmentType {
 
     private String type;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamPartition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamPartition.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamPartition.java
index 7b96024..cdf0dbf 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamPartition.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamPartition.java
@@ -22,6 +22,7 @@ import java.util.*;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 
 /**
  * StreamPartition defines how a data stream is partitioned and sorted
@@ -30,6 +31,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
  * columns are fields based on which stream is grouped
  * sortSpec defines how data is sorted
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class StreamPartition implements Serializable {
     private static final long serialVersionUID = -3361648309136926040L;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamSortSpec.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamSortSpec.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamSortSpec.java
index ee20f81..a8b57f2 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamSortSpec.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamSortSpec.java
@@ -17,15 +17,17 @@
 package org.apache.eagle.alert.engine.coordinator;
 
 
-import java.io.Serializable;
-
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.eagle.alert.utils.TimePeriodUtils;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.joda.time.Period;
 
+import java.io.Serializable;
+
 /**
  * streamId is the key
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class StreamSortSpec implements Serializable{
     private static final long serialVersionUID = 3626506441441584937L;
     private String windowPeriod="";

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/test/java/org/apache/eagle/correlation/meta/LocalKafkaTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/test/java/org/apache/eagle/correlation/meta/LocalKafkaTest.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/test/java/org/apache/eagle/correlation/meta/LocalKafkaTest.java
deleted file mode 100644
index d8bd942..0000000
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/test/java/org/apache/eagle/correlation/meta/LocalKafkaTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.eagle.correlation.meta;
-
-/*
- * 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.
- */
-import kafka.admin.AdminUtils;
-import kafka.utils.ZKStringSerializer$;
-import org.I0Itec.zkclient.ZkClient;
-import org.I0Itec.zkclient.ZkConnection;
-import org.apache.eagle.alert.utils.KafkaEmbedded;
-import org.junit.Ignore;
-
-import java.util.Properties;
-
-/**
- * @since Jun 3, 2016
- *
- */
-@Ignore
-public class LocalKafkaTest {
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-        KafkaEmbedded kafka = new KafkaEmbedded(9092, 2181);
-
-        makeSureTopic("local_kafka_topic");
-
-        while (true) {
-            try {
-                Thread.sleep(3000);
-            } catch (Exception e) {
-                break;
-            }
-        }
-
-        kafka.shutdown();
-
-    }
-
-    public static void makeSureTopic(String topic) {
-        ZkClient zkClient = new ZkClient("localhost:2181", 10000, 10000, ZKStringSerializer$.MODULE$);
-        Properties topicConfiguration = new Properties();
-        ZkConnection zkConnection = new ZkConnection("localhost:2181");
-//        ZkUtils zkUtils = new ZkUtils(zkClient, zkConnection, false);
-        AdminUtils.createTopic(zkClient, topic, 1, 1, topicConfiguration);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/CreateTopicUtils.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/CreateTopicUtils.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/CreateTopicUtils.java
index 5f43d11..22993b3 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/CreateTopicUtils.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/CreateTopicUtils.java
@@ -18,13 +18,6 @@
  */
 package org.apache.eagle.alert.engine.spout;
 
-import java.util.Properties;
-
-import kafka.admin.AdminUtils;
-import kafka.utils.ZKStringSerializer$;
-
-import org.I0Itec.zkclient.ZkClient;
-import org.I0Itec.zkclient.ZkConnection;
 import org.slf4j.Logger;
 
 /**
@@ -38,13 +31,13 @@ public class CreateTopicUtils {
     private static final int replicationFactor = 1;
 
     public static void ensureTopicReady(String zkQuorum, String topic) {
-        ZkConnection zkConnection = new ZkConnection(zkQuorum);
-        ZkClient zkClient = new ZkClient(zkQuorum, 10000, 10000, ZKStringSerializer$.MODULE$);
-//        ZkUtils zkUtils = new ZkUtils(zkClient, zkConnection, false);
-        if (!AdminUtils.topicExists(zkClient, topic)) {
-            LOG.info("create topic " + topic + " with partitions " + partitions + ", and
replicationFactor "
-                    + replicationFactor);
-            AdminUtils.createTopic(zkClient, topic, partitions, replicationFactor, new Properties());
-        }
+//        ZkConnection zkConnection = new ZkConnection(zkQuorum);
+//        ZkClient zkClient = new ZkClient(zkQuorum, 10000, 10000, ZKStringSerializer$.MODULE$);
+////        ZkUtils zkUtils = new ZkUtils(zkClient, zkConnection, false);
+//        if (!AdminUtils.topicExists(zkClient, topic)) {
+//            LOG.info("create topic " + topic + " with partitions " + partitions + ", and
replicationFactor "
+//                    + replicationFactor);
+//            AdminUtils.createTopic(zkClient, topic, partitions, replicationFactor, new
Properties());
+//        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8de69a88/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/e2e/Integration1.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/e2e/Integration1.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/e2e/Integration1.java
index d05b7ee..db8e0a2 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/e2e/Integration1.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/e2e/Integration1.java
@@ -23,11 +23,6 @@ import com.fasterxml.jackson.databind.type.CollectionType;
 import com.fasterxml.jackson.databind.type.SimpleType;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
-import kafka.admin.AdminUtils;
-import kafka.utils.ZKStringSerializer$;
-import org.I0Itec.zkclient.ZkClient;
-import org.apache.eagle.alert.config.ZKConfig;
-import org.apache.eagle.alert.config.ZKConfigBuilder;
 import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
 import org.apache.eagle.alert.coordination.model.internal.Topology;
 import org.apache.eagle.alert.engine.UnitTopologyMain;
@@ -42,7 +37,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.List;
-import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
@@ -139,21 +133,6 @@ public class Integration1 {
         }
     }
 
-    public static void makeSureTopic(String topic) {
-        System.setProperty("config.resource", SIMPLE_CONFIG);
-        ConfigFactory.invalidateCaches();
-        Config config = ConfigFactory.load();
-        ZKConfig zkconfig = ZKConfigBuilder.getZKConfig(config);
-
-        ZkClient zkClient = new ZkClient(zkconfig.zkQuorum, 10000, 10000, ZKStringSerializer$.MODULE$);
-        Properties topicConfiguration = new Properties();
-//        ZkUtils zkUtils = new ZkUtils(zkClient, zkConnection, false);
-        AdminUtils.createTopic(zkClient, topic, 1, 1, topicConfiguration);// RackAwareMode.Disabled$.MODULE$);
-
-        AdminUtils.createTopic(zkClient, topic, 1, 1, topicConfiguration);
-
-    }
-
     public static void proactive_schedule(Config config) throws Exception {
         try (CoordinatorClient cc = new CoordinatorClient(config)) {
             try {


Mime
View raw message