コード例 #1
0
 @Test(groups = "unit", expectedExceptions = RuntimeException.class)
 public void getMetadatasException() throws RemoteException {
   EasyMock.expect(
           authorizationProvider.canDownloadAll(
               EasyMock.aryEq(new String[] {fileId, fileId2}), EasyMock.eq(gridId)))
       .andReturn(false);
   mockObjects.replay();
   service.getFileMetadata(Lists.newArrayList(fileId, fileId2), gridId);
 }
コード例 #2
0
  @Test
  public void testStartInvalidDBSchema() throws Exception {
    EasyMock.expect(engineController.isEngineRunning()).andReturn(false);
    serverConfigurator.configure();
    EasyMock.expect(embeddedDatabaseController.shouldUse()).andReturn(true);
    EasyMock.expect(embeddedDatabaseController.startBuiltInDB()).andReturn(true);
    EasyMock.expect(
            processManager.executeProcess(
                EasyMock.aryEq(
                        new String[] {
                          System.getProperty("java.home") + "/bin/java",
                          "-cp",
                          serverHome + "/lib/ant-launcher-1.7.1.jar",
                          "-Dserver.home=" + serverHome,
                          "-Dant.home=" + serverHome,
                          "-Dtomcat.home=" + engineHome + "/hq-server",
                          "-Dlog4j.configuration="
                              + new File(serverHome + "/conf/log4j.xml").toURI().toURL().toString(),
                          "org.apache.tools.ant.launch.Launcher",
                          "-q",
                          "-lib",
                          serverHome + "/lib",
                          "-listener",
                          "org.apache.tools.ant.listener.Log4jListener",
                          "-buildfile",
                          serverHome + "/data/db-upgrade.xml",
                          "upgrade"
                        }),
                    EasyMock.eq(serverHome),
                EasyMock.eq(true), EasyMock.eq(HQServer.DB_UPGRADE_PROCESS_TIMEOUT)))
        .andReturn(0);
    EasyMock.expect(dataSource.getConnection()).andReturn(connection);
    EasyMock.expect(connection.createStatement()).andReturn(statement);
    EasyMock.expect(
            statement.executeQuery(
                "select propvalue from EAM_CONFIG_PROPS "
                    + "WHERE propkey = '"
                    + HQConstants.SchemaVersion
                    + "'"))
        .andReturn(resultSet);
    EasyMock.expect(resultSet.next()).andReturn(true);
    EasyMock.expect(resultSet.getString("propvalue")).andReturn(HQConstants.SCHEMA_MOD_IN_PROGRESS);
    connection.close();
    resultSet.close();
    statement.close();
    replay();
    server.start();
    verify();

    // Ensure that the embeddedDatabaseController mock expects the stopBuiltInDb during JVM
    // shutdown.
    this.teardownCallback = shutdownHookConfiguratorCallback;
  }
コード例 #3
0
  @Test
  public void testStartErrorVerifyingSchema() throws Exception {
    EasyMock.expect(engineController.isEngineRunning()).andReturn(false);
    serverConfigurator.configure();
    EasyMock.expect(embeddedDatabaseController.shouldUse()).andReturn(true);
    EasyMock.expect(embeddedDatabaseController.startBuiltInDB()).andReturn(true);
    EasyMock.expect(
            processManager.executeProcess(
                EasyMock.aryEq(
                        new String[] {
                          System.getProperty("java.home") + "/bin/java",
                          "-cp",
                          serverHome + "/lib/ant-launcher-1.7.1.jar",
                          "-Dserver.home=" + serverHome,
                          "-Dant.home=" + serverHome,
                          "-Dtomcat.home=" + engineHome + "/hq-server",
                          "-Dlog4j.configuration="
                              + new File(serverHome + "/conf/log4j.xml").toURI().toURL().toString(),
                          "org.apache.tools.ant.launch.Launcher",
                          "-q",
                          "-lib",
                          serverHome + "/lib",
                          "-listener",
                          "org.apache.tools.ant.listener.Log4jListener",
                          "-buildfile",
                          serverHome + "/data/db-upgrade.xml",
                          "upgrade"
                        }),
                    EasyMock.eq(serverHome),
                EasyMock.eq(true), EasyMock.eq(HQServer.DB_UPGRADE_PROCESS_TIMEOUT)))
        .andReturn(0);
    EasyMock.expect(dataSource.getConnection()).andThrow(new SQLException(EXPECTED_EXCEPTION_MSG));
    /*Properties testProps = new Properties();
    testProps.put("server.java.opts", "-XX:MaxPermSize=192m -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError");
    testProps.put("server.webapp.port", "7080");
    final List<String> expectedOpts = new ArrayList<String>();
    expectedOpts.add("-XX:MaxPermSize=192m");
    expectedOpts.add("-Xmx512m");
    expectedOpts.add("-Xms512m");
    expectedOpts.add("-XX:+HeapDumpOnOutOfMemoryError");
    expectedOpts.add("-Dserver.home=" + serverHome);
    EasyMock.expect(serverConfigurator.getServerProps()).andReturn(testProps);
    org.easymock.classextension.EasyMock.expect(osInfo.getName()).andReturn("Mac OS X");
    EasyMock.expect(engineController.start(expectedOpts)).andReturn(0);*/
    replay();
    server.start();
    verify();

    // Ensure that the embeddedDatabaseController mock expects the stopBuiltInDb during JVM
    // shutdown.
    this.teardownCallback = shutdownHookConfiguratorCallback;
  }
