Exemplo n.º 1
0
 @Test
 public void testLocalChildCreation() throws Exception {
   System.err.println(executeCommand("fabric:create -n"));
   Set<Container> containers =
       ContainerBuilder.create()
           .withName("esb")
           .withProfiles("jboss-fuse-minimal")
           .assertProvisioningResult()
           .build();
 }
Exemplo n.º 2
0
  @Test
  public void testUpload() throws Exception {
    String featureLocation = System.getProperty("feature.location");
    System.out.println("Testing with feature from:" + featureLocation);
    System.err.println(executeCommand("fabric:create -n"));
    Set<Container> containers =
        ContainerBuilder.create(2)
            .withName("maven")
            .withProfiles("fabric")
            .assertProvisioningResult()
            .build();

    FabricService fabricService = getFabricService();
    IZKClient zookeeper = getZookeeper();
    List<String> children = zookeeper.getChildren(ZkPath.MAVEN_PROXY.getPath("upload"));
    List<String> uploadUrls = new ArrayList<String>();
    for (String child : children) {
      String uploadeUrl =
          ZooKeeperUtils.getSubstitutedPath(
              zookeeper, ZkPath.MAVEN_PROXY.getPath("upload") + "/" + child);
      uploadUrls.add(uploadeUrl);
    }
    // Pick a random maven proxy from the list.
    Random random = new Random();
    int index = random.nextInt(uploadUrls.size());
    String targetUrl = uploadUrls.get(index);

    String uploadUrl = targetUrl + "itest/itest/1.0/itest-1.0-features.xml";
    System.out.println("Using URI: " + uploadUrl);
    DefaultHttpClient client = new DefaultHttpClient();
    HttpPut put = new HttpPut(uploadUrl);
    client
        .getCredentialsProvider()
        .setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "admin"));

    FileNIOEntity entity = new FileNIOEntity(new File(featureLocation), "text/xml");
    put.setEntity(entity);
    HttpResponse response = client.execute(put);
    System.err.println("Response:" + response.getStatusLine());
    Assert.assertTrue(
        response.getStatusLine().getStatusCode() == 200
            || response.getStatusLine().getStatusCode() == 202);

    System.err.println(
        executeCommand(
            "fabric:profile-edit --repositories mvn:itest/itest/1.0/xml/features default"));
    System.err.println(executeCommand("fabric:profile-edit --features example-cbr default"));
    Provision.waitForContainerStatus(containers, PROVISION_TIMEOUT);
  }
Exemplo n.º 3
0
 @After
 public void tearDown() throws InterruptedException {
   ContainerBuilder.destroy();
 }