Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CD600200AE4 for ; Fri, 10 Jun 2016 03:29:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CBF3E160A59; Fri, 10 Jun 2016 01:29:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EB07A160A58 for ; Fri, 10 Jun 2016 03:29:30 +0200 (CEST) Received: (qmail 19333 invoked by uid 500); 10 Jun 2016 01:29:30 -0000 Mailing-List: contact commits-help@eagle.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.incubator.apache.org Delivered-To: mailing list commits@eagle.incubator.apache.org Received: (qmail 19324 invoked by uid 99); 10 Jun 2016 01:29:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2016 01:29:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B56CA180597 for ; Fri, 10 Jun 2016 01:29:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id aJWjsrkBioMt for ; Fri, 10 Jun 2016 01:29:28 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id BC4485F1BE for ; Fri, 10 Jun 2016 01:29:27 +0000 (UTC) Received: (qmail 19303 invoked by uid 99); 10 Jun 2016 01:29:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2016 01:29:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 00655DFE59; Fri, 10 Jun 2016 01:29:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yonzhang2012@apache.org To: commits@eagle.incubator.apache.org Date: Fri, 10 Jun 2016 01:29:26 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/7] incubator-eagle git commit: EAGLE-334 clean user profile code clean user profile code in Eagle 0.5 and redesign in Eagle 0.6 archived-at: Fri, 10 Jun 2016 01:29:32 -0000 Repository: incubator-eagle Updated Branches: refs/heads/develop eef4930c3 -> 8b646715e http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8b646715/eagle-security/eagle-security-userprofile/training/src/test/java/org/apache/eagle/security/userprofile/model/UserProfileKDEModelerTest.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-userprofile/training/src/test/java/org/apache/eagle/security/userprofile/model/UserProfileKDEModelerTest.java b/eagle-security/eagle-security-userprofile/training/src/test/java/org/apache/eagle/security/userprofile/model/UserProfileKDEModelerTest.java deleted file mode 100644 index 89f7386..0000000 --- a/eagle-security/eagle-security-userprofile/training/src/test/java/org/apache/eagle/security/userprofile/model/UserProfileKDEModelerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.eagle.security.userprofile.model; - -import org.apache.eagle.security.userprofile.model.kde.UserProfileKDEModeler; -import org.apache.commons.math3.linear.Array2DRowRealMatrix; -import org.apache.commons.math3.linear.RealMatrix; -import org.junit.Assert; - -public class UserProfileKDEModelerTest { - - @org.junit.Test - public void testBuild() throws Exception { - UserProfileKDEModeler modeler = new UserProfileKDEModeler(); - String user = "user1"; - final RealMatrix mockMatrix = new Array2DRowRealMatrix(buildMockData()); - scala.collection.immutable.List testStatistics = modeler.build("default",user, mockMatrix); - Assert.assertEquals(testStatistics.length(), 1); - UserProfileKDEModel model = testStatistics.head(); - Assert.assertEquals(model.user(), "user1"); - Assert.assertEquals(model.statistics().length, mockMatrix.getColumnDimension()); - Assert.assertEquals(-36, model.minProbabilityEstimate(), 1.0); - Assert.assertEquals(-37, model.maxProbabilityEstimate(), 1.0); - Assert.assertEquals(-37, model.nintyFivePercentileEstimate(), 1.0); - Assert.assertEquals(-37, model.medianProbabilityEstimate(), 1.0); - Assert.assertEquals(true, model.statistics()[3].isLowVariant()); - Assert.assertEquals(false, model.statistics()[0].isLowVariant()); - Assert.assertEquals("setTimes", model.statistics()[3].getCommandName()); - Assert.assertEquals("getfileinfo", model.statistics()[0].getCommandName()); - } - - private double[][] buildMockData(){ - double[][] mockData = new double[][]{ - {114503.0,2.8820906E7,123618.0,0.0,64.0,15772.0,186.0,24296.0,12.0,9.0,32.0}, - {53300.0,390772.0,157626.0,0.0,67.0,10501.0,226.0,8567.0,14.0,0.0,12.0}, - {25659.0,140858.0,35731.0,0.0,169.0,1619.0,520.0,2965.0,34.0,0.0,34.0} - }; - return mockData; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8b646715/eagle-security/eagle-security-userprofile/training/src/test/scala/org/apache/eagle/security/userprofile/daemon/UtilsSpec.scala ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-userprofile/training/src/test/scala/org/apache/eagle/security/userprofile/daemon/UtilsSpec.scala b/eagle-security/eagle-security-userprofile/training/src/test/scala/org/apache/eagle/security/userprofile/daemon/UtilsSpec.scala deleted file mode 100644 index 18ef625..0000000 --- a/eagle-security/eagle-security-userprofile/training/src/test/scala/org/apache/eagle/security/userprofile/daemon/UtilsSpec.scala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.eagle.security.userprofile.daemon - -import org.apache.eagle.common.DateTimeUtil -import org.joda.time.Period -import org.scalatest._ - -/** - * @since 9/2/15 - */ -class UtilsSpec extends FlatSpec with Matchers{ - import org.apache.eagle.security.userprofile.daemon.Utils._ - - it should "formatPathWithMilliseconds " in { - formatPathWithMilliseconds("/tmp/path/to/log.${yyyy-MM-dd-hh}.gz")(DateTimeUtil.humanDateToMilliseconds("2015-09-02 10:32:17,000")) should be ("/tmp/path/to/log.2015-09-02-10.gz") - formatPathWithMilliseconds("/tmp/path/to/${yyyy-MM-dd}/*.tar.gz")(DateTimeUtil.humanDateToMilliseconds("2015-09-02 10:32:17,000")) should be ("/tmp/path/to/2015-09-02/*.tar.gz") - formatPathWithMilliseconds("/tmp/path/to/${yyyy-MM-dd}/${yyyy-MM-dd-hh}.tar.gz")(DateTimeUtil.humanDateToMilliseconds("2015-09-02 10:32:17,000")) should be ("/tmp/path/to/2015-09-02/2015-09-02-10.tar.gz") - } - - it should "formatPathsInDuration" in { - val pathes:Seq[String] = formatPathsInDuration("/tmp/path/to/log.${yyyy-MM-dd-hh}.gz",DateTimeUtil.humanDateToMilliseconds("2015-09-02 10:32:17,000"),Period.parse("P30D")) - //pathes.length should be (30 * 24) - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8b646715/eagle-security/pom.xml ---------------------------------------------------------------------- diff --git a/eagle-security/pom.xml b/eagle-security/pom.xml index e1a6b6f..6b9a7af 100644 --- a/eagle-security/pom.xml +++ b/eagle-security/pom.xml @@ -35,7 +35,6 @@ eagle-security-common eagle-security-hdfs-auditlog eagle-security-maprfs-auditlog - eagle-security-userprofile eagle-security-hive eagle-security-hive-web eagle-security-hdfs-web