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);
}
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());
}
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"));
}
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"));
}
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"));
}
Aggregations