コード例 #4
0
 @Test(groups = "unit")
 public void getMetadatas() {
   EasyMock.expect(
           authorizationProvider.canDownloadAll(
               EasyMock.aryEq(new String[] {fileId, fileId2}), EasyMock.eq(gridId)))
       .andReturn(true);
   EasyMock.expect(accessProvider.getFileMetadata(fileId)).andReturn(new FileMetadata(13L, 12L));
   EasyMock.expect(accessProvider.getFileMetadata(fileId2)).andReturn(new FileMetadata(14L, 11L));
   mockObjects.replay();
   final List<FileMetadata> metadatas =
       service.getFileMetadata(Lists.newArrayList(fileId, fileId2), gridId);
   assert metadatas.get(0).getLength() == 12L;
   assert metadatas.get(1).getLength() == 11L;
 }
 // @Test
 public void testStopErrorDeterminingIfStopped() throws Exception {
   EasyMock.expect(processManager.getPidFromPidFile(serverHome + "/hqdb/data/postmaster.pid"))
       .andReturn(123l);
   EasyMock.expect(osInfo.getName()).andReturn("Mac OS X");
   EasyMock.expect(
           processManager.executeProcess(
               EasyMock.aryEq(new String[] {serverHome + "/bin/db-stop.sh"}),
               EasyMock.eq(serverHome),
               EasyMock.eq(false),
               EasyMock.eq(PostgresEmbeddedDatabaseController.DB_PROCESS_TIMEOUT)))
       .andReturn(0);
   EasyMock.expect(processManager.isPortInUse(5432l, 1)).andThrow(new NullPointerException());
   replay();
   boolean dbStopped = embeddedDBController.stopBuiltInDB();
   verify();
   assertFalse(dbStopped);
 }
 @Test
 public void testStopOnWindows() throws Exception {
   EasyMock.expect(processManager.getPidFromPidFile(serverHome + "/hqdb/data/postmaster.pid"))
       .andReturn(1l);
   EasyMock.expect(osInfo.getName()).andReturn("Win32");
   EasyMock.expect(
           processManager.executeProcess(
               EasyMock.aryEq(new String[] {serverHome + "/bin/db-stop.bat"}),
               EasyMock.eq(serverHome),
               EasyMock.eq(false),
               EasyMock.eq(PostgresEmbeddedDatabaseController.DB_PROCESS_TIMEOUT)))
       .andReturn(0);
   replay();
   boolean dbStopped = embeddedDBController.stopBuiltInDB();
   verify();
   assertTrue(dbStopped);
 }
 @Test
 public void testStartPortNotBound() throws Exception {
   EasyMock.expect(processManager.getPidFromPidFile(serverHome + "/hqdb/data/postmaster.pid"))
       .andReturn(-1l);
   EasyMock.expect(osInfo.getName()).andReturn("Mac OS X");
   EasyMock.expect(
           processManager.executeProcess(
               EasyMock.aryEq(new String[] {serverHome + "/bin/db-start.sh"}),
               EasyMock.eq(serverHome),
               EasyMock.eq(false),
               EasyMock.eq(PostgresEmbeddedDatabaseController.DB_PROCESS_TIMEOUT)))
       .andReturn(0);
   EasyMock.expect(processManager.isPortInUse(5432l, 10)).andReturn(false);
   replay();
   boolean dbStarted = embeddedDBController.startBuiltInDB();
   verify();
   assertFalse(dbStarted);
 }
  @Test(groups = "unit")
  public void createQuantificationTraining() {
    final ITraqQuantitationTrainingService service =
        EasyMock.createMock(ITraqQuantitationTrainingService.class);
    getDescription()
        .setRunIdList(
            IdList.forIterable(
                Lists.newArrayList(UUID.randomUUID().toString(), UUID.randomUUID().toString())));

    service.createQuantitationTraining(
        matchId(),
        matchDestinationId(),
        captureObject(),
        EasyMock.eq(getDescription().getReportFileId()),
        EasyMock.aryEq(getDescription().getRunIdList().toList().toArray(new String[2])),
        EasyMock.eq(getDescription().getOutputFileId()));
    returnInitializedObject();
    EasyMock.replay(service);
    runAndVerify(
        new CreateITraqQuantitationTrainingActivityFactoryImpl(service, getFactorySupport()));
    EasyMock.verify(service);
  }
