use of io.cdap.cdap.internal.app.ApplicationSpecificationAdapter in project cdap by caskdata.
the class ApplicationVerificationTest method testGoodApplication.
/**
* Good test
*/
@Test
public void testGoodApplication() {
ApplicationSpecification appSpec = Specifications.from(new AllProgramsApp());
ApplicationSpecificationAdapter adapter = ApplicationSpecificationAdapter.create();
ApplicationSpecification newSpec = adapter.fromJson(adapter.toJson(appSpec));
ApplicationVerification app = new ApplicationVerification();
VerifyResult result = app.verify(new ApplicationId("test", newSpec.getName()), newSpec);
Assert.assertSame(result.getMessage(), result.getStatus(), VerifyResult.Status.SUCCESS);
}
use of io.cdap.cdap.internal.app.ApplicationSpecificationAdapter in project cdap by caskdata.
the class WorkflowVerificationTest method testGoodWorkflow.
@Test
public void testGoodWorkflow() throws Exception {
ApplicationSpecification appSpec = Specifications.from(new GoodWorkflowApp());
verifyGoodWorkflowSpecifications(appSpec);
verifyAnotherGoodWorkflowSpecification(appSpec);
verifyWorkflowWithLocalDatasetSpecification(appSpec);
ApplicationSpecificationAdapter adapter = ApplicationSpecificationAdapter.create();
ApplicationSpecification newSpec = adapter.fromJson(adapter.toJson(appSpec));
verifyGoodWorkflowSpecifications(newSpec);
verifyAnotherGoodWorkflowSpecification(newSpec);
verifyWorkflowWithLocalDatasetSpecification(newSpec);
}
use of io.cdap.cdap.internal.app.ApplicationSpecificationAdapter in project cdap by caskdata.
the class ProgramGenerationStageTest method testProgramGeneration.
@Test
public void testProgramGeneration() throws Exception {
cConf.set(Constants.AppFabric.OUTPUT_DIR, "programs");
LocationFactory lf = new LocalLocationFactory(TEMP_FOLDER.newFolder());
// have to do this since we are not going through the route of create namespace -> deploy application
// in real scenarios, the namespace directory would already be created
Location namespaceLocation = lf.create(DefaultId.APPLICATION.getNamespace());
Locations.mkdirsIfNotExists(namespaceLocation);
LocationFactory jarLf = new LocalLocationFactory(TEMP_FOLDER.newFolder());
Location appArchive = AppJarHelper.createDeploymentJar(jarLf, AllProgramsApp.class);
ApplicationSpecification appSpec = Specifications.from(new AllProgramsApp());
ApplicationSpecificationAdapter adapter = ApplicationSpecificationAdapter.create();
ApplicationSpecification newSpec = adapter.fromJson(adapter.toJson(appSpec));
ApplicationClass applicationClass = new ApplicationClass(AllProgramsApp.class.getName(), "", null);
ProgramGenerationStage pgmStage = new ProgramGenerationStage();
// Can do better here - fixed right now to run the test.
pgmStage.process(new StageContext(Object.class));
pgmStage.process(new ApplicationDeployable(NamespaceId.DEFAULT.artifact("AllProgramApp", "1.0"), appArchive, DefaultId.APPLICATION, newSpec, null, ApplicationDeployScope.USER, applicationClass));
Assert.assertTrue(true);
}
Aggregations