Automating license upload
I am trying to automate the install of an environment for various testing and education purposes. I would like, as part of my scripted setup, to be able to upload a license file. However, I've hit a brick wall. I can find no ANT or REST api to access the license service. I was able to find the ILicenseAdminService in the Java API however. The problem, though is that when trying to upload a license file, I get a Java error (MarshallerNotDefinedException) that I cannot get past. The code I use is posted below.
Is anyone aware of any method to automate uploading a license without having to go through the Web UI manually?
private static void setupLicenses(Properties props, ITeamRepository repo)
throws IOException, TeamRepositoryException {
// Add a complete developer license to allow all students to access
// ILicenseAdminService2 licenseAdminService = (ILicenseAdminService2)
// ((TeamRepository) repo)
// .getServiceInterface(ILicenseAdminService2.class);
ILicenseAdminService licenseAdminService = (ILicenseAdminService) ((IClientLibraryContext) repo)
.getServiceInterface(ILicenseAdminService.class);
UsedLicenseInfoDTO licenseInfo;
// licenseInfo = licenseAdminService.
String iepFileLocation = props.getProperty("license.developer.iep");
Path path = Paths.get(iepFileLocation);
byte[] licenseFileContents = Files.readAllBytes(path);
///Below line generates the following error:
Mar 15, 2019 10:44:26 AM com.strongback.rtc.setup.SetupManager setupProject
WARNING: com.ibm.team.repository.common.internal.marshal.MarshallerNotDefinedException: CRJAZ0131I Marshaller not defined for type "byte[]"./
licenseAdminService.addLicense(licenseFileContents);
String iepLicenseId = "com.ibm.rtc.developer-iep.floating";
licenseAdminService.setLicensePurchaseCount(iepLicenseId, 60);
}