コード例 #9
0
 /**
  * Expects a long array that is equal to the given array, i.e. it has to have the same length, and
  * each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final long[] aryEq(long[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #10
0
  /**
   * test different supplementers and removed supplementers
   *
   * @throws Exception
   */
  public void testSupplementerRegistryWithDifferentRemovedSupplementers() throws Exception {
    Hashtable headers = new Hashtable();
    headers.put("Eclipse-SupplementImporter", "test.import1");
    EasyMock.expect(supplementerBundle1.getHeaders()).andStubReturn(headers);

    headers = new Hashtable();
    headers.put("Eclipse-SupplementExporter", "test.export1");
    EasyMock.expect(supplementerBundle2.getHeaders()).andStubReturn(headers);

    headers = new Hashtable();
    headers.put("Eclipse-SupplementBundle", "symbolic-name-supplementedBundle*");
    EasyMock.expect(supplementerBundle3.getHeaders()).andStubReturn(headers);

    EasyMock.expect(context.getBundles())
        .andStubReturn(
            new Bundle[] {supplementerBundle1, supplementerBundle2, supplementerBundle3});

    headers = new Hashtable();
    headers.put("Import-Package", "test.import1");
    headers.put("Export-Package", "test.export1");
    EasyMock.expect(supplementedBundle1.getHeaders()).andStubReturn(headers);

    headers = new Hashtable();
    EasyMock.expect(supplementedBundle2.getHeaders()).andStubReturn(headers);

    EasyMock.expect(supplementedBundle1.getState()).andStubReturn(Bundle.RESOLVED);
    EasyMock.expect(supplementedBundle2.getState()).andStubReturn(Bundle.RESOLVED);

    packageAdmin.refreshPackages(EasyMock.aryEq(new Bundle[] {supplementedBundle1}));
    packageAdmin.refreshPackages(
        EasyMock.aryEq(new Bundle[] {supplementedBundle1, supplementedBundle2}));

    IWeavingAdaptor adaptor = EasyMock.createNiceMock(IWeavingAdaptor.class);
    EasyMock.expect(adaptorProvider.getAdaptor(6l)).andStubReturn(adaptor);
    EasyMock.expect(adaptorProvider.getAdaptor(7l)).andStubReturn(adaptor);

    EasyMock.replay(mocks);

    registry.addBundle(supplementerBundle1);
    registry.addBundle(supplementerBundle2);
    registry.addBundle(supplementerBundle3);
    registry.addBundle(supplementedBundle1);
    registry.addBundle(supplementedBundle2);

    registry.removeBundle(supplementerBundle1);
    registry.removeBundle(supplementerBundle3);

    Supplementer[] supplementers = registry.getSupplementers(supplementedBundle1);
    assertEquals(1, supplementers.length);
    assertFalse(containsSupplementer(supplementers, supplementerBundle1));
    assertTrue(containsSupplementer(supplementers, supplementerBundle2));
    assertFalse(containsSupplementer(supplementers, supplementerBundle3));

    supplementers = registry.getSupplementers(supplementedBundle2);
    assertEquals(0, supplementers.length);
    assertFalse(containsSupplementer(supplementers, supplementerBundle1));
    assertFalse(containsSupplementer(supplementers, supplementerBundle2));
    assertFalse(containsSupplementer(supplementers, supplementerBundle3));

    EasyMock.verify(mocks);
  }
