use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class KarafFeaturesPropertiesFileResolver method uris.
/**
* Returns a map of groupId/artifactId -> artifact
* @param uriStringsFromPatch
* @return
*/
private Map<String, Artifact> uris(List<String> uriStringsFromPatch) {
Map<String, Artifact> result = new LinkedHashMap<>();
for (String uri : uriStringsFromPatch) {
Artifact a = Utils.mvnurlToArtifact(uri, true);
if (a == null) {
continue;
}
String ga = String.format("%s/%s", a.getGroupId(), a.getArtifactId());
result.put(ga, a);
}
return result;
}
use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class SimulateAction method doExecute.
@Override
protected void doExecute(Service service) throws Exception {
Patch patch = service.getPatch(patchId);
if (patch == null) {
throw new PatchException("Patch '" + patchId + "' not found");
}
if (patch.isInstalled()) {
throw new PatchException("Patch '" + patchId + "' is already installed");
}
PatchResult result = service.install(patch, true);
// display(result);
}
use of io.fabric8.insight.metrics.model.Result in project fabric8 by jboss-fuse.
the class ArchetypeXmlTest method testMarshalArchetypes.
@Test
public void testMarshalArchetypes() throws JAXBException {
Archetypes archetypes = new Archetypes();
archetypes.add(new Archetype("foo", "bar", "1.1", "Some name", "Some description"));
archetypes.add(new Archetype("xyz", "whatever", "2.3", "Some other name", "Docs..."));
StringWriter buffer = new StringWriter();
Archetypes.newMarshaller().marshal(archetypes, buffer);
System.out.println("Generated XML: " + buffer);
Object result = Archetypes.newUnmarshaller().unmarshal(new StringReader(buffer.toString()));
if (result instanceof Archetypes) {
assertEquals(2, ((Archetypes) result).getArchetypes().size());
for (Archetype a : ((Archetypes) result).getArchetypes()) {
System.out.println(a);
}
} else {
fail("Found " + result.getClass().getName() + " when expected an " + Archetypes.class.getName());
}
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class DockerBuildServiceTest method testSuccessfulBuild.
@Test
public void testSuccessfulBuild() throws Exception {
new Expectations() {
{
hub.getBuildService();
result = buildService;
}
};
final BuildService.BuildContext context = new BuildService.BuildContext.Builder().build();
final io.fabric8.maven.core.service.BuildService.BuildServiceConfig config = new io.fabric8.maven.core.service.BuildService.BuildServiceConfig.Builder().dockerBuildContext(context).build();
final String imageName = "image-name";
final ImageConfiguration image = new ImageConfiguration.Builder().name(imageName).buildConfig(new BuildImageConfiguration.Builder().from("from").build()).build();
DockerBuildService service = new DockerBuildService(hub, config);
service.build(image);
new FullVerificationsInOrder() {
{
buildService.buildImage(image, context);
buildService.tagImage(imageName, image);
}
};
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class OpenshiftBuildServiceTest method init.
@Before
public void init() throws Exception {
final File dockerFile = new File(baseDir, "Docker.tar");
dockerFile.getParentFile().mkdirs();
dockerFile.createNewFile();
imageStreamFile.delete();
new Expectations() {
{
dockerServiceHub.getArchiveService();
result = archiveService;
archiveService.createDockerBuildArchive(withAny(ImageConfiguration.class.cast(null)), withAny(MojoParameters.class.cast(null)));
result = dockerFile;
minTimes = 0;
project.getArtifact();
result = "myapp";
minTimes = 0;
dockerMojoParameters.getProject();
result = project;
minTimes = 0;
}
};
image = new ImageConfiguration.Builder().name(projectName).buildConfig(new BuildImageConfiguration.Builder().from(projectName).build()).build();
defaultConfig = new BuildService.BuildServiceConfig.Builder().buildDirectory(baseDir).buildRecreateMode(BuildRecreateMode.none).s2iBuildNameSuffix("-s2i-suffix2").openshiftBuildStrategy(OpenShiftBuildStrategy.s2i).dockerMojoParameters(dockerMojoParameters);
}
Aggregations