use of io.fabric8.patch.management.impl.GitPatchManagementServiceImpl in project fabric8 by jboss-fuse.
the class GitPatchManagementServiceIT method initializationPerformedNoFuseVersion.
@Test
public void initializationPerformedNoFuseVersion() throws IOException, GitAPIException {
pm = new GitPatchManagementServiceImpl(bundleContext);
pm.start();
try {
pm.ensurePatchManagementInitialized();
fail("Should fail, because versions can't be determined");
} catch (PatchException e) {
assertTrue(e.getMessage().contains("Can't find"));
}
}
use of io.fabric8.patch.management.impl.GitPatchManagementServiceImpl in project fabric8 by jboss-fuse.
the class GitPatchManagementServiceIT method disabledPatchManagement.
@Test
public void disabledPatchManagement() throws IOException, GitAPIException {
System.setProperty("patching.disabled", "true");
pm = new GitPatchManagementServiceImpl(bundleContext);
pm.start();
assertFalse(pm.isEnabled());
System.setProperty("patching.disabled", "");
}
use of io.fabric8.patch.management.impl.GitPatchManagementServiceImpl in project fabric8 by jboss-fuse.
the class PatchManagementIT method init.
@Before
public void init() throws IOException, GitAPIException {
super.init(true, true);
pm = new GitPatchManagementServiceImpl(bundleContext);
((GitPatchManagementServiceImpl) pm).start();
// prepare some ZIP patches
preparePatchZip("src/test/resources/content/patch1", "target/karaf/patches/source/patch-1.zip", false);
preparePatchZip("src/test/resources/content/patch3", "target/karaf/patches/source/patch-3.zip", false);
}
use of io.fabric8.patch.management.impl.GitPatchManagementServiceImpl in project fabric8 by jboss-fuse.
the class ProtectedTest method updateEtcConfigReferences.
@Test
public void updateEtcConfigReferences() throws IOException {
File etcConfig = new File(git.getRepository().getWorkTree(), "etc/config.properties");
FileUtils.copyFile(new File("src/test/resources/files/etc/config.properties"), etcConfig);
List<BundleUpdate> bundleUpdates = new LinkedList<>();
bundleUpdates.add(BundleUpdate.from("mvn:org.eclipse/osgi/3.9.1-v20140110-1610").to("mvn:org.eclipse/osgi/3.9.1-v20151231-2359"));
bundleUpdates.add(BundleUpdate.from("mvn:org.apache.felix/org.apache.felix.framework/4.4.1").to("mvn:org.apache.felix/org.apache.felix.framework/4.4.2"));
Map<String, String> updates = Utils.collectLocationUpdates(bundleUpdates);
new GitPatchManagementServiceImpl(context).updateReferences(git, "etc/config.properties", "${karaf.default.repository}/", updates, false);
String expected = FileUtils.readFileToString(new File("src/test/resources/files/etc/config.properties.updated"));
String changed = FileUtils.readFileToString(etcConfig);
assertThat(changed, equalTo(expected));
}
use of io.fabric8.patch.management.impl.GitPatchManagementServiceImpl in project fabric8 by jboss-fuse.
the class ProtectedTest method updateBinAdminBatReferences.
@Test
public void updateBinAdminBatReferences() throws IOException {
File binAdmin = new File(git.getRepository().getWorkTree(), "bin/admin.bat");
FileUtils.copyFile(new File("src/test/resources/files/bin/admin.bat"), binAdmin);
List<BundleUpdate> bundleUpdates = new LinkedList<>();
bundleUpdates.add(BundleUpdate.from("mvn:org.apache.karaf.admin/org.apache.karaf.admin.core/2.4.0.redhat-620133").to("mvn:org.apache.karaf.admin/org.apache.karaf.admin.core/2.4.0.redhat-630134"));
Map<String, String> updates = Utils.collectLocationUpdates(bundleUpdates);
new GitPatchManagementServiceImpl(context).updateReferences(git, "bin/admin.bat", "system/", updates, true);
String expected = FileUtils.readFileToString(new File("src/test/resources/files/bin/admin.bat.updated"));
String changed = FileUtils.readFileToString(binAdmin);
assertThat(changed, equalTo(expected));
}
Aggregations