コード例 #11
0
 /**
  * Expects a double array that is equal to the given array, i.e. it has to have the same length,
  * and each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final double[] aryEq(double[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #12
0
 /**
  * Expects a char array that is equal to the given array, i.e. it has to have the same length, and
  * each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final char[] aryEq(char[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #13
0
 /**
  * Expects a byte array that is equal to the given array, i.e. it has to have the same length, and
  * each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final byte[] aryEq(byte[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #14
0
 /**
  * Expects a boolean array that is equal to the given array, i.e. it has to have the same length,
  * and each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final boolean[] aryEq(boolean[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #15
0
  @Test
  public void testGetSet() throws Exception {
    expectConfigure();
    expectStart(Collections.EMPTY_LIST);
    expectStop();

    // First get() against an empty store
    final Capture<Callback<Void>> firstGetReadToEndCallback = EasyMock.newCapture();
    storeLog.readToEnd(EasyMock.capture(firstGetReadToEndCallback));
    PowerMock.expectLastCall()
        .andAnswer(
            new IAnswer<Object>() {
              @Override
              public Object answer() throws Throwable {
                firstGetReadToEndCallback.getValue().onCompletion(null, null);
                return null;
              }
            });

    // Set offsets
    Capture<org.apache.kafka.clients.producer.Callback> callback0 = EasyMock.newCapture();
    storeLog.send(
        EasyMock.aryEq(TP0_KEY.array()),
        EasyMock.aryEq(TP0_VALUE.array()),
        EasyMock.capture(callback0));
    PowerMock.expectLastCall();
    Capture<org.apache.kafka.clients.producer.Callback> callback1 = EasyMock.newCapture();
    storeLog.send(
        EasyMock.aryEq(TP1_KEY.array()),
        EasyMock.aryEq(TP1_VALUE.array()),
        EasyMock.capture(callback1));
    PowerMock.expectLastCall();

    // Second get() should get the produced data and return the new values
    final Capture<Callback<Void>> secondGetReadToEndCallback = EasyMock.newCapture();
    storeLog.readToEnd(EasyMock.capture(secondGetReadToEndCallback));
    PowerMock.expectLastCall()
        .andAnswer(
            new IAnswer<Object>() {
              @Override
              public Object answer() throws Throwable {
                capturedConsumedCallback
                    .getValue()
                    .onCompletion(
                        null,
                        new ConsumerRecord<>(TOPIC, 0, 0, TP0_KEY.array(), TP0_VALUE.array()));
                capturedConsumedCallback
                    .getValue()
                    .onCompletion(
                        null,
                        new ConsumerRecord<>(TOPIC, 1, 0, TP1_KEY.array(), TP1_VALUE.array()));
                secondGetReadToEndCallback.getValue().onCompletion(null, null);
                return null;
              }
            });

    // Third get() should pick up data produced by someone else and return those values
    final Capture<Callback<Void>> thirdGetReadToEndCallback = EasyMock.newCapture();
    storeLog.readToEnd(EasyMock.capture(thirdGetReadToEndCallback));
    PowerMock.expectLastCall()
        .andAnswer(
            new IAnswer<Object>() {
              @Override
              public Object answer() throws Throwable {
                capturedConsumedCallback
                    .getValue()
                    .onCompletion(
                        null,
                        new ConsumerRecord<>(TOPIC, 0, 1, TP0_KEY.array(), TP0_VALUE_NEW.array()));
                capturedConsumedCallback
                    .getValue()
                    .onCompletion(
                        null,
                        new ConsumerRecord<>(TOPIC, 1, 1, TP1_KEY.array(), TP1_VALUE_NEW.array()));
                thirdGetReadToEndCallback.getValue().onCompletion(null, null);
                return null;
              }
            });

    PowerMock.replayAll();

    store.configure(DEFAULT_PROPS);
    store.start();

    // Getting from empty store should return nulls
    final AtomicBoolean getInvokedAndPassed = new AtomicBoolean(false);
    store
        .get(
            Arrays.asList(TP0_KEY, TP1_KEY),
            new Callback<Map<ByteBuffer, ByteBuffer>>() {
              @Override
              public void onCompletion(Throwable error, Map<ByteBuffer, ByteBuffer> result) {
                // Since we didn't read them yet, these will be null
                assertEquals(null, result.get(TP0_KEY));
                assertEquals(null, result.get(TP1_KEY));
                getInvokedAndPassed.set(true);
              }
            })
        .get(10000, TimeUnit.MILLISECONDS);
    assertTrue(getInvokedAndPassed.get());

    // Set some offsets
    Map<ByteBuffer, ByteBuffer> toSet = new HashMap<>();
    toSet.put(TP0_KEY, TP0_VALUE);
    toSet.put(TP1_KEY, TP1_VALUE);
    final AtomicBoolean invoked = new AtomicBoolean(false);
    Future<Void> setFuture =
        store.set(
            toSet,
            new Callback<Void>() {
              @Override
              public void onCompletion(Throwable error, Void result) {
                invoked.set(true);
              }
            });
    assertFalse(setFuture.isDone());
    // Out of order callbacks shouldn't matter, should still require all to be invoked before
    // invoking the callback
    // for the store's set callback
    callback1.getValue().onCompletion(null, null);
    assertFalse(invoked.get());
    callback0.getValue().onCompletion(null, null);
    setFuture.get(10000, TimeUnit.MILLISECONDS);
    assertTrue(invoked.get());

    // Getting data should read to end of our published data and return it
    final AtomicBoolean secondGetInvokedAndPassed = new AtomicBoolean(false);
    store
        .get(
            Arrays.asList(TP0_KEY, TP1_KEY),
            new Callback<Map<ByteBuffer, ByteBuffer>>() {
              @Override
              public void onCompletion(Throwable error, Map<ByteBuffer, ByteBuffer> result) {
                assertEquals(TP0_VALUE, result.get(TP0_KEY));
                assertEquals(TP1_VALUE, result.get(TP1_KEY));
                secondGetInvokedAndPassed.set(true);
              }
            })
        .get(10000, TimeUnit.MILLISECONDS);
    assertTrue(secondGetInvokedAndPassed.get());

    // Getting data should read to end of our published data and return it
    final AtomicBoolean thirdGetInvokedAndPassed = new AtomicBoolean(false);
    store
        .get(
            Arrays.asList(TP0_KEY, TP1_KEY),
            new Callback<Map<ByteBuffer, ByteBuffer>>() {
              @Override
              public void onCompletion(Throwable error, Map<ByteBuffer, ByteBuffer> result) {
                assertEquals(TP0_VALUE_NEW, result.get(TP0_KEY));
                assertEquals(TP1_VALUE_NEW, result.get(TP1_KEY));
                thirdGetInvokedAndPassed.set(true);
              }
            })
        .get(10000, TimeUnit.MILLISECONDS);
    assertTrue(thirdGetInvokedAndPassed.get());

    store.stop();

    PowerMock.verifyAll();
  }
コード例 #16
0
 /**
  * Expects a float array that is equal to the given array, i.e. it has to have the same length,
  * and each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final float[] aryEq(float[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #17
0
 /**
  * Expects an int array that is equal to the given array, i.e. it has to have the same length, and
  * each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final int[] aryEq(int[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #18
0
 /**
  * Expects a short array that is equal to the given array, i.e. it has to have the same length,
  * and each element has to be equal.
  *
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final short[] aryEq(short[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #19
0
 /**
  * Expects an Object array that is equal to the given array, i.e. it has to have the same type,
  * length, and each element has to be equal.
  *
  * @param <T> the type of the array, it is passed through to prevent casts.
  * @param value the given arry.
  * @return <code>null</code>.
  */
 protected final <T> T[] aryEq(T[] value) {
   return EasyMock.aryEq(value);
 }
