use of rhsm.data.Repo in project rhsm-qe by RedHatQE.
the class ReposTests method testReposDisable.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20388", "RHEL7-51676" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "subscription-manager: disable a repo.", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testReposDisable() throws JSONException, Exception {
// register
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, false, null, null, null, null);
clienttasks.subscribeToTheCurrentlyAvailableSubscriptionPoolsCollectively();
List<Repo> subscribedRepos = clienttasks.getCurrentlySubscribedRepos();
// reduce the runtime of this test by randomly reducing the subscribedRepos tested
subscribedRepos = getRandomSubsetOfList(subscribedRepos, 5);
if (subscribedRepos.isEmpty())
throw new SkipException("There are no entitled repos available for this test.");
for (Repo repo : subscribedRepos) {
SSHCommandResult result = clienttasks.repos_(false, null, null, null, repo.repoId, null, null, null, null);
String expectedStdout = String.format("Repo %s is disabled for this system.", repo.repoId);
// subscription-manager commit b9e7f7abb949bc007f2db02662e2abba76528082
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.10.7-1"))
expectedStdout = String.format("Repo '%s' is disabled for this system.", repo.repoId);
// bug 1122530 commit add5a9b746f9f2af147a7e4622b897a46b5ef132
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.6-1"))
expectedStdout = String.format("Repository '%s' is disabled for this system.", repo.repoId);
Assert.assertEquals(result.getStdout().trim(), expectedStdout);
}
}
use of rhsm.data.Repo in project rhsm-qe by RedHatQE.
the class RHUITests method testDownloadRHUIISOFromFileRepo.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-22305", "RHEL7-55202" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier1")
@Test(description = "download an expected RHUI iso from an expected file repoUrl", // RHEL-6-RHUI-2-LATEST-Server-x86_64-DVD.iso ERROR 404: Not Found. https://projects.engineering.redhat.com/browse/RCMPROJ-6571
groups = { "Tier1Tests", "blockedByBug-860516", "blockedByBug-894184", "blockedByBug-1427516" }, dependsOnMethods = { "testConsumeRHUISubscriptionProduct" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testDownloadRHUIISOFromFileRepo() {
if (sm_rhuiDownloadIso.equals(""))
throw new SkipException("Skipping this test when no value was given for the RHUI Download ISO");
File downloadedIsoFile = new File("/tmp/" + sm_rhuiDownloadIso);
RemoteFileTasks.runCommandAndAssert(client, "rm -rf " + downloadedIsoFile, 0);
// find the repo for the isos
ContentNamespace contentNamespaceForIso = null;
for (EntitlementCert entitlementCert : clienttasks.getCurrentEntitlementCerts()) {
for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
if (contentNamespace.label.equals(sm_rhuiRepoIdForIsos)) {
contentNamespaceForIso = contentNamespace;
break;
}
}
}
Assert.assertNotNull(contentNamespaceForIso, "Found expected ContentNamespace to repoId '" + sm_rhuiRepoIdForIsos + "' for rhui isos after subscribe to '" + sm_rhuiSubscriptionProductId + "'.");
String repoUrl = clienttasks.baseurl + contentNamespaceForIso.downloadUrl;
// assert available repos for "Red Hat Enterprise Linux Server from RHUI" (when not a server, no content should exist)
List<Repo> repos = clienttasks.getCurrentlySubscribedRepos();
if (clienttasks.releasever.contains("Server")) {
Assert.assertMore(repos.size(), 0, "When consuming RHUI Product ID '" + sm_rhuiSubscriptionProductId + "' on a Server '" + clienttasks.releasever + "' system, repo content should be available.");
} else {
Assert.assertEquals(repos.size(), 0, "When consuming RHUI Product ID '" + sm_rhuiSubscriptionProductId + "' on a non-Server '" + clienttasks.releasever + "' system, repo content should NOT be available.");
// RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
throw new SkipException("This system release is '" + clienttasks.releasever + "'. RHUI ISO '" + sm_rhuiDownloadIso + "' requires Server for downloading.");
}
// substitute the yum vars
// http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-yum-useful-variables.html
// http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-yum-useful-variables.html
String arch = Arrays.asList("i686", "i486", "i386").contains(clienttasks.arch) ? "i386" : clienttasks.arch;
// RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
if (!sm_rhuiDownloadIso.contains(arch))
throw new SkipException("When this system's arch (" + arch + ") is substituted into the repoUrl (" + repoUrl + "), it will not find RHUI ISO (" + sm_rhuiDownloadIso + ") for downloading.");
repoUrl = repoUrl.replaceFirst("\\$releasever", clienttasks.releasever);
repoUrl = repoUrl.replaceFirst("\\$basearch", arch);
File entitlementKeyFile = clienttasks.getEntitlementCertKeyFileCorrespondingToEntitlementCertFile(entitlementCertFile);
// $ wget --certificate=<Content Certificate> https://cdn.redhat.com/content/dist/rhel/rhui/server/6/6Server/x86_64/rhui/2.0/iso/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
// wget --no-check-certificate --certificate=/etc/pki/entitlement/7658526340059785943.pem --private-key=/etc/pki/entitlement/7658526340059785943-key.pem --output-document=/tmp/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso -- https://cdn.redhat.com/content/dist/rhel/rhui/server/6/6Server/x86_64/rhui/2.0/iso/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
RemoteFileTasks.runCommandAndAssert(client, "wget --no-check-certificate --certificate=" + entitlementCertFile + " --private-key=" + entitlementKeyFile + " --output-document=" + downloadedIsoFile + " -- " + repoUrl + "/" + sm_rhuiDownloadIso, 0);
Assert.assertTrue(RemoteFileTasks.testExists(client, downloadedIsoFile.getPath()), "Expected RHUI Download ISO was downloaded.");
}
use of rhsm.data.Repo in project rhsm-qe by RedHatQE.
the class RHUITests method testDownloadRHUIISOFromYumRepo_DEPRECATED.
@Test(description = "download an expected RHUI iso from an expected yum repoUrl", groups = { "Tier1Tests" }, dependsOnMethods = { "testConsumeRHUISubscriptionProduct" }, // this download file methodology will NOT work for a file; replaced by DownloadRHUIISOFromFileRepo_Test()
enabled = false)
@Deprecated
public // @ImplementsNitrateTest(caseId=)
void testDownloadRHUIISOFromYumRepo_DEPRECATED() {
if (sm_rhuiDownloadIso.equals(""))
throw new SkipException("Skipping this test when no value was given for the RHUI Download ISO");
File downloadedIsoFile = new File("/tmp/" + sm_rhuiDownloadIso);
RemoteFileTasks.runCommandAndAssert(client, "rm -rf " + downloadedIsoFile, 0);
// find the repo for the isos
Repo repoForIsos = Repo.findFirstInstanceWithMatchingFieldFromList("repoId", sm_rhuiRepoIdForIsos, clienttasks.getCurrentlySubscribedRepos());
Assert.assertNotNull(repoForIsos, "Found expected repoId for rhui isos after subscribe to '" + sm_rhuiSubscriptionProductId + "'.");
String repoUrl = repoForIsos.repoUrl;
repoUrl = repoUrl.replaceFirst("\\$releasever", clienttasks.releasever);
repoUrl = repoUrl.replaceFirst("\\$basearch", clienttasks.arch);
File entitlementKeyFile = clienttasks.getEntitlementCertKeyFileCorrespondingToEntitlementCertFile(entitlementCertFile);
// $ wget --certificate=<Content Certificate> https://cdn.redhat.com/content/dist/rhel/rhui/server/6/6Server/x86_64/rhui/2.0/iso/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
// wget --no-check-certificate --certificate=/etc/pki/entitlement/7658526340059785943.pem --private-key=/etc/pki/entitlement/7658526340059785943-key.pem --output-document=/tmp/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso -- https://cdn.redhat.com/content/dist/rhel/rhui/server/6/6Server/x86_64/rhui/2.0/iso/RHEL-6.1-RHUI-2.0-LATEST-Server-x86_64-DVD.iso
RemoteFileTasks.runCommandAndAssert(client, "wget --no-check-certificate --certificate=" + entitlementCertFile + " --private-key=" + entitlementKeyFile + " --output-document=" + downloadedIsoFile + " -- " + repoUrl + "/" + sm_rhuiDownloadIso, 0);
Assert.assertEquals(RemoteFileTasks.testFileExists(client, downloadedIsoFile.getPath()), 1, "Expected RHUI Download ISO was downloaded.");
}
use of rhsm.data.Repo in project rhsm-qe by RedHatQE.
the class CertificateTests method getVerifyBaseRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists.
protected List<List<Object>> getVerifyBaseRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists() {
List<List<Object>> ll = new ArrayList<List<Object>>();
if (!isSetupBeforeSuiteComplete)
return ll;
if (clienttasks == null)
return ll;
// unregister
clienttasks.unregister(null, null, null, null);
// get the currently installed RHEL product cert
ProductCert rhelProductCert = clienttasks.getCurrentRhelProductCert();
// rhel product cert cannot be subscribed if a rhel product cert is not installed
if (rhelProductCert == null)
throw new SkipException("Failed to find an installed RHEL product cert.");
// register with autosubscribe
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, null, null, null, null, null, null);
// find the autosubscribed entitlement that provides access to RHEL content
List<EntitlementCert> rhelEntitlementCerts = clienttasks.getEntitlementCertsProvidingProductCert(rhelProductCert);
if (rhelEntitlementCerts.isEmpty()) {
log.warning("Could not find an entitlement to a RHEL subscription.");
return ll;
}
// EntitlementCert rhelEntitlementCert = clienttasks.getEntitlementCertsProvidingProductCert(rhelProductCert).get(0);
EntitlementCert rhelEntitlementCert = rhelEntitlementCerts.get(0);
// get the cacert file
File caCertFile = new File(clienttasks.getConfParameter("repo_ca_cert"));
// get the baseurl
String baseurl = clienttasks.getConfParameter("baseurl");
// get the repo url to the currently enabled base RHEL repo (assume it ends in /6/$releasever/$basearch/os
// get the list of currently enabled repos
// [root@jsefler-os6 ~]# subscription-manager repos --list-enabled
// +----------------------------------------------------------+
// Available Repositories in /etc/yum.repos.d/redhat.repo
// +----------------------------------------------------------+
// Repo ID: rhel-6-server-rpms
// Repo Name: Red Hat Enterprise Linux 6 Server (RPMs)
// Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/os
// Enabled: 1
// [root@amd-dinar-01 ~]# subscription-manager repos --list-enabled
// +----------------------------------------------------------+
// Available Repositories in /etc/yum.repos.d/redhat.repo
// +----------------------------------------------------------+
// Repo ID: rhel-rs-for-rhel-7-server-eus-rpms
// Repo Name: Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)
// Repo URL: https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/resilientstorage/os
// Enabled: 1
//
// Repo ID: rhel-ha-for-rhel-7-server-eus-rpms
// Repo Name: Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)
// Repo URL: https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/highavailability/os
// Enabled: 1
//
// Repo ID: rhel-7-server-eus-rpms
// Repo Name: Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)
// Repo URL: https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/os
// Enabled: 1
//
// Repo ID: rhel-7-server-rpms
// Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
// Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
// Enabled: 1
// RHEL-ALT Repos:
// Product 419 aarch64 Repo rhel-7-for-arm-64-rpms URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/armv8-a/$basearch/os
// Product 420 ppc64le Repo rhel-7-for-power-9-rpms URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/power9/$basearch/os
// Product 434 s390x Repo rhel-7-for-system-z-a-rpms URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/system-z-a/$basearch/os
String rhelRepoUrl = null;
for (Repo enabledRepo : Repo.parse(clienttasks.repos(null, true, false, (String) null, (String) null, null, null, null, null).getStdout())) {
if (enabledRepo.enabled) {
// if (enabledRepo.repoUrl.endsWith(clienttasks.redhatReleaseX+"/$releasever/$basearch/os")) { // does not match the RHEL-ALT repos
if (enabledRepo.repoUrl.matches(baseurl + "([\\w/-]+)*/" + clienttasks.redhatReleaseX + "/\\$releasever/([\\w/-]+/)*\\$basearch/os")) {
// skip Extended Update Support repos
if (enabledRepo.repoUrl.contains("/eus/"))
continue;
if (rhelRepoUrl != null && !rhelRepoUrl.equals(enabledRepo.repoUrl)) {
Assert.fail("Excluding EUS, encountered multiple enabled repos that appear to serve the base RHEL content. Did not expect this:\n " + rhelRepoUrl + "\n " + enabledRepo.repoUrl);
}
rhelRepoUrl = enabledRepo.repoUrl;
}
}
}
// add each available release as a row to the dataProvider
for (String release : clienttasks.getCurrentlyAvailableReleases(null, null, null, null)) {
List<String> bugIds = new ArrayList<String>();
// https://pp.engineering.redhat.com/pp/product/rhel/overview
if (release.startsWith("6")) {
// Bug 1214856 - cdn.redhat.com has the wrong productId version for rhel 6.2 and 6.4
if (release.equals("6.2"))
bugIds.add("1214856");
// Bug 1214856 - cdn.redhat.com has the wrong productId version for rhel 6.2 and 6.4
if (release.equals("6.4"))
bugIds.add("1214856");
// Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
if (release.equals("6.2") && clienttasks.variant.equals("Server") && clienttasks.arch.matches("i386|ppc64|s390x"))
bugIds.add("1559114");
// Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
if (release.equals("6.4") && clienttasks.variant.equals("Server") && clienttasks.arch.matches("i386|ppc64|s390x"))
bugIds.add("1559114");
// Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
if (release.equals("6.2") && clienttasks.variant.matches("Workstation|Client|ComputeNode"))
bugIds.add("1559114");
// Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
if (release.equals("6.4") && clienttasks.variant.matches("Workstation|Client|ComputeNode"))
bugIds.add("1559114");
// Bug 1302409 - cdn.redhat.com has the wrong productId version for rhel 6.6
if (release.equals("6.6") && clienttasks.variant.matches("Client|Server") && clienttasks.arch.matches("i\\d86"))
bugIds.add("1302409");
}
if (release.startsWith("7")) {
// Bug 1261163 - uncertain of expected release listing on rhel72 arm system
if (release.equals("7.2") && clienttasks.arch.equals("aarch64"))
bugIds.add("1261163");
// Bug 1441281 - production CDN productid files 404: Not Found. for ARM releasever 7.2
if (release.equals("7.2") && clienttasks.arch.equals("aarch64"))
bugIds.add("1441281");
// Bug 1261171 - uncertain of expected release listing on rhel72 ppc64le system
if (release.equals("7.2") && clienttasks.arch.equals("ppc64le"))
bugIds.add("1261171");
// Bug 1267732 - production CDN productid files 404: Not Found. for ComputeNode releasever 7.1 and 7Server
if (release.equals("7.2") && clienttasks.variant.equals("ComputeNode") && release.equals("7.1"))
bugIds.add("1267732");
// Bug 1267732 - production CDN productid files 404: Not Found. for ComputeNode releasever 7.1 and 7Server
if (release.equals("7.2") && clienttasks.variant.equals("ComputeNode") && release.equals("7ComputeNode"))
bugIds.add("1267732");
// Bug 1338857 - cdn.redhat.com has the wrong productId version for rhel 7.2
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("x86_64"))
bugIds.add("1338857");
// Bug 1356738 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/s390x and server/7/7Server/s390x
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
bugIds.add("1356738");
// Bug 1356740 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/ppc64 and server/7/7Server/ppc64
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64"))
bugIds.add("1356740");
// Bug 1356710 - cdn.redhat.com has the wrong repodata/productId version at workstation/7/7.2 and workstation/7/7Workstation
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Workstation") && clienttasks.arch.equals("x86_64"))
bugIds.add("1356710");
// Bug 1356722 - cdn.redhat.com has the wrong repodata/productId version at computenode/7/7.2 and computenode/7/7ComputeNode
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("ComputeNode") && clienttasks.arch.equals("x86_64"))
bugIds.add("1356722");
// Bug 1356729 - cdn.redhat.com has the wrong repodata/productId version at client/7/7.2 and client/7/7Client
if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Client") && clienttasks.arch.equals("x86_64"))
bugIds.add("1356729");
// Bug 1351754 - production CDN productid files 404: Not Found. for Power, little endian releasever 7.1, 7.2, and 7Server
if (release.matches("7.0|7.1|7.2") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64le"))
bugIds.add("1351754");
// Bug 1351800 - production CDN productid files 404: Not Found. for ARM releasever 7.1, 7.2, and 7Server
if (release.matches("7.*") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("aarch64"))
bugIds.add("1351800");
}
BlockedByBzBug blockedByBzBug = new BlockedByBzBug(bugIds.toArray(new String[] {}));
// Object blockedByBug, String release, String rhelRepoUrl, File rhelEntitlementCertFile, File caCertFile
ll.add(Arrays.asList(new Object[] { blockedByBzBug, release, rhelRepoUrl, rhelEntitlementCert.file, caCertFile }));
}
return ll;
}
use of rhsm.data.Repo in project rhsm-qe by RedHatQE.
the class BugzillaTests method testNoMultipleReposCreated.
/**
* @author skallesh
* @throws Exception
* @throws JSONException
*/
@SuppressWarnings("unused")
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21916", "RHEL7-51777" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "verify if no multiple repos are created,if subscribed to a product that share one or more engineering subscriptions", groups = { "Tier3Tests", "NoMultipleReposCreated" }, enabled = true)
public void testNoMultipleReposCreated() throws JSONException, Exception {
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
String consumerId = clienttasks.getCurrentConsumerId();
ownerKey = CandlepinTasks.getOwnerKeyOfConsumerId(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, consumerId);
CandlepinTasks.deleteSubscriptionsAndRefreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, sm_clientOrg, "multi-stackable");
CandlepinTasks.refreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, ownerKey);
String resourcePath = "/products/multi-stackable";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
// right now
Calendar calendar = new GregorianCalendar();
Date todaysDate = calendar.getTime();
calendar.add(Calendar.YEAR, 1);
calendar.add(Calendar.DATE, 10);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
// avoid times in the middle of the
calendar.set(Calendar.SECOND, 0);
// day
Date futureDate = calendar.getTime();
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("sockets", "8");
attributes.put("arch", "ALL");
attributes.put("type", "MKT");
attributes.put("multi-entitlement", "yes");
attributes.put("stacking_id", "726409");
List<String> providedProducts = new ArrayList<String>();
providedProducts.add("100000000000002");
providedProducts.add("100000000000001");
CandlepinTasks.createProductUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, sm_clientOrg, "Multi-Stackable", "multi-stackable", 1, attributes, null);
String requestBody = CandlepinTasks.createSubscriptionRequestBody(sm_serverUrl, 20, todaysDate, futureDate, "multi-stackable", Integer.valueOf(getRandInt()), Integer.valueOf(getRandInt()), providedProducts, null).toString();
CandlepinTasks.postResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, "/owners/" + ownerKey + "/subscriptions", requestBody);
JSONObject jobDetail = CandlepinTasks.refreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, ownerKey);
CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, jobDetail, "FINISHED", 5 * 1000, 1);
sleep(3 * 60 * 1000);
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
for (SubscriptionPool pools : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
if (pools.subscriptionName.equals("Multi-Stackable")) {
clienttasks.subscribe_(null, null, pools.poolId, null, null, null, null, null, null, null, null, null, null);
}
}
String productIdOne = null;
List<Repo> originalRepos = clienttasks.getCurrentlySubscribedRepos();
for (Repo repo : originalRepos) {
String productIdTwo = null;
productIdOne = repo.repoId;
if (!(productIdTwo == null)) {
Assert.assertNotSame(repo.repoId, productIdOne);
}
productIdTwo = productIdOne;
}
CandlepinTasks.deleteSubscriptionsAndRefreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, sm_clientOrg, "multi-stackable");
CandlepinTasks.refreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, ownerKey);
resourcePath = "/products/multi-stackable";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
}
Aggregations