Esempio n. 1
0
  /** @throws DSLException . */
  @Test
  public void testBasicExtendParsing() throws DSLException {

    final File testParsingBaseDslFile =
        new File(TEST_PARSING_RESOURCE_PATH + "test_parsing_base-service.groovy");
    final File testParsingBaseWorkDir = new File(TEST_PARSING_RESOURCE_PATH);
    final Service baseService =
        ServiceReader.getServiceFromFile(testParsingBaseDslFile, testParsingBaseWorkDir)
            .getService();
    Assert.assertFalse(baseService.getName().equals("test parsing extend"));
    final ServiceLifecycle baseLifecycle = baseService.getLifecycle();
    Assert.assertFalse(baseLifecycle.getInit().equals("test_parsing_extend_install.groovy"));
    Assert.assertNull(baseLifecycle.getStop());

    final File testParsingExtendDslFile =
        new File(TEST_PARSING_RESOURCE_PATH + "test_parsing_extend-service.groovy");
    final File testParsingExtendWorkDir = new File(TEST_PARSING_RESOURCE_PATH);
    final Service service =
        ServiceReader.getServiceFromFile(testParsingExtendDslFile, testParsingExtendWorkDir)
            .getService();
    Assert.assertEquals("test parsing extend", service.getName());
    final ServiceLifecycle lifecycle = service.getLifecycle();
    Assert.assertEquals(ExecutableDSLEntryType.STRING, lifecycle.getInit().getEntryType());
    Assert.assertEquals(
        "test_parsing_extend_install.groovy",
        ((StringExecutableEntry) lifecycle.getInit()).getCommand());
    Assert.assertNotNull(lifecycle.getStart());
    Assert.assertNotNull(lifecycle.getPostStart());
    Assert.assertNotNull(lifecycle.getPreStop());
    Assert.assertNotNull(lifecycle.getStop());
    Assert.assertEquals(1, service.getExtendedServicesPaths().size());
    Assert.assertEquals(
        new File(TEST_PARSING_RESOURCE_PATH, "test_parsing_base-service.groovy").getAbsolutePath(),
        service.getExtendedServicesPaths().getFirst());
  }
Esempio n. 2
0
  /**
   * @throws DSLException .
   * @throws UnknownHostException .
   */
  @Test
  public void testFeaturesParsing() throws DSLException, UnknownHostException {
    final File testParsingBaseDslFile =
        new File(TEST_PARSING_RESOURCE_PATH + "test_features-service.groovy");
    final File testParsingBaseWorkDir = new File(TEST_PARSING_RESOURCE_PATH);
    final Service service =
        ServiceReader.getServiceFromFile(testParsingBaseDslFile, testParsingBaseWorkDir)
            .getService();
    Assert.assertEquals("test features", service.getName());
    Assert.assertEquals(
        "http://" + InetAddress.getLocalHost().getHostName() + ":8080", service.getUrl());
    final ServiceLifecycle lifecycle = service.getLifecycle();

    Assert.assertNotNull(lifecycle.getStart());
    Assert.assertNotNull(lifecycle.getPostStart());
    Assert.assertNotNull(lifecycle.getPreStop());
  }
Esempio n. 3
0
 /** @throws DSLException . */
 @Test
 public void testBasicParsing() throws DSLException {
   final File testParsingBaseDslFile =
       new File(TEST_PARSING_RESOURCE_PATH + "test_parsing_base-service.groovy");
   final File testParsingBaseWorkDir = new File(TEST_PARSING_RESOURCE_PATH);
   final Service service =
       ServiceReader.getServiceFromFile(testParsingBaseDslFile, testParsingBaseWorkDir)
           .getService();
   Assert.assertEquals("test parsing base", service.getName());
   final ServiceLifecycle lifecycle = service.getLifecycle();
   Assert.assertEquals(ExecutableDSLEntryType.STRING, lifecycle.getInit().getEntryType());
   Assert.assertEquals(
       "test_parsing_base_install.groovy",
       ((StringExecutableEntry) lifecycle.getInit()).getCommand());
   Assert.assertNotNull(lifecycle.getStart());
   Assert.assertNotNull(lifecycle.getPostStart());
   Assert.assertNotNull(lifecycle.getPreStop());
 }