Package org.sonatype.nexus.client.core.subsystem.security

Examples of org.sonatype.nexus.client.core.subsystem.security.Privilege


  }

  @Test
  public void getPrivilege() {
    // admin privilege
    final Privilege privilege = privileges().get("1000");
    assertThat(privilege, is(not(nullValue())));
    assertThat(privilege.name(), containsString("Administrator"));
  }
View Full Code Here


  }

  @Test
  public void createPrivilege() {
    final String targetId = createRepoTarget("createPrivileges").id();
    final Privilege saved = privileges().create()
        .withName("foo")
        .withDescription("bar")
        .withMethods("read")
        .withRepositoryGroupId("public")
        .withTargetId(targetId)
        .create().iterator().next();

    final Privilege privilege = privileges().get(saved.id());
    assertThat(privilege, is(notNullValue()));
    assertThat(privilege.description(), is("bar"));

    // name is mangled on creation - "$name - ($method)"
    assertThat(privilege.name(), is(saved.name()));

    assertThat(privilege.methods(), contains("read"));
    assertThat(privilege.repositoryGroupId(), is("public"));
    assertThat(privilege.targetId(), is(targetId));
  }
View Full Code Here

  }

  @Test(expected = IllegalStateException.class)
  public void refuseCreateAlreadyExistingPrivilege() {
    final String targetId = createRepoTarget("refuseCreatePrivileges").id();
    final Privilege saved = privileges().create()
        .withName("foo")
        .withDescription("bar")
        .withMethods("read")
        .withRepositoryGroupId("public")
        .withTargetId(targetId)
        .create().iterator().next();

    saved.create();
  }
View Full Code Here

  }

  @Test(expected = UnsupportedOperationException.class)
  public void unsupportedUpdatePrivilege() {
    final String targetId = createRepoTarget("unsupportedUpdatePrivileges").id();
    final Privilege saved = privileges().create()
        .withName("foo")
        .withDescription("bar")
        .withMethods("read")
        .withRepositoryGroupId("public")
        .withTargetId(targetId)
        .create().iterator().next();

    saved.save();
  }
View Full Code Here

  }

  @Test(expected = NexusClientNotFoundException.class)
  public void deletePrivilege() {
    final String targetId = createRepoTarget("deletePrivileges").id();
    final Privilege saved = privileges().create()
        .withName("foo")
        .withDescription("bar")
        .withMethods("read")
        .withRepositoryGroupId("public")
        .withTargetId(targetId)
        .create().iterator().next();

    saved.remove();

    privileges().get(saved.id());
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.client.core.subsystem.security.Privilege

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.