Search in sources :

Example 1 with ProjectMetadataImpl

use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectMetadataImpl in project kie-wb-common by kiegroup.

the class DMNContentServiceImplTest method testGetProjectContent.

@Test
public void testGetProjectContent() {
    final String defSetId = "defSetId";
    final String expectedContent = "<xml/>";
    final String moduleName = "moduleName";
    final Package aPackage = mock(Package.class);
    final KieModule kieModule = mock(KieModule.class);
    final Overview overview = mock(Overview.class);
    doReturn(expectedContent).when(service).getSource(path);
    when(moduleService.resolvePackage(path)).thenReturn(aPackage);
    when(moduleService.resolveModule(path)).thenReturn(kieModule);
    when(overviewLoader.loadOverview(path)).thenReturn(overview);
    when(kieModule.getModuleName()).thenReturn(moduleName);
    final DMNContentResource contentResource = service.getProjectContent(path, defSetId);
    final String actualContent = contentResource.getContent();
    final ProjectMetadataImpl metadata = (ProjectMetadataImpl) contentResource.getMetadata();
    assertEquals(expectedContent, actualContent);
    assertEquals(defSetId, metadata.getDefinitionSetId());
    assertEquals(moduleName, metadata.getModuleName());
    assertEquals(aPackage, metadata.getProjectPackage());
    assertEquals(overview, metadata.getOverview());
    assertEquals(fileName, metadata.getTitle());
    assertEquals(path, metadata.getPath());
}
Also used : Overview(org.guvnor.common.services.shared.metadata.model.Overview) Package(org.guvnor.common.services.project.model.Package) ProjectMetadataImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectMetadataImpl) KieModule(org.kie.workbench.common.services.shared.project.KieModule) DMNContentResource(org.kie.workbench.common.dmn.api.DMNContentResource) Test(org.junit.Test)

Aggregations

Package (org.guvnor.common.services.project.model.Package)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 Test (org.junit.Test)1 DMNContentResource (org.kie.workbench.common.dmn.api.DMNContentResource)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1 ProjectMetadataImpl (org.kie.workbench.common.stunner.project.diagram.impl.ProjectMetadataImpl)1