コード例 #20
0
  @Test
  public void testSetFailure() throws Exception {
    expectConfigure();
    expectStart(Collections.EMPTY_LIST);
    expectStop();

    // Set offsets
    Capture<org.apache.kafka.clients.producer.Callback> callback0 = EasyMock.newCapture();
    storeLog.send(
        EasyMock.aryEq(TP0_KEY.array()),
        EasyMock.aryEq(TP0_VALUE.array()),
        EasyMock.capture(callback0));
    PowerMock.expectLastCall();
    Capture<org.apache.kafka.clients.producer.Callback> callback1 = EasyMock.newCapture();
    storeLog.send(
        EasyMock.aryEq(TP1_KEY.array()),
        EasyMock.aryEq(TP1_VALUE.array()),
        EasyMock.capture(callback1));
    PowerMock.expectLastCall();
    Capture<org.apache.kafka.clients.producer.Callback> callback2 = EasyMock.newCapture();
    storeLog.send(
        EasyMock.aryEq(TP2_KEY.array()),
        EasyMock.aryEq(TP2_VALUE.array()),
        EasyMock.capture(callback2));
    PowerMock.expectLastCall();

    PowerMock.replayAll();

    store.configure(DEFAULT_PROPS);
    store.start();

    // Set some offsets
    Map<ByteBuffer, ByteBuffer> toSet = new HashMap<>();
    toSet.put(TP0_KEY, TP0_VALUE);
    toSet.put(TP1_KEY, TP1_VALUE);
    toSet.put(TP2_KEY, TP2_VALUE);
    final AtomicBoolean invoked = new AtomicBoolean(false);
    final AtomicBoolean invokedFailure = new AtomicBoolean(false);
    Future<Void> setFuture =
        store.set(
            toSet,
            new Callback<Void>() {
              @Override
              public void onCompletion(Throwable error, Void result) {
                invoked.set(true);
                if (error != null) invokedFailure.set(true);
              }
            });
    assertFalse(setFuture.isDone());
    // Out of order callbacks shouldn't matter, should still require all to be invoked before
    // invoking the callback
    // for the store's set callback
    callback1.getValue().onCompletion(null, null);
    assertFalse(invoked.get());
    callback2.getValue().onCompletion(null, new KafkaException("bogus error"));
    assertTrue(invoked.get());
    assertTrue(invokedFailure.get());
    callback0.getValue().onCompletion(null, null);
    try {
      setFuture.get(10000, TimeUnit.MILLISECONDS);
      fail(
          "Should have seen KafkaException thrown when waiting on KafkaOffsetBackingStore.set() future");
    } catch (ExecutionException e) {
      // expected
      assertNotNull(e.getCause());
      assertTrue(e.getCause() instanceof KafkaException);
    }

    store.stop();

    PowerMock.verifyAll();
  }
