Search in sources :

Example 31 with EntitlementCert

use of rhsm.data.EntitlementCert in project rhsm-qe by RedHatQE.

the class OstreeTests method getOstreeSubscriptionPoolsDataAsListOfLists.

protected List<List<Object>> getOstreeSubscriptionPoolsDataAsListOfLists() throws JSONException, Exception {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (!checkPackageVersionBeforeClass())
        return ll;
    // disable /etc/rhsm/pluginconf.d/ostree_content.OstreeContentPlugin.conf while this dataProvider runs
    clienttasks.updateConfFileParameter(ostreeContentPluginFile.getPath(), "enabled", "0");
    // register the host
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, false, null, null, (String) null, null, null, null, true, false, null, null, null, null);
    // attach each available pool in search of ones that provide content of type="ostree"
    List<SubscriptionPool> currentlyAvailableSubscriptionPools = clienttasks.getCurrentlyAvailableSubscriptionPools();
    // 37091 Product Name:   Awesome OS OStree Bits
    if (sm_serverType.equals(CandlepinType.standalone))
        currentlyAvailableSubscriptionPools = clienttasks.getCurrentlyAvailableSubscriptionPools("37091", sm_serverUrl);
    // /*debugTesting DO NOT COMMIT THIS LINE UNCOMMENTED */ if (sm_serverType.equals(CandlepinType.hosted)) currentlyAvailableSubscriptionPools = clienttasks.getCurrentlyAvailableSubscriptionPools("272", sm_serverUrl);	// 272 Product Name:   Red Hat Enterprise Linux Atomic Host Beta
    for (SubscriptionPool subscriptionPool : currentlyAvailableSubscriptionPools) {
        File serialPemFile = clienttasks.subscribeToSubscriptionPool_(subscriptionPool);
        EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(serialPemFile);
        if (ContentNamespace.findFirstInstanceWithMatchingFieldFromList("type", "ostree", entitlementCert.contentNamespaces) != null) {
            BlockedByBzBug blockedByBzBug = null;
            // Bug 1153366 - SKU RH00004 should not provide more than one Atomic product
            if (subscriptionPool.productId.equals("RH00004"))
                blockedByBzBug = new BlockedByBzBug("1153366");
            if (subscriptionPool.productId.equals("RH00003"))
                blockedByBzBug = new BlockedByBzBug("1153366");
            // Object bugzilla, SubscriptionPool osTreeSubscriptionPool
            ll.add(Arrays.asList(new Object[] { blockedByBzBug, subscriptionPool }));
        }
    }
    // remove all entitlements
    clienttasks.unsubscribe_(true, (BigInteger) null, null, null, null, null, null);
    // re-register the host to reduce the chance of a RateLimitExceededException
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, false, null, null, (String) null, null, null, null, true, false, null, null, null, null);
    // re-enable /etc/rhsm/pluginconf.d/ostree_content.OstreeContentPlugin.conf
    clienttasks.updateConfFileParameter(ostreeContentPluginFile.getPath(), "enabled", "1");
    return ll;
}
Also used : EntitlementCert(rhsm.data.EntitlementCert) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SubscriptionPool(rhsm.data.SubscriptionPool) File(java.io.File) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug)

Example 32 with EntitlementCert

use of rhsm.data.EntitlementCert in project rhsm-qe by RedHatQE.

the class ContentTests method getEnabledRepoAndSubscriptionPoolDataAsListOfLists.

protected List<List<Object>> getEnabledRepoAndSubscriptionPoolDataAsListOfLists() throws JSONException, Exception {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (clienttasks == null)
        return ll;
    if (sm_clientUsername == null)
        return ll;
    if (sm_clientPassword == null)
        return ll;
    // get the currently installed product certs to be used when checking for conditional content tagging
    List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
    // assure we are freshly registered and process all available subscription pools
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, ConsumerType.system, null, null, null, null, null, (String) null, null, null, null, Boolean.TRUE, false, null, null, null, null);
    for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
        // /*debugTesting*/if (!pool.productId.equals("RH2501844")) continue;
        String quantity = null;
        // when the Suggested quantity is 0, let's specify a quantity to avoid Stdout: Quantity '1' is not a multiple of instance multiplier '2'
        if (pool.suggested != null)
            if (pool.suggested < 1)
                quantity = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId, "instance_multiplier");
        /*if (clienttasks.isPackageVersion("subscription-manager",">=","1.10.3-1"))*/
        File entitlementCertFile = clienttasks.subscribeToSubscriptionPool_(pool, quantity);
        Assert.assertNotNull(entitlementCertFile, "Found the entitlement cert file that was granted after subscribing to pool: " + pool);
        EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
        for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
            if (!contentNamespace.type.equalsIgnoreCase("yum"))
                continue;
            if (contentNamespace.enabled && clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
                String repoLabel = contentNamespace.label;
                // String availableGroup, String installedGroup, String repoLabel, SubscriptionPool pool, String quantity
                ll.add(Arrays.asList(new Object[] { repoLabel, pool, quantity }));
            }
        }
        // minimize the number of dataProvided rows (useful during automated testcase development)
        if (Boolean.valueOf(getProperty("sm.debug.dataProviders.minimize", "false")))
            break;
    }
    // no reason to remain subscribed to any subscriptions
    clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
    return ll;
}
Also used : ContentNamespace(rhsm.data.ContentNamespace) EntitlementCert(rhsm.data.EntitlementCert) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(org.json.JSONObject) ProductCert(rhsm.data.ProductCert) SubscriptionPool(rhsm.data.SubscriptionPool) File(java.io.File)

