You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by gc...@apache.org on 2015/02/12 23:45:37 UTC

incubator-sentry git commit: SENTRY-653: Add simple Indexer model object test for sentry-core-model-indexer

Repository: incubator-sentry
Updated Branches:
  refs/heads/master 1190a792b -> 155d8d630


SENTRY-653: Add simple Indexer model object test for sentry-core-model-indexer


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/155d8d63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/155d8d63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/155d8d63

Branch: refs/heads/master
Commit: 155d8d630b3e369b2563edd0ec0ffca7fce6cc45
Parents: 1190a79
Author: Gregory Chanan <gc...@cloudera.com>
Authored: Thu Feb 12 13:12:29 2015 -0800
Committer: Gregory Chanan <gc...@cloudera.com>
Committed: Thu Feb 12 13:12:29 2015 -0800

----------------------------------------------------------------------
 .../apache/sentry/core/indexer/TestIndexer.java | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/155d8d63/sentry-core/sentry-core-model-indexer/src/test/java/org/apache/sentry/core/indexer/TestIndexer.java
----------------------------------------------------------------------
diff --git a/sentry-core/sentry-core-model-indexer/src/test/java/org/apache/sentry/core/indexer/TestIndexer.java b/sentry-core/sentry-core-model-indexer/src/test/java/org/apache/sentry/core/indexer/TestIndexer.java
new file mode 100644
index 0000000..843fd82
--- /dev/null
+++ b/sentry-core/sentry-core-model-indexer/src/test/java/org/apache/sentry/core/indexer/TestIndexer.java
@@ -0,0 +1,50 @@
+package org.apache.sentry.core.indexer;
+/*
+ * 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 junit.framework.Assert;
+
+import org.apache.sentry.core.model.indexer.Indexer;
+import org.junit.Test;
+
+public class TestIndexer {
+
+  @Test
+  public void testSimple() {
+    String name = "simple";
+    Indexer simple = new Indexer(name);
+    Assert.assertEquals(simple.getName(), name);
+  }
+
+  @Test
+  public void testIndexerAuthzType() {
+    Indexer indexer1 = new Indexer("indexer1");
+    Indexer indexer2 = new Indexer("indexer2");
+    Assert.assertEquals(indexer1.getAuthzType(), indexer2.getAuthzType());
+    Assert.assertEquals(indexer1.getTypeName(), indexer2.getTypeName());
+  }
+
+  // just test it doesn't throw NPE
+  @Test
+  public void testNullIndexer() {
+    Indexer nullIndexer = new Indexer(null);
+    nullIndexer.getName();
+    nullIndexer.toString();
+    nullIndexer.getAuthzType();
+    nullIndexer.getTypeName();
+  }
+}