コード例 #21
0
 @Test
 public void testStartErrorConfiguring() throws Exception {
   EasyMock.expect(engineController.isEngineRunning()).andReturn(false);
   serverConfigurator.configure();
   EasyMock.expectLastCall().andThrow(new NullPointerException(EXPECTED_EXCEPTION_MSG));
   EasyMock.expect(embeddedDatabaseController.shouldUse()).andReturn(false);
   EasyMock.expect(
           processManager.executeProcess(
               EasyMock.aryEq(
                       new String[] {
                         System.getProperty("java.home") + "/bin/java",
                         "-cp",
                         serverHome + "/lib/ant-launcher-1.7.1.jar",
                         "-Dserver.home=" + serverHome,
                         "-Dant.home=" + serverHome,
                         "-Dtomcat.home=" + engineHome + "/hq-server",
                         "-Dlog4j.configuration="
                             + new File(serverHome + "/conf/log4j.xml").toURI().toURL().toString(),
                         "org.apache.tools.ant.launch.Launcher",
                         "-q",
                         "-lib",
                         serverHome + "/lib",
                         "-listener",
                         "org.apache.tools.ant.listener.Log4jListener",
                         "-buildfile",
                         serverHome + "/data/db-upgrade.xml",
                         "upgrade"
                       }),
                   EasyMock.eq(serverHome),
               EasyMock.eq(true), EasyMock.eq(HQServer.DB_UPGRADE_PROCESS_TIMEOUT)))
       .andReturn(0);
   EasyMock.expect(dataSource.getConnection()).andReturn(connection);
   EasyMock.expect(connection.createStatement()).andReturn(statement);
   EasyMock.expect(
           statement.executeQuery(
               "select propvalue from EAM_CONFIG_PROPS "
                   + "WHERE propkey = '"
                   + HQConstants.SchemaVersion
                   + "'"))
       .andReturn(resultSet);
   EasyMock.expect(resultSet.next()).andReturn(true);
   EasyMock.expect(resultSet.getString("propvalue")).andReturn("3.1.88");
   connection.close();
   resultSet.close();
   statement.close();
   Properties testProps = new Properties();
   testProps.put(
       "server.java.opts",
       "-XX:MaxPermSize=192m -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError");
   testProps.put("server.webapp.port", "7080");
   final List<String> expectedOpts = new ArrayList<String>();
   expectedOpts.add("-XX:MaxPermSize=192m");
   expectedOpts.add("-Xmx512m");
   expectedOpts.add("-Xms512m");
   expectedOpts.add("-XX:+HeapDumpOnOutOfMemoryError");
   expectedOpts.add("-Dserver.home=" + serverHome);
   EasyMock.expect(serverConfigurator.getServerProps()).andReturn(testProps);
   org.easymock.classextension.EasyMock.expect(osInfo.getName()).andReturn("Mac OS X");
   EasyMock.expect(engineController.start(expectedOpts)).andReturn(0);
   replay();
   server.start();
   verify();
 }