use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.
the class ProvisioningPipelinesProducer method getWildflyPipeline.
/**
* Produces a pipeline for provisioning building an provisioning war applications into an Wildlfy server.
*/
@Produces
public SystemPipelineDescriptor getWildflyPipeline() {
return new SystemPipelineDescriptor() {
@Override
public Optional<ProviderType> getProviderType() {
return Optional.of(WildflyProviderType.instance());
}
@Override
public Pipeline getPipeline() {
// Create Wildfly Pipeline Configuration
final GitConfig gitConfig = new GitConfig() {
};
final MavenProjectConfig projectConfig = new MavenProjectConfig() {
};
final MavenBuildConfig mavenBuildConfig = new MavenBuildConfig() {
@Override
public List<String> getGoals() {
final List<String> result = new ArrayList<>();
result.add("clean");
result.add("package");
return result;
}
@Override
public Properties getProperties() {
final Properties result = new Properties();
result.setProperty("failIfNoTests", "false");
return result;
}
};
final MavenBuildExecConfig mavenBuildExecConfig = new MavenBuildExecConfig() {
};
final WildflyProviderConfig wildflyProviderConfig = new WildflyProviderConfig() {
};
final ContextAwareWildflyRuntimeExecConfig wildflyRuntimeExecConfig = new ContextAwareWildflyRuntimeExecConfig() {
};
final Pipeline pipeline = PipelineFactory.newBuilder().addConfigStage("Git Source", gitConfig).addConfigStage("Maven Project", projectConfig).addConfigStage("Maven Build Config", mavenBuildConfig).addConfigStage("Maven Build", mavenBuildExecConfig).addConfigStage("Wildfly Provider Config", wildflyProviderConfig).addConfigStage("Wildfly Runtime Exec", wildflyRuntimeExecConfig).buildAs("source-to-wildlfy-provisioning");
return pipeline;
}
};
}
use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.
the class RuntimeProvisioningServiceBackendImplTest method testGetProviderTypes.
@Test
public void testGetProviderTypes() {
List<ProviderType> values = mockList(ProviderType.class, ELEMENTS_COUNT);
ProviderTypeList list = new ProviderTypeList(values);
when(runtimeProvisioningService.getProviderTypes(PAGE, PAGE_SIZE, SORT, SORT_ORDER)).thenReturn(list);
List<ProviderType> result = runtimeProvisioningServiceBackend.getProviderTypes(PAGE, PAGE_SIZE, SORT, SORT_ORDER);
verify(runtimeProvisioningService, times(1)).getProviderTypes(PAGE, PAGE_SIZE, SORT, SORT_ORDER);
assertEquals(values, result);
}
use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.
the class RestPipelineServiceImpl method runPipeline.
@Override
public String runPipeline(final String pipelineId, final Input input, final boolean async) throws BusinessException {
final Pipeline pipeline = pipelineRegistry.getPipelineByName(pipelineId);
if (pipeline == null) {
throw new BusinessException("Pipeline: " + pipelineId + " was not found.");
}
String providerName = input.get(ProviderConfig.PROVIDER_NAME);
Provider provider = null;
ProviderType providerType = null;
PipelineExecutorTaskDef taskDef;
if (providerName != null && !providerName.isEmpty()) {
provider = runtimeRegistry.getProvider(providerName);
}
if (provider == null) {
providerType = pipelineRegistry.getProviderType(pipelineId);
}
if (provider != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, provider);
} else if (providerType != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, providerType);
} else {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
}
return executorTaskManager.execute(taskDef, async ? PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS : PipelineExecutorTaskManager.ExecutionMode.SYNCHRONOUS);
}
use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.
the class InMemoryPipelineRegistryTest method testGetProviderType.
@Test
public void testGetProviderType() {
ProviderType result = pipelineRegistry.getProviderType(PIPELINE_ID);
assertNull(result);
pipelineRegistry.registerPipeline(pipeline, providerType);
result = pipelineRegistry.getProviderType(PIPELINE_ID);
assertEquals(providerType, result);
}
use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.
the class RestRuntimeProvisioningServiceImpl method cacheBeans.
@PostConstruct
public void cacheBeans() {
LOG.info("> Initializing ProviderTypes. ");
final Set<Bean<?>> beans = beanManager.getBeans(ProviderType.class, new AnnotationLiteral<Any>() {
});
for (final Bean b : beans) {
try {
// I don't want to register the CDI proxy, I need a fresh instance :(
ProviderType pt = (ProviderType) b.getBeanClass().newInstance();
LOG.info("> Registering ProviderType: " + pt.getProviderTypeName());
runtimeRegistry.registerProviderType(pt);
} catch (InstantiationException | IllegalAccessException ex) {
LOG.error("Something went wrong with registering Provider Types!", ex);
}
}
}
Aggregations