use of io.fabric8.insight.metrics.model.Result in project docker-maven-plugin by fabric8io.
the class VolumeServiceTest method testRemoveVolume.
@Test
public void testRemoveVolume() throws Exception {
VolumeConfiguration vc = new VolumeConfiguration.Builder().name("testVolume").driver("test").opts(withMap("opts")).labels(withMap("labels")).build();
new Expectations() {
{
docker.createVolume((VolumeCreateConfig) any);
result = "testVolume";
docker.removeVolume("testVolume");
}
};
VolumeService volumeService = new VolumeService(docker);
String name = volumeService.createVolume(vc);
volumeService.removeVolume(name);
}
use of io.fabric8.insight.metrics.model.Result in project docker-maven-plugin by fabric8io.
the class VolumeServiceTest method testCreateVolume.
@Test
public void testCreateVolume() throws Exception {
VolumeConfiguration vc = new VolumeConfiguration.Builder().name("testVolume").driver("test").opts(withMap("opts")).labels(withMap("labels")).build();
new Expectations() {
{
docker.createVolume((VolumeCreateConfig) any);
result = "testVolume";
}
};
assertThat(vc.getName(), is("testVolume"));
String name = new VolumeService(docker).createVolume(vc);
assertThat(name, is("testVolume"));
}
use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class DeploymentUpdater method updateDeployment.
public void updateDeployment(Git git, File baseDir, CredentialsProvider credentials) throws Exception {
Set<String> bundles = new LinkedHashSet<String>();
Set<Feature> features = new LinkedHashSet<Feature>();
Profile overlayProfile = container.getOverlayProfile();
Profile effectiveProfile = Profiles.getEffectiveProfile(fabricService, overlayProfile);
bundles.addAll(effectiveProfile.getBundles());
AgentUtils.addFeatures(features, fabricService, downloadManager, effectiveProfile);
if (copyFilesIntoGit) {
copyDeploymentsIntoGit(git, baseDir, bundles, features);
} else {
addDeploymentsIntoPom(git, baseDir, effectiveProfile, bundles, features);
}
// now lets do a commit
String message = "updating deployment";
git.commit().setMessage(message).call();
enableDeployDirectory(git, baseDir);
String branch = GitHelpers.currentBranch(git);
LOG.info("Pushing deployment changes to branch " + branch + " credentials " + credentials + " for container " + container.getId());
try {
Iterable<PushResult> results = git.push().setCredentialsProvider(credentials).setRefSpecs(new RefSpec(branch)).setOutputStream(new LoggingOutputStream(LOG)).call();
/*
for (PushResult result : results) {
LOG.info(result.getMessages());
}
*/
LOG.info("Pushed deployment changes to branch " + branch + " for container " + container.getId());
} catch (GitAPIException e) {
LOG.error("Failed to push deployment changes to branch " + branch + " for container " + container.getId() + ". Reason: " + e, e);
}
}
use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class ApmAgentContext method buildDeltaList.
public List<ClassInfo> buildDeltaList() {
List<ClassInfo> result = new ArrayList<>();
for (ClassInfo classInfo : allMethods.values()) {
if (classInfo.isTransformed()) {
// check to see its still should be audited
if (configuration.isAudit(classInfo.getClassName())) {
boolean retransform = false;
// check to see if there's a change to methods that should be transformed
Set<String> transformedMethodNames = classInfo.getAllTransformedMethodNames();
for (String methodName : transformedMethodNames) {
if (!configuration.isAudit(classInfo.getClassName(), methodName)) {
retransform = true;
break;
}
}
if (!retransform) {
// check to see if there are methods that should now be audited but weren't
Set<String> allMethodNames = classInfo.getAllMethodNames();
for (String methodName : allMethodNames) {
if (!transformedMethodNames.contains(methodName) && configuration.isAudit(classInfo.getClassName(), methodName)) {
retransform = true;
break;
}
}
}
if (retransform) {
result.add(classInfo);
}
} else {
// we were once audited - but now need to be removed
result.add(classInfo);
}
} else if (configuration.isAudit(classInfo.getClassName())) {
if (classInfo.isCanTransform()) {
result.add(classInfo);
}
}
}
return result;
}
use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class MavenUploadProxyServlet method handleDeploy.
private void handleDeploy(HttpServletRequest req, UploadContext result) throws Exception {
String profile = req.getParameter("profile");
String version = req.getParameter("version");
if (profile != null && version != null) {
ProjectRequirements requirements = toProjectRequirements(result);
requirements.setProfileId(profile);
requirements.setVersion(version);
DeployResults deployResults = addToProfile(requirements);
LOGGER.info(String.format("Deployed artifact %s to profile: %s", result.toArtifact(), deployResults));
}
}
Aggregations