use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class VerifyFeatureResolutionMojo method verifyResolution.
private void verifyResolution(DownloadManager manager, Map<String, Feature> allFeatures, String feature, Hashtable<String, String> properties) throws MojoExecutionException {
try {
properties.put("feature.totest", feature);
FakeSystemBundle systemBundle = getSystemBundleResource(getMetadata(properties, "metadata#"));
FakeServiceReference profileHandlerSR = new FakeServiceReference(URLStreamHandlerService.class.getName(), "(url.handler.protocol=profile2)");
systemBundle.setServiceReferences(URLStreamHandlerService.class.getName(), null, new ServiceReference[] { profileHandlerSR });
systemBundle.setService(profileHandlerSR, new Object());
Agent agent = new Agent(null, systemBundle, manager);
agent.setOptions(EnumSet.of(io.fabric8.agent.service.Constants.Option.Simulate, io.fabric8.agent.service.Constants.Option.Silent));
try {
agent.provision(allFeatures, getPrefixedProperties(properties, "feature."), getPrefixedProperties(properties, "bundle."), getPrefixedProperties(properties, "req."), getPrefixedProperties(properties, "override."), getPrefixedProperties(properties, "optional."), getMetadata(properties, "metadata#"));
} catch (Exception e) {
Set<String> resources = new TreeSet<>(manager.getProviders().keySet());
throw new MojoExecutionException("Feature resolution failed for " + feature + "\nMessage: " + e.toString() + "\nResources: " + toString(resources), e);
}
} catch (MojoExecutionException e) {
throw e;
} catch (Exception e) {
throw new MojoExecutionException("Error verifying feature " + feature + "\nMessage: " + e.getMessage(), e);
}
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class DeployToProfileMojoTest method before.
// Fixtures setup
@Before
public void before() {
mojo.fabricServer = mock(Server.class);
project = new MavenProject();
project.setGroupId("io.fabric8");
project.setArtifactId("artifact");
project.setVersion(FABRIC_VERSION);
mojo.project = project;
deployResults = new DeployResults();
deployResults.setProfileId("profileId");
deployResults.setVersionId("versionId");
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class ProfileEditAction method editProfile.
private void editProfile(Profile profile) throws Exception {
boolean editInLine = false;
ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
if (delete || remove) {
editInLine = true;
}
if (features != null && features.length > 0) {
editInLine = true;
handleFeatures(builder, features, profile);
}
if (repositories != null && repositories.length > 0) {
editInLine = true;
handleFeatureRepositories(builder, repositories, profile);
}
if (libs != null && libs.length > 0) {
editInLine = true;
handleLibraries(builder, libs, profile, "lib", LIB_PREFIX);
}
if (endorsed != null && endorsed.length > 0) {
editInLine = true;
handleLibraries(builder, endorsed, profile, "endorsed lib", ENDORSED_PREFIX);
}
if (extension != null && extension.length > 0) {
editInLine = true;
handleLibraries(builder, extension, profile, "extension lib", EXT_PREFIX);
}
if (bundles != null && bundles.length > 0) {
editInLine = true;
handleBundles(builder, bundles, profile);
}
if (fabs != null && fabs.length > 0) {
editInLine = true;
handleFabs(builder, fabs, profile);
}
if (overrides != null && overrides.length > 0) {
editInLine = true;
handleOverrides(builder, overrides, profile);
}
if (pidProperties != null && pidProperties.length > 0) {
editInLine = handlePid(builder, pidProperties, profile);
}
if (systemProperties != null && systemProperties.length > 0) {
editInLine = true;
handleSystemProperties(builder, systemProperties, profile);
}
if (configProperties != null && configProperties.length > 0) {
editInLine = true;
handleConfigProperties(builder, configProperties, profile);
}
if (resource != null && delete) {
editInLine = true;
builder.deleteFileConfiguration(resource);
}
profileService.updateProfile(builder.getProfile());
if (!editInLine) {
resource = resource != null ? resource : "io.fabric8.agent.properties";
// then open the resource in the editor.
if (pidProperties != null && pidProperties.length == 1) {
resource = pidProperties[0] + ".properties";
}
openInEditor(profile, resource);
}
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class FabricGitSummaryAction method performContainerAction.
@Override
protected void performContainerAction(String queuePath, String containerName) throws Exception {
JMXRequest containerRequest = new JMXRequest().withObjectName("io.fabric8:type=Fabric").withMethod("gitVersions");
requests.put(containerName, containerRequest);
String command = map(containerRequest);
curator.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(queuePath, PublicStringSerializer.serialize(command));
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class FabricGitSummaryAction method beforeEachContainer.
@Override
protected void beforeEachContainer(Collection<String> names) throws Exception {
// first, we need summary from fabric-git-server (to have something to compare local git repositories to)
master = fabricService.getGitMaster();
if (master == null) {
System.out.println("Can't find container which is current git master");
return;
}
System.out.println("Git master is: " + master);
// ask master about the status first
String queuePath = ZkPath.COMMANDS_REQUESTS_QUEUE.getPath(master);
masterRequest = new JMXRequest().withObjectName("io.fabric8:type=GitServer").withMethod("gitVersions");
String command = map(masterRequest);
curator.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(queuePath, PublicStringSerializer.serialize(command));
}
Aggregations