@Override public KieModule newModule(final Path repositoryPath, final POM pom, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom); } return moduleSaver.save(repositoryPath, pom); }
private void testApplyForModuleFullBuildAndDeploy(LocalBuildConfig.DeploymentType deploymentType, boolean suppressHandlers) { when(internalBuildConfig.getBuildType()).thenReturn(LocalBuildConfig.BuildType.FULL_BUILD_AND_DEPLOY); when(internalBuildConfig.getModule()).thenReturn(module); when(internalBuildConfig.getDeploymentType()).thenReturn(deploymentType); when(internalBuildConfig.isSuppressHandlers()).thenReturn(suppressHandlers); when(buildHelper.buildAndDeploy(module, suppressHandlers, DeploymentMode.valueOf(deploymentType.name()))).thenReturn(buildResults); Optional<LocalBinaryConfig> result = executor.apply(internalBuildConfig, buildExecConfig); assertTrue(result.isPresent()); assertEquals(buildResults, result.get().getBuildResults()); verify(buildHelper, times(1)).buildAndDeploy(module, suppressHandlers, DeploymentMode.valueOf(deploymentType.name())); } }
/** * Verifies if a given module can be deployed in current server for the given deployment mode. * An example of when a module can't be deployed is when the deployment mode is DeploymentMode.VALIDATED and the * module was already deployed. This case will raise a GAVAlreadyExistsException. * @param module the module to verify. * @param deploymentMode the deployment mode for doing the verification. */ public void verifyWithException(final Module module, DeploymentMode deploymentMode) { if (DeploymentMode.VALIDATED.equals(deploymentMode)) { // Check is the POM's GAV resolves to any pre-existing artifacts. final GAV gav = module.getPom().getGav(); if (gav.isSnapshot()) { return; } final ModuleRepositories projectRepositories = moduleRepositoriesService.load(((KieModule) module).getRepositoriesPath()); final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(gav, module, projectRepositories.filterByIncluded()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(gav, repositories); } } } }
when(buildHelper.buildAndDeploy(module, suppressHandlers, DeploymentMode.valueOf(deploymentType.name()))).thenReturn(buildResults);
pom.setName(newName); if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom);
pom.setName(newName); if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom);
@Override public Path initRepositoryStructure(final GAV gav, final Repository repo, final DeploymentMode mode) { final POM pom = new POM(repo.getAlias(), repo.getAlias(), gav, true); if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom); } //Creating the parent pom final Path fsRoot = repo.getRoot(); final Path pathToPom = pomService.create(fsRoot, "", pom); //Deploying the parent pom artifact, // it needs to be deployed before the first child is created m2service.deployParentPom(gav); managedStatusUpdater.updateManagedStatus(repo, true); return pathToPom; }
@Override public Path initRepositoryStructure(final GAV gav, final Repository repo, final DeploymentMode mode) { final POM pom = new POM(repo.getAlias(), repo.getAlias(), gav, true); if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom); } //Creating the parent pom final Path fsRoot = repo.getRoot(); final Path pathToPom = pomService.create(fsRoot, "", pom); //Deploying the parent pom artifact, // it needs to be deployed before the first child is created m2service.deployParentPom(gav); managedStatusUpdater.updateManagedStatus(repo, true); return pathToPom; }
if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom);
if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pom);