Ejemplo n.º 1
0
  @Override
  public void modify(MachineModel[] machines, StateRegistry state) {
    RestCreateNode createNode = new RestCreateNode();
    ZookeeperClusterDescription zkCluster = state.get(ZookeeperClusterDescription.class);

    MachineModel backupMachine = machines[0];
    backupMachine.apply(createNode);
    long nodeId = createNode.getCreatedNodeId();

    backupMachine.forceApply(new FullHABackup("test", zkCluster));
    backupMachine.forceApply(new IncrementalHABackup("test", zkCluster));

    for (MachineModel machine : machines) {
      machine.forceApply(neo4jStopCommand());
      machine.forceApply(new DestroyNeo4jData());
    }

    backupMachine.forceApply(new ReplaceDataWithBackup("test"));

    backupMachine.forceApply(neo4jStartCommand());
    backupMachine.verifyThat(new RestNodeExists(nodeId));

    for (MachineModel machine : machines) {
      machine.apply(neo4jStartCommand());
      machine.verifyThat(new RestNodeExists(nodeId));
    }
  }
  @Test
  public void basicQualityAssurance() {
    model.apply(neo4jInstallation());
    model.verifyThat(neo4jRestAPIResponds());
    model.verifyThat(neo4jDocumentationIsCorrect());

    model.apply(neo4jStopCommand());
    snooze();
    model.verifyThat(neo4jRestAPIDoesNotRespond());

    model.apply(neo4jStartCommand());
    model.verifyThat(neo4jRestAPIResponds());

    model.forceApply(neo4jRestartCommand());
    model.verifyThat(neo4jRestAPIResponds());

    model.forceApply(vmReboot());

    model.verifyThat(neo4jRestAPIResponds());

    model.apply(neo4jUninstallation());
    model.verifyThat(neo4jRestAPIDoesNotRespond());
  }