Example #1
0
 public static InstanceInfo newInstanceInfo(int index) {
   Iterator<InstanceInfo> instanceGenerator =
       InstanceInfoGenerator.newBuilder(10, 10).withMetaData(true).build().serviceIterator();
   // Skip to the requested index
   for (int i = 0; i < index; i++) {
     instanceGenerator.next();
   }
   return instanceGenerator.next();
 }
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    InstanceInfoGenerator instanceInfos = InstanceInfoGenerator.newBuilder(6, 1).build();
    testApplication = instanceInfos.toApplications().getRegisteredApplications().get(0);

    applicationResource =
        new ApplicationResource(
            testApplication.getName(),
            serverContext.getServerConfig(),
            serverContext.getRegistry());

    for (InstanceInfo instanceInfo : testApplication.getInstances()) {
      registry.register(instanceInfo, false);
    }
  }