Added exposure of uninstall (#4567)
* Added exposure of uninstall * Add changelog --------- Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
parent
fb057d4fb1
commit
90895aab57
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
type: add
|
||||
issue: 4567
|
||||
title: "The IPackageInstallerSvc interface for managing NPM packages now exposes an
|
||||
uninstall method. Thanks to Jens Kristian Villadsen for the pull request!"
|
|
@ -23,4 +23,6 @@ public interface IPackageInstallerSvc {
|
|||
|
||||
PackageInstallOutcomeJson install(PackageInstallationSpec theSpec);
|
||||
|
||||
PackageDeleteOutcomeJson uninstall(PackageInstallationSpec theSpec);
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
|||
import ca.uhn.fhir.util.FhirTerser;
|
||||
import ca.uhn.fhir.util.SearchParameterUtil;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -67,7 +66,6 @@ import javax.annotation.Nonnull;
|
|||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -97,8 +95,6 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
|
|||
@Autowired
|
||||
private INpmPackageVersionDao myPackageVersionDao;
|
||||
@Autowired
|
||||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
@Autowired
|
||||
private ISearchParamRegistryController mySearchParamRegistryController;
|
||||
@Autowired
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
@ -133,6 +129,10 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
|
|||
}
|
||||
}
|
||||
|
||||
public PackageDeleteOutcomeJson uninstall(PackageInstallationSpec theInstallationSpec) {
|
||||
return myPackageCacheManager.uninstallPackage(theInstallationSpec.getName(), theInstallationSpec.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and installs an IG from a file on disk or the Simplifier repo using
|
||||
* the {@link IPackageCacheManager}.
|
||||
|
|
|
@ -77,6 +77,22 @@ public class NpmSearchR4Test extends BaseJpaR4Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUninstall(){
|
||||
|
||||
// Arrange
|
||||
byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz");
|
||||
PackageInstallationSpec spec = new PackageInstallationSpec().setName("hl7.fhir.uv.shorthand").setVersion("0.11.1").setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_ONLY).setPackageContents(bytes);
|
||||
|
||||
// Act
|
||||
igInstaller.install(spec);
|
||||
igInstaller.uninstall(spec);
|
||||
|
||||
// Assert
|
||||
assertEquals(0, myPackageCacheManager.search(new PackageSearchSpec()).getTotal());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchByResourceUrl() throws IOException {
|
||||
|
|
Loading…
Reference in New Issue