Package org.apache.sentry.core.model.search

Examples of org.apache.sentry.core.model.search.Collection


public class TestSearchModelAuthorizables {

  @Test
  public void testServer() throws Exception {
    Collection coll = (Collection)SearchModelAuthorizables.from("CoLleCtiOn=collection1");
    assertEquals("collection1", coll.getName());
  }
View Full Code Here


  }

  @Test
  public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Collection collection1 = new Collection("collection1");
    Set<? extends Action> actions = EnumSet.allOf(SearchModelAction.class);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
      .addRolesToGroup("group1",  true, "role1", "role1")
      .addPermissionsToRole("role1", true, "collection=" + collection1.getName(),
          "collection=" + collection1.getName());
    policyFile.write(iniFile);
    SearchPolicyFileBackend policy = new SearchPolicyFileBackend(initResource);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(collection1);
    Assert.assertTrue(authorizableHierarchy.toString(),
View Full Code Here

  public void testNoCollection() throws Exception {
     SolrAuthzConf solrAuthzConf =
       new SolrAuthzConf(Resources.getResource("sentry-site.xml"));
     setUsableAuthzConf(solrAuthzConf);
     SolrAuthzBinding binding = new SolrAuthzBinding(solrAuthzConf);
     expectAuthException(binding, corporal1, new Collection("bogus"), querySet);
  }
View Full Code Here

    append("[roles]", globalPolicyFile);
    append("malicious_role = action=query", globalPolicyFile);
    PolicyEngine policy = new SearchPolicyFileBackend(globalPolicyFile.getPath());
    ImmutableSet<String> permissions = policy.getPermissions(
        Arrays.asList(new Authorizable[] {
            new Collection("collection1"),
    }), Lists.newArrayList("group")).get("group");
    Assert.assertTrue(permissions.toString(), permissions.isEmpty());
  }
View Full Code Here

public class TestCollection {

  @Test
  public void testSimple() {
    String name = "simple";
    Collection simple = new Collection(name);
    Assert.assertEquals(simple.getName(), name);
  }
View Full Code Here

    Assert.assertEquals(simple.getName(), name);
  }

  @Test
  public void testCollectionAuthzType() {
    Collection collection1 = new Collection("collection1");
    Collection collection2 = new Collection("collection2");
    Assert.assertEquals(collection1.getAuthzType(), collection2.getAuthzType());
    Assert.assertEquals(collection1.getTypeName(), collection2.getTypeName());
  }
View Full Code Here

  }

  // just test it doesn't throw NPE
  @Test
  public void testNullCollection() {
    Collection nullCollection = new Collection(null);
    nullCollection.getName();
    nullCollection.toString();
    nullCollection.getAuthzType();
    nullCollection.getTypeName();
  }
View Full Code Here

public class TestSearchModelAuthorizables {

  @Test
  public void testServer() throws Exception {
    Collection coll = (Collection)SearchModelAuthorizables.from("CoLleCtiOn=collection1");
    assertEquals("collection1", coll.getName());
  }
View Full Code Here

  }

  @Test
  public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Collection collection1 = new Collection("collection1");
    Set<? extends Action> actions = EnumSet.allOf(SearchModelAction.class);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
      .addRolesToGroup("group1",  true, "role1", "role1")
      .addPermissionsToRole("role1", true, "collection=" + collection1.getName(),
          "collection=" + collection1.getName());
    policyFile.write(iniFile);
    SearchPolicyFileBackend policy = new SearchPolicyFileBackend(initResource);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(collection1);
    Assert.assertTrue(authorizableHierarchy.toString(),
View Full Code Here

  public void testNoCollection() throws Exception {
     SolrAuthzConf solrAuthzConf =
       new SolrAuthzConf(Resources.getResource("sentry-site.xml"));
     setUsableAuthzConf(solrAuthzConf);
     SolrAuthzBinding binding = new SolrAuthzBinding(solrAuthzConf);
     expectAuthException(binding, corporal1, new Collection("bogus"), querySet);
  }
View Full Code Here

TOP

Related Classes of org.apache.sentry.core.model.search.Collection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.