It's all about the answers!

Ask a question

Automating license upload

Kenny Smith (277412) | asked Mar 29 '19, 4:55 p.m.
edited Mar 29 '19, 4:57 p.m.

 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)
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: CRJAZ0131I Marshaller not defined for type "byte[]".
String iepLicenseId = "";
licenseAdminService.setLicensePurchaseCount(iepLicenseId, 60);

Be the first one to answer this question!

Register or to post your answer.