Example 33 with EntitlementCert

use of rhsm.data.EntitlementCert in project rhsm-qe by RedHatQE.

the class ContentTests method testArchRestrictedContentSetsEntitledAfterSubscribeAllSatisfiesTheSystemArch.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20080", "RHEL7-33076" }, 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 = "Verify that all content sets granted from a subscription pool that are restricted to specific arches satisfy the current system's arch.", groups = { "Tier1Tests", "blockedByBug-706187", "blockedByBug-975520", "VerifyArchRestrictedContentSetsEntitledAfterSubscribeAllSatisfiesTheSystemArch_Test" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testArchRestrictedContentSetsEntitledAfterSubscribeAllSatisfiesTheSystemArch() throws JSONException, Exception {
    // get a list of all of the available poolIds that provide arch-based content sets
    List<List<Object>> subscriptionPoolsDataList = getAllAvailableSubscriptionPoolsProvidingArchBasedContentDataAsListOfLists();
    List<String> archBasedSubscriptionPoolIds = new ArrayList<String>();
    for (List<Object> subscriptionPoolsData : subscriptionPoolsDataList) {
        SubscriptionPool pool = (SubscriptionPool) subscriptionPoolsData.get(0);
        archBasedSubscriptionPoolIds.add(pool.poolId);
    }
    if (archBasedSubscriptionPoolIds.isEmpty())
        throw new SkipException("No subscriptions were found providing non-empty arch-based content.");
    // iterate over several possible system arches
    Map<String, String> factsMap = new HashMap<String, String>();
    for (String systemArch : Arrays.asList(new String[] { "i386", "i586", "i686", "x86_64", "ppc", "ppc64", "ia64", "arm", "s390", "s390x" })) {
        // avoid throttling RateLimitExceededException from IT-Candlepin
        if (CandlepinType.hosted.equals(sm_serverType)) {
            // strategically get a new consumer to avoid 60 repeated API calls from the same consumer
            // re-register as a new consumer
            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);
        } else
            // clienttasks.unsubscribe(true, (BigInteger)null, null, null, null);
            // return all current entitlements (Note: system is already registered by getAllAvailableSubscriptionPoolsProvidingArchBasedContentDataAsListOfLists())
            clienttasks.unsubscribe(true, (BigInteger) null, null, null, null, null, null);
        // fake the system's arch and update the facts
        log.info("Manipulating the system facts into thinking this is a '" + systemArch + "' system...");
        factsMap.put("uname.machine", String.valueOf(systemArch));
        clienttasks.createFactsFileWithOverridingValues(factsMap);
        clienttasks.facts(null, true, null, null, null, null);
        // subscribe to all the arch-based content set pools
        clienttasks.subscribe(false, null, archBasedSubscriptionPoolIds, null, null, null, null, null, null, null, null, null, null);
        // iterate over all of the granted entitlements
        for (EntitlementCert entitlementCert : clienttasks.getCurrentEntitlementCerts()) {
            for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
                if (contentNamespace.arches == null)
                    Assert.fail("This version of subscription-manager does not appear to parse arch restricted content.  Upgrade to a newer build of subscription-manager.");
                List<String> arches = new ArrayList<String>();
                // Note: the arches field can be a comma separated list of values
                if (!contentNamespace.arches.trim().isEmpty())
                    arches.addAll(Arrays.asList(contentNamespace.arches.trim().split(" *, *")));
                // Note: x86 is a general arch to cover all 32-bit intel microprocessors
                if (arches.contains("x86")) {
                    arches.addAll(Arrays.asList("i386", "i486", "i586", "i686"));
                }
                Assert.assertTrue(arches.isEmpty() || arches.contains("ALL") || arches.contains("noarch") || arches.contains(systemArch), "Content label '" + contentNamespace.label + "' restricted to arches '" + contentNamespace.arches + "' granted by entitlement cert '" + entitlementCert.orderNamespace.productName + "' matches the system's arch '" + systemArch + "'.");
            }
        }
    }
}
Also used : EntitlementCert(rhsm.data.EntitlementCert) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ContentNamespace(rhsm.data.ContentNamespace) BigInteger(java.math.BigInteger) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(org.json.JSONObject) SkipException(org.testng.SkipException) SubscriptionPool(rhsm.data.SubscriptionPool) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 34 with EntitlementCert

