예제 #1
0
  @Test
  public void testStopDetectionWithScript() {

    final File serviceFile =
        new File(TEST_PARSING_RESOURCE_BASE + "misc/stopDetectionScript-service.groovy");

    try {
      ServiceReader.getServiceFromFile(serviceFile);
      Assert.fail("Expected parsing to fail");
    } catch (PackagingException e) {
      Assert.assertTrue(
          "Unexpected error message: " + e.getMessage(),
          e.getMessage().contains("The stop detection field only supports execution of closures"));
    }
  }
예제 #2
0
 /**
  * Verifies the service configuration is valid.
  *
  * @param serviceFolder The Folder holding the service configuration files
  * @throws CLIException Reporting a failure to find or parse the configuration files
  */
 private void isServiceLifecycleNotNull(final File serviceFolder) throws CLIException {
   Service service;
   try {
     final File serviceFileDir = new File(serviceFolder, "ext");
     service =
         ServiceReader.getServiceFromDirectory(
                 serviceFileDir, CloudifyConstants.DEFAULT_APPLICATION_NAME)
             .getService();
     if (service.getLifecycle() == null) {
       throw new CLIException(getFormattedMessage("test_recipe_service_lifecycle_missing"));
     }
   } catch (final FileNotFoundException e) {
     logger.log(Level.SEVERE, "Service configuration file not found " + e.getMessage(), e);
     throw new CLIException("Failed to locate service configuration file. " + e.getMessage(), e);
   } catch (final PackagingException e) {
     logger.log(Level.SEVERE, "Packaging failed: " + e.getMessage(), e);
     e.printStackTrace();
     throw new CLIException("Packaging failed: " + e.getMessage(), e);
   } catch (final DSLException e) {
     logger.log(Level.SEVERE, "DSL Parsing failed: " + e.getMessage(), e);
     e.printStackTrace();
     throw new CLIException("Packaging failed: " + e.getMessage(), e);
   }
 }