Search in sources :

Example 31 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectScreenModelTests method testHashCode.

@Test
public void testHashCode() {
    final ProjectScreenModel model = new ProjectScreenModel();
    model.setPOM(new POM("test", "test", "url", new GAV("groupID", "artifactID", "version")));
    final MavenRepository repository = new MavenRepository();
    repository.setId("guvnor-m2-repo");
    repository.setName("Guvnor M2 Repo");
    repository.setUrl("http://localhost/maven2/");
    model.getPOM().addRepository(repository);
    model.setPOMMetaData(new Metadata());
    model.setKModule(new KModuleModel());
    model.setKModuleMetaData(new Metadata());
    model.setProjectTagsMetaData(new Metadata());
    model.setProjectImports(new ProjectImports());
    model.setProjectImportsMetaData(new Metadata());
    final int hashCode1 = model.hashCode();
    assertTrue(hashCode1 <= Integer.MAX_VALUE);
    assertTrue(hashCode1 >= Integer.MIN_VALUE);
    model.getProjectImports().getImports().addImport(new Import("java.lang.List"));
    final int hashCode2 = model.hashCode();
    assertTrue(hashCode2 <= Integer.MAX_VALUE);
    assertTrue(hashCode2 >= Integer.MIN_VALUE);
    assertNotEquals(hashCode1, hashCode2);
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) MavenRepository(org.guvnor.common.services.project.model.MavenRepository) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectImports(org.guvnor.common.services.project.model.ProjectImports) GAV(org.guvnor.common.services.project.model.GAV) POM(org.guvnor.common.services.project.model.POM) KModuleModel(org.kie.workbench.common.services.shared.kmodule.KModuleModel) Test(org.junit.Test)

Example 32 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectScreenModelLoaderTest method testWhiteList.

@Test
public void testWhiteList() throws Exception {
    final WhiteList whiteList = new WhiteList();
    when(whiteListService.load(packageNamesWhiteListPath)).thenReturn(whiteList);
    final Metadata metadata = new Metadata();
    when(metadataService.getMetadata(packageNamesWhiteListPath)).thenReturn(metadata);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(packageNamesWhiteListPath, model.getPathToWhiteList());
    assertEquals(whiteList, model.getWhiteList());
    assertEquals(metadata, model.getWhiteListMetaData());
}
Also used : WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 33 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testKModuleSave.

@Test
public void testKModuleSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final KModuleModel kModule = new KModuleModel();
    model.setKModule(kModule);
    final Path pathToKModule = mock(Path.class);
    model.setPathToKModule(pathToKModule);
    final Metadata metadata = new Metadata();
    model.setKModuleMetaData(metadata);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message kmodule");
    verify(kModuleService).save(eq(pathToKModule), eq(kModule), eq(metadata), eq("message kmodule"));
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) KModuleModel(org.kie.workbench.common.services.shared.kmodule.KModuleModel) Test(org.junit.Test)

Example 34 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testPOMSave.

@Test
public void testPOMSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final POM pom = new POM();
    model.setPOM(pom);
    final Metadata pomMetaData = new Metadata();
    model.setPOMMetaData(pomMetaData);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message");
    verify(pomService).save(eq(pathToPom), eq(pom), eq(pomMetaData), eq("message"));
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Example 35 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testWhiteListSave.

@Test
public void testWhiteListSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final WhiteList whiteList = new WhiteList();
    model.setWhiteList(whiteList);
    final Path pathToWhiteList = mock(Path.class);
    model.setPathToWhiteList(pathToWhiteList);
    final Metadata metadata = new Metadata();
    model.setWhiteListMetaData(metadata);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message white list");
    verify(whiteListService).save(eq(pathToWhiteList), eq(whiteList), eq(metadata), eq("message white list"));
}
Also used : Path(org.uberfire.backend.vfs.Path) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Aggregations

Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)62 Test (org.junit.Test)45 Path (org.uberfire.backend.vfs.Path)35 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)13 ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)9 Package (org.guvnor.common.services.project.model.Package)7 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)6 HashMap (java.util.HashMap)5 POM (org.guvnor.common.services.project.model.POM)5 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)5 ObservablePath (org.uberfire.backend.vfs.ObservablePath)5 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)5 Overview (org.guvnor.common.services.shared.metadata.model.Overview)4 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)4 Map (java.util.Map)3 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)3 InvalidateDMOPackageCacheEvent (org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent)3 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)3 KModuleModel (org.kie.workbench.common.services.shared.kmodule.KModuleModel)3 Mockito.anyString (org.mockito.Mockito.anyString)3