Package org.sonatype.nexus.test.utils

Examples of org.sonatype.nexus.test.utils.UserMessageUtil


  private void init()
      throws ComponentLookupException
  {
    XStream xstream = this.getXMLXStream();

    this.userUtil = new UserMessageUtil(xstream, MediaType.APPLICATION_XML);
    this.roleUtil = new RoleMessageUtil(xstream, MediaType.APPLICATION_XML);
    this.privUtil = new PrivilegesMessageUtil(xstream, MediaType.APPLICATION_XML);
    this.targetUtil = new TargetMessageUtil(xstream, MediaType.APPLICATION_XML);
    TestContainer.getInstance().getTestContext().setSecureTest(true);
    this.routeUtil = new RoutesMessageUtil(xstream, MediaType.APPLICATION_XML);
View Full Code Here


        // set security enabled/disabled as expected by current IT
        final boolean testRequiresSecurityEnabled =
            TestContainer.getInstance().getTestContext().isSecureTest()
                || Boolean.valueOf(System.getProperty("secure.test"));
        new UserMessageUtil(getXMLXStream(), MediaType.APPLICATION_XML)
            .makeAnonymousAdministrator(!testRequiresSecurityEnabled);

        // deploy artifacts
        deployArtifacts();
View Full Code Here

  protected void installUsingP2(final String repositoryURL, final String installIU, final String destination,
                                final Map<String, String> sysProps)
      throws Exception
  {
    UserMessageUtil userUtil = new UserMessageUtil(getXMLXStream(), MediaType.APPLICATION_XML);
    boolean wasAnonymousAdministrator = userUtil.isAnonymousAdministrator();

    try {
      userUtil.makeAnonymousAdministrator(true);

      FileUtils.deleteDirectory(new File(destination));

      String tempDirPath = System.getProperty("maven.test.tmpdir", System.getProperty("java.io.tmpdir"));
      File testDir = new File(tempDirPath, getTestId() + "/run-p2/" + System.currentTimeMillis());

      FileUtils.deleteDirectory(testDir);

      final File basedir = ResourceExtractor.extractResourcePath(getClass(), "/run-p2", testDir, false);

      final Verifier verifier = new Verifier(basedir.getAbsolutePath());

      verifier.setLocalRepo(new File(TestContainer.getBasedir(), "target/maven/fake-repo").getAbsolutePath());

      verifier.setSystemProperty("org.eclipse.ecf.provider.filetransfer.retrieve.readTimeout", "30000");
      verifier.setSystemProperty("p2.installIU", installIU);
      verifier.setSystemProperty("p2.destination", destination);
      verifier.setSystemProperty("p2.metadataRepository", repositoryURL);
      verifier.setSystemProperty("p2.artifactRepository", repositoryURL);
      verifier.setSystemProperty("p2.profile", getTestId());

      if (sysProps != null) {
        for (Map.Entry<String, String> entry : sysProps.entrySet()) {
          verifier.setSystemProperty(entry.getKey(), entry.getValue());
        }
      }

      verifier.setLogFileName(getTestId() + "-maven-output.log");
      verifier.addCliOption("-X");
      verifier.executeGoals(Arrays.asList("verify"));
      verifier.verifyErrorFreeLog();
      verifier.resetStreams();

      FileUtils.deleteDirectory(testDir);
    }
    finally {
      userUtil.makeAnonymousAdministrator(wasAnonymousAdministrator);
    }
  }
View Full Code Here

  @Test
  public void checkUsers()
      throws Exception
  {
    List<UserResource> users = new UserMessageUtil(null, null).getList();
    Assert.assertFalse("No itens to be tested", users.isEmpty());

    for (UserResource user : users) {
      Assert.assertTrue("User '" + user.getUserId()
          + "' uri do not start with baseUrl.  Expected: " + baseUrl + ", but got: " + user.getResourceURI(),
View Full Code Here

  }

  @Before
  public void init() {
    userUtil =
        new UserMessageUtil(this.getJsonXStream(), MediaType.APPLICATION_JSON);
  }
View Full Code Here

  private RoleMessageUtil roleUtil;

  @Before
  public void init() {
    this.userUtil = new UserMessageUtil(XStreamFactory.getXmlXStream(), MediaType.APPLICATION_XML);
    this.roleUtil = new RoleMessageUtil(XStreamFactory.getXmlXStream(), MediaType.APPLICATION_XML);
  }
View Full Code Here

  }

  private UserResource disableUser(String userId)
      throws IOException
  {
    UserMessageUtil util = new UserMessageUtil(this.getXMLXStream(), MediaType.APPLICATION_XML);
    return util.disableUser(userId);
  }
View Full Code Here

public class Nexus142UserCrudXmlIT
    extends Nexus142UserCrudJsonIT
{

  public Nexus142UserCrudXmlIT() {
    this.messageUtil = new UserMessageUtil(this.getXMLXStream(), MediaType.APPLICATION_XML);
  }
View Full Code Here

    TestContainer.getInstance().getTestContext().setSecureTest(true);
  }

  @Before
  public void setUp() {
    this.messageUtil = new UserMessageUtil(this.getJsonXStream(), MediaType.APPLICATION_JSON);
  }
View Full Code Here

  @Test
  public void getUserTestWithSource()
      throws IOException
  {

    UserMessageUtil userUtil = new UserMessageUtil(this.getJsonXStream(), MediaType.APPLICATION_JSON);
    PlexusUserResource user = userUtil.getPlexusUser("default", "admin");
    Assert.assertEquals(user.getUserId(), "admin");
    Assert.assertEquals(user.getEmail(), "changeme@yourcompany.com");
    Assert.assertEquals(user.getFirstName(), "Administrator");
    Assert.assertEquals(user.getSource(), "default");
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.test.utils.UserMessageUtil

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.