@Test public void testProjectNameWithReallyLongName() throws Exception { String expectedProjectName = "randomPrefixWithReallyLongName_http___localhost_8000__55490420"; Properties properties = new Properties(); properties.setProperty("gobblin.service.azkaban.project.namePrefix", "randomPrefixWithReallyLongName"); JobSpec jobSpec = new JobSpec(new URI("http://localhost:8000/context/that-keeps-expanding-and-explanding"), "0.0", "test job spec", ConfigUtils.propertiesToConfig(properties), properties, Optional.absent(), Collections.EMPTY_MAP); AzkabanProjectConfig azkabanProjectConfig = new AzkabanProjectConfig(jobSpec); String actualProjectName = azkabanProjectConfig.getAzkabanProjectName(); Assert.assertEquals(actualProjectName, expectedProjectName); }
public JobSpec build() { Preconditions.checkNotNull(this.uri); Preconditions.checkNotNull(this.version); return new JobSpec(getURI(), getVersion(), getDescription(), getConfig(), getConfigAsProperties(), getTemplateURI(), getMetadata()); }
@Test public void testProjectNameWithConfig() throws Exception { String expectedProjectName = "randomPrefix_http___localhost_8000_context"; Properties properties = new Properties(); properties.setProperty("gobblin.service.azkaban.project.namePrefix", "randomPrefix"); JobSpec jobSpec = new JobSpec(new URI("http://localhost:8000/context"), "0.0", "test job spec", ConfigUtils.propertiesToConfig(properties), properties, Optional.absent(), Collections.EMPTY_MAP); AzkabanProjectConfig azkabanProjectConfig = new AzkabanProjectConfig(jobSpec); String actualProjectName = azkabanProjectConfig.getAzkabanProjectName(); Assert.assertEquals(actualProjectName, expectedProjectName); }
@Test public void testProjectZipFileName() throws Exception { String expectedZipFileName = "randomPrefix_http___localhost_8000_context.zip"; Properties properties = new Properties(); properties.setProperty("gobblin.service.azkaban.project.namePrefix", "randomPrefix"); JobSpec jobSpec = new JobSpec(new URI("http://localhost:8000/context"), "0.0", "test job spec", ConfigUtils.propertiesToConfig(properties), properties, Optional.absent(), Collections.EMPTY_MAP); AzkabanProjectConfig azkabanProjectConfig = new AzkabanProjectConfig(jobSpec); String actualZipFileName = azkabanProjectConfig.getAzkabanProjectZipFilename(); Assert.assertEquals(actualZipFileName, expectedZipFileName); }
@Test public void testProjectZipFileNameForLongName() throws Exception { String expectedZipFileName = "randomPrefixWithReallyLongName_http___localhost_8000__55490420.zip"; Properties properties = new Properties(); properties.setProperty("gobblin.service.azkaban.project.namePrefix", "randomPrefixWithReallyLongName"); JobSpec jobSpec = new JobSpec(new URI("http://localhost:8000/context/that-keeps-expanding-and-explanding"), "0.0", "test job spec", ConfigUtils.propertiesToConfig(properties), properties, Optional.absent(), Collections.EMPTY_MAP); AzkabanProjectConfig azkabanProjectConfig = new AzkabanProjectConfig(jobSpec); String actualZipFileName = azkabanProjectConfig.getAzkabanProjectZipFilename(); Assert.assertEquals(actualZipFileName, expectedZipFileName); } }
@Test public void testProjectNameDefault() throws Exception { String expectedProjectName = "GobblinService__uri"; Properties properties = new Properties(); JobSpec jobSpec = new JobSpec(new URI("uri"), "0.0", "test job spec", ConfigUtils.propertiesToConfig(properties), properties, Optional.absent(), Collections.EMPTY_MAP); AzkabanProjectConfig azkabanProjectConfig = new AzkabanProjectConfig(jobSpec); String actualProjectName = azkabanProjectConfig.getAzkabanProjectName(); Assert.assertEquals(actualProjectName, expectedProjectName); }
public JobSpec build() { Preconditions.checkNotNull(this.uri); Preconditions.checkNotNull(this.version); return new JobSpec(getURI(), getVersion(), getDescription(), getConfig(), getConfigAsProperties(), getTemplateURI(), getMetadata()); }