use of rhsm.data.EntitlementCert in project rhsm-qe by RedHatQE.

the class ContentTests method testEnableDisableManageReposAndVerifyContentAvailable.

// Test methods ***********************************************************************
@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-25987", "RHEL7-51485" }, 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 = "Tier2")
@Test(description = "subscription-manager Yum plugin: enable/disable", groups = { "Tier2Tests", "FipsTests", "EnableDisableManageReposAndVerifyContentAvailable_Test", "blockedByBug-804227", "blockedByBug-871146", "blockedByBug-905546", "blockedByBug-1017866" }, // dataProvider="getAvailableSubscriptionPoolsData",	// very thorough, but takes too long to execute and rarely finds more bugs
dataProvider = "getRandomSubsetOfAvailableSubscriptionPoolsData", enabled = true)
@ImplementsNitrateTest(caseId = 41696, fromPlan = 2479)
public void testEnableDisableManageReposAndVerifyContentAvailable(SubscriptionPool pool) throws JSONException, Exception {
    // get the currently installed product certs to be used when checking for conditional content tagging
    List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
    log.info("Before beginning this test, we will stop the rhsmcertd so that it does not interfere with this test and make sure we are not subscribed...");
    clienttasks.stop_rhsmcertd();
    clienttasks.unsubscribe_(true, (BigInteger) null, null, null, null, null, null);
    // Enable rhsm manage_repos configuration
    clienttasks.config(null, null, true, new String[] { "rhsm", "manage_repos", "1" });
    log.info("Subscribe to the pool and start testing that yum repolist reports the expected repo id/labels...");
    File entitlementCertFile = clienttasks.subscribeToSubscriptionPool_(pool);
    Assert.assertNotNull(entitlementCertFile, "Found the entitlement cert file that was granted after subscribing to pool: " + pool);
    EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
    // 1. Run a 'yum repolist' and get a list of all of the available repositories corresponding to your entitled products
    // 1. Repolist contains repositories corresponding to your entitled products
    ArrayList<String> repolist = clienttasks.getYumRepolist("enabled");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        if (!clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist enabled excludes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with the manage_repos configuration enabled because not all requiredTags (" + contentNamespace.requiredTags + ") in the contentNamespace are provided by the currently installed productCerts.");
            continue;
        }
        if (contentNamespace.enabled) {
            Assert.assertTrue(repolist.contains(contentNamespace.label), "Yum repolist enabled includes enabled repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
        } else {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist enabled excludes disabled repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
        }
    }
    repolist = clienttasks.getYumRepolist("disabled");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        if (!clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist disabled excludes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled because not all requiredTags (" + contentNamespace.requiredTags + ") in the contentNamespace are provided by the currently installed productCerts.");
            continue;
        }
        if (contentNamespace.enabled) {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist disabled excludes enabled repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
        } else {
            Assert.assertTrue(repolist.contains(contentNamespace.label), "Yum repolist disabled includes disabled repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
        }
    }
    repolist = clienttasks.getYumRepolist("all");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        if (clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
            Assert.assertTrue(repolist.contains(contentNamespace.label), "Yum repolist all includes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
        } else {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist all excludes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled because not all requiredTags (" + contentNamespace.requiredTags + ") in the contentNamespace are provided by the currently installed productCerts.");
        }
    }
    log.info("Unsubscribe from the pool and verify that yum repolist no longer reports the expected repo id/labels...");
    clienttasks.unsubscribeFromSerialNumber(entitlementCert.serialNumber);
    repolist = clienttasks.getYumRepolist("all");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist all excludes repo id/label '" + contentNamespace.label + "' after having unsubscribed from Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with manage_repos configuration enabled.");
    }
    // Disable rhsm manage_repos configuration
    log.info("Now we will disable the rhsm manage_repos configuration with enabled=0..");
    clienttasks.config(null, null, true, new String[] { "rhsm", "manage_repos", "0" });
    log.info("Again let's subscribe to the same pool and verify that yum repolist does NOT report any of the entitled repo id/labels since the manage_repos has been disabled...");
    entitlementCertFile = clienttasks.subscribeToSubscriptionPool_(pool);
    Assert.assertNotNull(entitlementCertFile, "Found the entitlement cert file that was granted after subscribing to pool: " + pool);
    entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
    // 2. Run a 'yum repolist' and get a list of all of the available repositories corresponding to your entitled products
    // 2. Repolist does not contain repositories corresponding to your entitled products
    repolist = clienttasks.getYumRepolist("all");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist all excludes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' with the manage_repos configuration disabled.");
    }
    log.info("Now we will enable manage_repos and expect the repo list to be updated");
    clienttasks.config(null, null, true, new String[] { "rhsm", "manage_repos", "1" });
    repolist = clienttasks.getYumRepolist("all");
    for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
        if (!contentNamespace.type.equalsIgnoreCase("yum"))
            continue;
        if (clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
            Assert.assertTrue(repolist.contains(contentNamespace.label), "Yum repolist all now includes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' followed by manage_repos configuration enabled.");
        } else {
            Assert.assertFalse(repolist.contains(contentNamespace.label), "Yum repolist all still excludes repo id/label '" + contentNamespace.label + "' after having subscribed to Subscription ProductId '" + entitlementCert.orderNamespace.productId + "' followed by manage_repos configuration enabled because not all requiredTags (" + contentNamespace.requiredTags + ") in the contentNamespace are provided by the currently installed productCerts.");
        }
    }
}
Also used : ContentNamespace(rhsm.data.ContentNamespace) EntitlementCert(rhsm.data.EntitlementCert) ProductCert(rhsm.data.ProductCert) File(java.io.File) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 35 with EntitlementCert

