use of org.testng.annotations.BeforeGroups in project rhsm-qe by RedHatQE.
the class SKULevelContentOverrideTests method removeContentOverridesFromSubscriptionPoolProductIdsTested.
/**
* cleanup after running OverrideAtSKULevelTest by removing all of the
* content overrides for the SKUs tested above
*
* @throws JSONException
* @throws Exception
* @author jsefler
*/
@BeforeGroups(groups = "setup", value = { "OverrideAtSKULevelTest" }, enabled = true)
@AfterGroups(groups = "cleaup", value = { "OverrideAtSKULevelTest" }, enabled = true)
public void removeContentOverridesFromSubscriptionPoolProductIdsTested() throws JSONException, Exception {
String ownerKey = clienttasks.getCurrentlyRegisteredOwnerKey();
for (String subscriptionPoolProductIdTested : subscriptionPoolProductIdsTested) {
String productIdPath = "/owners/" + ownerKey + "/products/" + subscriptionPoolProductIdTested + "?exclude=id&exclude=name&exclude=multiplier&exclude=productContent&exclude=dependentProductIds&exclude=href&exclude=created&exclude=updated&exclude=attributes.created&exclude=attributes.updated";
JSONObject jsonProductId = new JSONObject(CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, productIdPath));
JSONArray jsonProductIdAttributes = jsonProductId.getJSONArray("attributes");
jsonProductIdAttributes = purgeJSONObjectNamesFromJSONArray(jsonProductIdAttributes, "content_override_enabled");
jsonProductIdAttributes = purgeJSONObjectNamesFromJSONArray(jsonProductIdAttributes, "content_override_disabled");
productIdPath = "/owners/" + ownerKey + "/products/" + subscriptionPoolProductIdTested;
JSONObject jsonAttributes = new JSONObject();
jsonAttributes.put("attributes", jsonProductIdAttributes);
CandlepinTasks.putResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, productIdPath, jsonAttributes);
CandlepinTasks.refreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, ownerKey);
}
}
use of org.testng.annotations.BeforeGroups in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method removeAndRestoreManyLogs.
@BeforeGroups("manyEmailLogs")
public void removeAndRestoreManyLogs() {
gaeSimulation.loginAsAdmin("admin");
gaeSimulation.clearLogs();
Date today = TimeHelper.getDateOffsetToCurrentTime(0);
insertLogMessageAtTimeWithInterval(logMessages.get(LOG_MESSAGE_INDEX_MANY_LOGS), today.getTime(), LOG_MESSAGE_INTERVAL_MANY_LOGS);
}
use of org.testng.annotations.BeforeGroups in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method removeAndRestoreLogMessage.
@BeforeGroups("typicalEmailLogs")
public void removeAndRestoreLogMessage() {
gaeSimulation.loginAsAdmin("admin");
gaeSimulation.clearLogs();
Date twoDaysAgo = TimeHelper.getDateOffsetToCurrentTime(-2);
insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TWO_DAYS_AGO), twoDaysAgo.getTime());
Date yesterday = TimeHelper.getDateOffsetToCurrentTime(-1);
insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_YESTERDAY), yesterday.getTime());
Date today = TimeHelper.getDateOffsetToCurrentTime(0);
insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TODAY), today.getTime());
}
use of org.testng.annotations.BeforeGroups in project rhsm-qe by RedHatQE.
the class CertificateTests method findAllRhelProductCertsFromRhnDefinitions.
@BeforeGroups(groups = "setup", value = { "VerifyBaseRHELProductCertVersionUpdates_Test" })
protected void findAllRhelProductCertsFromRhnDefinitions() {
// assemble a list of rhnDefinitionsProductCertsDirs that we care about under [rcm/rcm-metadata.git] / product_ids /
// Note: we care about all of the productCertsDirs
SSHCommandResult result = client.runCommandAndWait("find " + clienttasks.rhnDefinitionsDir + "/product_ids -maxdepth 1 -type d");
List<String> rhnDefinitionsProductCertsDirs = new ArrayList<String>();
for (String productIdsDir : result.getStdout().split("\\n")) {
if (!productIdsDir.equals(clienttasks.rhnDefinitionsDir + "/product_ids")) {
// http://git.app.eng.bos.redhat.com/git/rcm/rcm-metadata.git/tree/product_ids
if (!productIdsDir.contains("/rhel-" + clienttasks.redhatReleaseX + "."))
continue;
rhnDefinitionsProductCertsDirs.add(productIdsDir);
}
}
Assert.assertTrue(!rhnDefinitionsProductCertsDirs.isEmpty(), "The " + clienttasks.rhnDefinitionsDir + "/product_ids is not empty.");
// process all the migration product cert files into ProductCerts and assert they match those from the RHN Definitions
// get all of the rhnDefnition product certs
rhelProductCertsFromRhnDefinition.clear();
for (String rhnDefinitionsProductCertsDir : /*sm_*/
rhnDefinitionsProductCertsDirs) {
String tmpRhnDefinitionsProductCertsDir = /*clienttasks.rhnDefinitionsDir+*/
rhnDefinitionsProductCertsDir;
Assert.assertTrue(RemoteFileTasks.testExists(client, tmpRhnDefinitionsProductCertsDir), "The rhn definitions product certs dir '" + rhnDefinitionsProductCertsDir + "' has been locally cloned to '" + tmpRhnDefinitionsProductCertsDir + "'.");
rhelProductCertsFromRhnDefinition.addAll(clienttasks.getProductCerts(tmpRhnDefinitionsProductCertsDir));
}
}
use of org.testng.annotations.BeforeGroups in project rhsm-qe by RedHatQE.
the class ComplianceTests method configureProductCertDirForAllProductsSubscribableByOneCommonServiceLevel.
@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForAllProductsSubscribableByOneCommonServiceLevel")
public void configureProductCertDirForAllProductsSubscribableByOneCommonServiceLevel() {
clienttasks.unregister(null, null, null, null);
// TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
boolean invokeWorkaroundWhileBugIsOpen = true;
String bugId = "1183175";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
}
// END OF WORKAROUND
clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForAllProductsSubscribableByOneCommonServiceLevel);
SSHCommandResult r = client.runCommandAndWait("ls -1 " + productCertDirForAllProductsSubscribableByOneCommonServiceLevel + " | wc -l");
if (Integer.valueOf(r.getStdout().trim()) == 0)
throw new SkipException("Could not find any installed product certs that are autosubscribable via one common service level.");
Assert.assertTrue(Integer.valueOf(r.getStdout().trim()) > 0, "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains all autosubscribable products via one common service level.");
configureProductCertDirForAllProductsSubscribableByOneCommonServiceLevelCompleted = true;
}
Aggregations