コード例 #1
0
  /** Create applications and infrastructures to associate the tasks with. */
  @Before
  public final void prepareApplication() {
    infras = new LinkedList<>();
    for (int i = 0; i < 1 + (int) TestDataIT.MAX_ENTITIES_IN_LIST * Math.random(); i++) {
      Entity<Infrastructure> infraEntity =
          Entity.entity(TestDataIT.createInfrastructure(), Constants.INDIGOMIMETYPE);
      Response rs =
          target("/v1.0/infrastructures").request(Constants.INDIGOMIMETYPE).post(infraEntity);
      infras.add(rs.readEntity(Infrastructure.class).getId());
    }

    apps = new LinkedList<>();
    for (int i = 0; i < 1 + (int) TestDataIT.MAX_ENTITIES_IN_LIST * Math.random(); i++) {
      Application app = TestDataIT.createApplication();
      app.setInfrastructureIds(infras);
      Entity<Application> appEntity = Entity.entity(app, Constants.INDIGOMIMETYPE);
      Response rs = target("/v1.0/applications").request(Constants.INDIGOMIMETYPE).post(appEntity);
      apps.add(rs.readEntity(Application.class).getId());
    }
  }