use of rhsm.data.EntitlementCert in project rhsm-qe by RedHatQE.

the class ContentTests method getPackageFromEnabledRepoAndSubscriptionPoolDataAsListOfLists.

protected List<List<Object>> getPackageFromEnabledRepoAndSubscriptionPoolDataAsListOfLists() throws JSONException, Exception {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (clienttasks == null)
        return ll;
    if (sm_clientUsername == null)
        return ll;
    if (sm_clientPassword == null)
        return ll;
    // get the currently installed product certs to be used when checking for conditional content tagging
    List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
    // assure we are freshly registered and process all available subscription pools
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, ConsumerType.system, null, null, null, null, null, (String) null, null, null, null, Boolean.TRUE, false, null, null, null, null);
    for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
        String quantity = null;
        // when the Suggested quantity is 0, let's specify a quantity to avoid Stdout: Quantity '1' is not a multiple of instance multiplier '2'
        if (pool.suggested != null)
            if (pool.suggested < 1)
                quantity = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId, "instance_multiplier");
        /*if (clienttasks.isPackageVersion("subscription-manager",">=","1.10.3-1"))*/
        File entitlementCertFile = clienttasks.subscribeToSubscriptionPool_(pool, quantity);
        Assert.assertNotNull(entitlementCertFile, "Found the entitlement cert file that was granted after subscribing to pool: " + pool);
        EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
        for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
            if (!contentNamespace.type.equalsIgnoreCase("yum"))
                continue;
            if (contentNamespace.enabled && clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
                String repoLabel = contentNamespace.label;
                // find an available package that is uniquely provided by repo
                String pkg = clienttasks.findUniqueAvailablePackageFromRepo(repoLabel);
                if (pkg == null) {
                    log.warning("Could NOT find a unique available package from repo '" + repoLabel + "' after subscribing to SubscriptionPool: " + pool);
                }
                // String availableGroup, String installedGroup, String repoLabel, SubscriptionPool pool, String quantity
                ll.add(Arrays.asList(new Object[] { pkg, repoLabel, pool, quantity }));
            }
        }
        clienttasks.unsubscribeFromSerialNumber(clienttasks.getSerialNumberFromEntitlementCertFile(entitlementCertFile));
        // minimize the number of dataProvided rows (useful during automated testcase development)
        if (Boolean.valueOf(getProperty("sm.debug.dataProviders.minimize", "false")))
            break;
    }
    return ll;
}
Also used : ContentNamespace(rhsm.data.ContentNamespace) EntitlementCert(rhsm.data.EntitlementCert) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(org.json.JSONObject) ProductCert(rhsm.data.ProductCert) SubscriptionPool(rhsm.data.SubscriptionPool) File(java.io.File)

Aggregations

EntitlementCert (rhsm.data.EntitlementCert)94 Test (org.testng.annotations.Test)63 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)58 SkipException (org.testng.SkipException)39 ArrayList (java.util.ArrayList)38 File (java.io.File)36 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)35 SubscriptionPool (rhsm.data.SubscriptionPool)33 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)30 JSONObject (org.json.JSONObject)29 ContentNamespace (rhsm.data.ContentNamespace)26 ProductCert (rhsm.data.ProductCert)23 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)17 BigInteger (java.math.BigInteger)17 ProductSubscription (rhsm.data.ProductSubscription)17 List (java.util.List)16 Calendar (java.util.Calendar)11 HashMap (java.util.HashMap)11 ProductNamespace (rhsm.data.ProductNamespace)11 HashSet (java.util.HashSet)8