[rhq] modules/enterprise
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 388 +++++-----
1 file changed, 213 insertions(+), 175 deletions(-)
New commits:
commit 42b9f09016e6cb0bff55901869b8f5e12dad73d6
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Jan 26 17:37:21 2012 -0500
BZ[784873] fixing issue displaying LDAP registration screen with clean browser cache.
i)Can't count on CoreGUI to be loaded in this case as the user may not have logged in before.
ii)Some refactoring to embed asynchronous call.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 74d11e3..50c87a4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -103,6 +103,7 @@ public class LoginView extends LocatableCanvas {
private static final String DEPARTMENT = "department";
private static final String SESSIONID = "ldap.sessionid";
static final String PASSWORD = "ldap.password";
+ private ProductInfo productInfo;
public void showLoginDialog(String message) {
showLoginDialog();
@@ -206,195 +207,232 @@ public class LoginView extends LocatableCanvas {
if (!loginShowing) {
loginShowing = true;
- ProductInfo productInfo = CoreGUI.get().getProductInfo();
-
- int fieldWidth = 120;
-
- LocatableVLayout column = new LocatableVLayout(extendLocatorId("NewLdapRegistration"));
- column.setMargin(25);
- HeaderItem header = new HeaderItem();
- header.setValue(MSG.view_login_welcomeMsg(productInfo.getName()));
- header.setWidth("100%");
- //build ui elements for registration screen
- first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
- {
- first.setRequired(true);
- first.setWrapTitle(false);
- first.setWidth(fieldWidth);
- }
- last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
- {
- last.setWrapTitle(false);
- last.setWidth(fieldWidth);
- last.setRequired(true);
- }
- final TextItem username = new TextItem(USERNAME, MSG.dataSource_users_field_name());
- {
- username.setValue(user);
- username.setDisabled(true);
- username.setWidth(fieldWidth);
- }
- email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
- email.setRequired(true);
- email.setWidth(fieldWidth);
- email.setWrapTitle(false);
- phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
- phone.setWidth(fieldWidth);
- phone.setWrapTitle(false);
- department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department());
- department.setWidth(fieldWidth);
- SpacerItem space = new SpacerItem();
- space.setColSpan(1);
-
- inputForm = new LocatableDynamicForm(extendLocatorId("LdapUserRegistrationInput"));
- inputForm.setAutoFocus(true);
- inputForm.setErrorOrientation(FormErrorOrientation.LEFT);
- inputForm.setNumCols(4);
- //moving header to it's own container for proper display. Didn't display right in production mode
- inputForm.setFields(username, first, last, email, phone, department);
- loadValidators(inputForm);
- inputForm.setValidateOnExit(true);
- DynamicForm headerWrapper = new DynamicForm();
- headerWrapper.setFields(header);
- column.addMember(headerWrapper);
- column.addMember(inputForm);
-
- HTMLFlow hr = new HTMLFlow("<br/><hr/><br/><br/>");
- hr.setWidth(620);
- hr.setAlign(Alignment.CENTER);
- column.addMember(hr);
-
- HStack row = new HStack();
- row.setMembersMargin(5);
- row.setAlign(VerticalAlignment.CENTER);
- IButton okButton = new LocatableIButton(inputForm.extendLocatorId("OK"), MSG.common_button_ok());
- okButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
-
- //F5 refresh check? If they've reloaded the form for some reason then bail.
- boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
- .trim().isEmpty()));
- //check for session timeout
- if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
- resetLogin(LoginView.this.extendLocatorId("Register"));
- return;
+ //BZ:784873. To fix issue with users logging in by LDAP integration with clean browser cache.
+ if (CoreGUI.get().getProductInfo() == null) {
+ //We need to explicitly retrieve product info here as can't count on CoreGui to load it
+ //during LDAP registration. After registration CoreGui is loaded as usual.
+ GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
+ productInfo = null;
+ Log.trace("ProductInfo could not be retrieved for some reason. Proceeding anyway.");
+ buildRegistrationWindow(user, sessionId, password, callback);
}
- //validation
- if (inputForm.validate()) {
- Log.trace("Successfully validated all data for user registration.");
- //populate form
- if (first.getValue() != null)
- inputForm.setValue(FIRST, String.valueOf(first.getValue()));
- if (last.getValue() != null)
- inputForm.setValue(LAST, String.valueOf(last.getValue()));
- inputForm.setValue(USERNAME, String.valueOf(username.getValue()));
- if (email.getValue() != null)
- inputForm.setValue(EMAIL, String.valueOf(email.getValue()));
- if (phone.getValue() != null)
- inputForm.setValue(PHONE, String.valueOf(phone.getValue()));
- if (department.getValue() != null)
- inputForm.setValue(DEPARTMENT, String.valueOf(department.getValue()));
- inputForm.setValue(SESSIONID, sessionId);
- inputForm.setValue(PASSWORD, password);
- registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), inputForm, callback);
+ public void onSuccess(ProductInfo result) {
+ productInfo = result;
+ Log.trace("ProductInfo has been retrieved for LDAP registration.");
+ buildRegistrationWindow(user, sessionId, password, callback);
}
- }
+ });
+ } else {//if productInfo has already been loaded, save a gwt call.
+ productInfo = CoreGUI.get().getProductInfo();
+ buildRegistrationWindow(user, sessionId, password, callback);
+ }
+ }
+ }
- });
- row.addMember(okButton);
- //send request to LDAP server to grab user details for this user. Already sure ldap user exists
- GWTServiceLookup.getLdapService().getLdapDetailsFor(user, new AsyncCallback<Map<String, String>>() {
- public void onSuccess(final Map<String, String> ldapUserDetails) {
- //now prepopulate UI fields if they exist
- for (String key : ldapUserDetails.keySet()) {
- String value;
- if (key.equalsIgnoreCase("givenName")) {//aka first name
- value = ldapUserDetails.get(key);
- first.setValue(value);
- } else if (key.equalsIgnoreCase("sn")) {//aka Surname
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- last.setValue(value);
- }
- } else if (key.equalsIgnoreCase("telephoneNumber")) {
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- phone.setValue(value);
- }
- } else if (key.equalsIgnoreCase("mail")) {
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- email.setValue(value);
- }
- }
- }
+ /** Duplicate modal Login mechanism to now show last registration screen before launching
+ * core gui.
+ *
+ * @param user prepopulate username field for LDAP registration
+ * @param sessionId pass in valid session id for LDAP registration steps.
+ * @param callback pass in callback reference to indicate success and launch of coreGUI
+ */
+ private void buildRegistrationWindow(final String user, final String sessionId, final String password,
+ final AsyncCallback<Subject> callback) {
+ int fieldWidth = 120;
+
+ //Build registration window.
+ LocatableVLayout column = new LocatableVLayout(extendLocatorId("NewLdapRegistration"));
+ column.setMargin(25);
+ HeaderItem header = new HeaderItem();
+ //Locate product info for registration screen.
+ if (productInfo != null) {
+ header.setValue(MSG.view_login_welcomeMsg(productInfo.getName()));
+ } else {//if not available, let registration continue. Errors already logged and no functionality lost.
+ header.setValue(MSG.view_login_welcomeMsg(""));
+ }
+ header.setWidth("100%");
+ //build ui elements for registration screen
+ first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
+ {
+ first.setRequired(true);
+ first.setWrapTitle(false);
+ first.setWidth(fieldWidth);
+ }
+ last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
+ {
+ last.setWrapTitle(false);
+ last.setWidth(fieldWidth);
+ last.setRequired(true);
+ }
+ final TextItem username = new TextItem(USERNAME, MSG.dataSource_users_field_name());
+ {
+ username.setValue(user);
+ username.setDisabled(true);
+ username.setWidth(fieldWidth);
+ }
+ email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
+ email.setRequired(true);
+ email.setWidth(fieldWidth);
+ email.setWrapTitle(false);
+ phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
+ phone.setWidth(fieldWidth);
+ phone.setWrapTitle(false);
+ department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department());
+ department.setWidth(fieldWidth);
+ SpacerItem space = new SpacerItem();
+ space.setColSpan(1);
+
+ inputForm = new LocatableDynamicForm(extendLocatorId("LdapUserRegistrationInput"));
+ inputForm.setAutoFocus(true);
+ inputForm.setErrorOrientation(FormErrorOrientation.LEFT);
+ inputForm.setNumCols(4);
+ //moving header to it's own container for proper display. Didn't display right in production mode
+ inputForm.setFields(username, first, last, email, phone, department);
+ loadValidators(inputForm);
+ inputForm.setValidateOnExit(true);
+ DynamicForm headerWrapper = new DynamicForm();
+ headerWrapper.setFields(header);
+ column.addMember(headerWrapper);
+ column.addMember(inputForm);
+
+ HTMLFlow hr = new HTMLFlow("<br/><hr/><br/><br/>");
+ hr.setWidth(620);
+ hr.setAlign(Alignment.CENTER);
+ column.addMember(hr);
+
+ HStack row = new HStack();
+ row.setMembersMargin(5);
+ row.setAlign(VerticalAlignment.CENTER);
+ IButton okButton = new LocatableIButton(inputForm.extendLocatorId("OK"), MSG.common_button_ok());
+ okButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+
+ //F5 refresh check? If they've reloaded the form for some reason then bail.
+ boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
+ .trim().isEmpty()));
+ //check for session timeout
+ if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
+ resetLogin(LoginView.this.extendLocatorId("Register"));
+ return;
}
- public void onFailure(Throwable caught) {
- inputForm.setFieldErrors(FIRST, MSG.view_login_noLdap(), true);
- Log.debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur.");
+ //validation
+ if (inputForm.validate()) {
+ Log.trace("Successfully validated all data for user registration.");
+ //populate form
+ if (first.getValue() != null)
+ inputForm.setValue(FIRST, String.valueOf(first.getValue()));
+ if (last.getValue() != null)
+ inputForm.setValue(LAST, String.valueOf(last.getValue()));
+ inputForm.setValue(USERNAME, String.valueOf(username.getValue()));
+ if (email.getValue() != null)
+ inputForm.setValue(EMAIL, String.valueOf(email.getValue()));
+ if (phone.getValue() != null)
+ inputForm.setValue(PHONE, String.valueOf(phone.getValue()));
+ if (department.getValue() != null)
+ inputForm.setValue(DEPARTMENT, String.valueOf(department.getValue()));
+ inputForm.setValue(SESSIONID, sessionId);
+ inputForm.setValue(PASSWORD, password);
+ registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), inputForm, callback);
}
- });
-
- IButton resetButton = new LocatableIButton(inputForm.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- //F5 refresh check? If they've reloaded the form for some reason then bail.
- boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
- .trim().isEmpty()));
- if (UserSessionManager.isLoggedOut() || credentialsEmpty) {
- resetLogin(LoginView.this.extendLocatorId("Reset"));
- return;
- }
+ }
- //clear out all validation messages.
- {
- String empty = " ";
- first.setValue(empty);
- last.setValue(empty);
- email.setValue("test(a)test.com");
- inputForm.validate();
+ });
+ row.addMember(okButton);
+ //send request to LDAP server to grab user details for this user. Already sure ldap user exists
+ GWTServiceLookup.getLdapService().getLdapDetailsFor(user, new AsyncCallback<Map<String, String>>() {
+ public void onSuccess(final Map<String, String> ldapUserDetails) {
+ //now prepopulate UI fields if they exist
+ for (String key : ldapUserDetails.keySet()) {
+ String value;
+ if (key.equalsIgnoreCase("givenName")) {//aka first name
+ value = ldapUserDetails.get(key);
+ first.setValue(value);
+ } else if (key.equalsIgnoreCase("sn")) {//aka Surname
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ last.setValue(value);
+ }
+ } else if (key.equalsIgnoreCase("telephoneNumber")) {
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ phone.setValue(value);
+ }
+ } else if (key.equalsIgnoreCase("mail")) {
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ email.setValue(value);
+ }
}
- first.clearValue();
- last.clearValue();
- email.clearValue();
- phone.clearValue();
- department.clearValue();
}
- });
- row.addMember(resetButton);
+ }
- IButton cancelButton = new LocatableIButton(inputForm.extendLocatorId("Cancel"), MSG.common_button_cancel());
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- UserSessionManager.logout();
+ public void onFailure(Throwable caught) {
+ inputForm.setFieldErrors(FIRST, MSG.view_login_noLdap(), true);
+ Log.debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur.");
+ }
+ });
+
+ IButton resetButton = new LocatableIButton(inputForm.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ //F5 refresh check? If they've reloaded the form for some reason then bail.
+ boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
+ .trim().isEmpty()));
+ if (UserSessionManager.isLoggedOut() || credentialsEmpty) {
resetLogin(LoginView.this.extendLocatorId("Reset"));
+ return;
}
- });
- row.addMember(cancelButton);
- Label logoutLabel = new Label(MSG.view_login_registerLater());
- logoutLabel.setWrap(false);
- row.addMember(logoutLabel);
- column.addMember(row);
-
- window = new LocatableWindow(extendLocatorId("RegistrationWindow"));
- window.setWidth(670);
- window.setHeight(330);
- window.setTitle(MSG.view_login_registerUser());
- // forced focused, static size, can't close / dismiss
- window.setIsModal(true);
- window.setShowModalMask(true);
- window.setCanDragResize(false);
- window.setCanDragReposition(false);
- window.setShowCloseButton(false);
- window.setShowMinimizeButton(false);
- window.setAutoCenter(true);
-
- window.addItem(column);
- window.show();
- }
+ //clear out all validation messages.
+ {
+ String empty = " ";
+ first.setValue(empty);
+ last.setValue(empty);
+ email.setValue("test(a)test.com");
+ inputForm.validate();
+ }
+ first.clearValue();
+ last.clearValue();
+ email.clearValue();
+ phone.clearValue();
+ department.clearValue();
+ }
+ });
+ row.addMember(resetButton);
+
+ IButton cancelButton = new LocatableIButton(inputForm.extendLocatorId("Cancel"), MSG.common_button_cancel());
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ UserSessionManager.logout();
+ resetLogin(LoginView.this.extendLocatorId("Reset"));
+ }
+ });
+ row.addMember(cancelButton);
+ Label logoutLabel = new Label(MSG.view_login_registerLater());
+ logoutLabel.setWrap(false);
+ row.addMember(logoutLabel);
+ column.addMember(row);
+
+ window = new LocatableWindow(extendLocatorId("RegistrationWindow"));
+ window.setWidth(670);
+ window.setHeight(330);
+ window.setTitle(MSG.view_login_registerUser());
+
+ // forced focused, static size, can't close / dismiss
+ window.setIsModal(true);
+ window.setShowModalMask(true);
+ window.setCanDragResize(false);
+ window.setCanDragReposition(false);
+ window.setShowCloseButton(false);
+ window.setShowMinimizeButton(false);
+ window.setAutoCenter(true);
+
+ window.addItem(column);
+ window.show();
}
/** Go through steps of invalidating this login and piping them back to CoreGUI Login.
12 years, 4 months
[rhq] modules/core modules/plugins
by mazz
modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java | 72 ++++
modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java | 135 +++++++-
modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java | 98 +++++-
modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java | 49 +--
modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java | 77 ++++-
modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java | 152 +++++++++-
modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml | 16 +
7 files changed, 526 insertions(+), 73 deletions(-)
New commits:
commit 9946f3e2b2b4b0a86ebe001594818f016a4c4130
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jan 26 17:19:43 2012 -0500
[BZ 784124] fix the issue where, on initial deployment of a bundle, we didn't clean out any files that happen to be in the deployment dir.
we need to remove them, they are in the way. we do back them up so they can be manually retrieved if the user screwed up.
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
index 14ed3af..a78f6b2 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
@@ -33,6 +33,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
@@ -102,6 +103,77 @@ public class FileUtil {
StreamUtil.copy(is, os);
}
+ public static void copyDirectory(File inDir, File outDir) throws IOException {
+ if (inDir.exists()) {
+ if (!inDir.isDirectory()) {
+ throw new IOException("Source directory [" + inDir + "] is not a directory");
+ }
+ } else {
+ throw new FileNotFoundException("Source directory [" + inDir + "] does not exist");
+ }
+
+ if (!outDir.mkdirs()) {
+ throw new IOException("Destination directory [" + outDir + "] failed to be created");
+ }
+
+ if (!canWrite(outDir)) {
+ throw new IOException("Cannot write to destination directory [" + outDir + "]");
+ }
+
+ // TODO do we care to restore the last mod time on the destination dir?
+ //outDir.setLastModified(inDir.lastModified());
+
+ File[] files = inDir.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to get the list of files in source directory [" + inDir + "]");
+ }
+ for (File file : files) {
+ File copiedFile = new File(outDir, file.getName());
+ if (file.isDirectory()) {
+ copyDirectory(file, copiedFile);
+ } else {
+ copyFile(file, copiedFile);
+ }
+ }
+
+ files = null; // help GC
+ return;
+ }
+
+ /**
+ * Obtains the list of all files in the given directory and, recursively, all its subdirectories.
+ * Note that the returns list is only regular files - directory names are NOT in the list. Also,
+ * the names in the list are relative to the given directory.
+ * @param directory the directory whose files are to be returned
+ * @return list of files in the directory, not sorted in any particular order
+ * @throws IOException if directory does not exist or is not a directory
+ */
+ public static List<File> getDirectoryFiles(File directory) throws IOException {
+ ArrayList<File> files = new ArrayList<File>();
+ if (!directory.isDirectory()) {
+ throw new IOException("[" + directory + "] is not an existing directory");
+ }
+ getDirectoryFilesRecursive(directory, files, null);
+ return files;
+ }
+
+ private static void getDirectoryFilesRecursive(File directory, List<File> files, String relativeTo)
+ throws IOException {
+ File[] children = directory.listFiles();
+ if (children == null) {
+ throw new IOException("Cannot obtain files from directory [" + directory + "]");
+ }
+ for (File child : children) {
+ if (child.isDirectory()) {
+ getDirectoryFilesRecursive(child, files, ((relativeTo == null) ? "" : relativeTo) + child.getName()
+ + File.separatorChar);
+ } else {
+ files.add(new File(relativeTo, child.getName()));
+ }
+ }
+ return;
+ }
+
/**
* Copy a stream, using a buffer.
* @deprecated use {@link StreamUtil} for more methods like this - those are unit tested and used more
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
index 652bcda..40ce727 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
@@ -28,6 +28,8 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -301,9 +303,9 @@ public class Deployer {
return;
}
- debug("Estimated disk usage for this deployment is [", usage.getDiskUsage(), "] bytes (file count=[", usage
- .getFileCount(), "]). The maximum disk space currently usable is estimated to be [", usage
- .getMaxDiskUsable(), "] bytes.");
+ debug("Estimated disk usage for this deployment is [", usage.getDiskUsage(), "] bytes (file count=[",
+ usage.getFileCount(), "]). The maximum disk space currently usable is estimated to be [",
+ usage.getMaxDiskUsable(), "] bytes.");
if (usage.getDiskUsage() > usage.getMaxDiskUsable()) {
throw new Exception(
@@ -316,6 +318,31 @@ public class Deployer {
}
private FileHashcodeMap performInitialDeployment(DeployDifferences diff, boolean dryRun) throws Exception {
+ // If we are to fully manage the deployment dir, then we need to delete everything we find here.
+ // Any old files do not belong here - only our bundle files should live here now.
+ if (this.deploymentData.isManageRootDir()) {
+ File destDir = this.deploymentData.getDestinationDir();
+ log.info(buildLogMessage("Will be managing the deploy dir[", destDir,
+ "]; backing up and purging any obsolete content existing in there"));
+ if (destDir.isDirectory()) {
+ int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
+ backupFiles(diff, deploymentId, destDir, dryRun, null, true);
+ if (!dryRun) {
+ // we want to purge everything that is originally in here, but we backed up the files in here
+ // so make sure we don't delete our metadata directory, which is where the backed up files are
+ File[] doomedFiles = destDir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return !DeploymentsMetadata.METADATA_DIR.equals(name);
+ }
+ });
+ for (File doomedFile : doomedFiles) {
+ FileUtil.purge(doomedFile, true);
+ }
+ }
+ }
+ }
+
FileHashcodeMap newFileHashcodeMap = extractZipAndRawFiles(new HashMap<String, String>(0), diff, dryRun);
// this is an initial deployment, so we know every file is new - tell our diff about them all
@@ -340,8 +367,8 @@ public class Deployer {
// * if a current file is backed up
FileHashcodeMap original = this.deploymentsMetadata.getCurrentDeploymentFileHashcodes();
- ChangesFileHashcodeMap current = original.rescan(this.deploymentData.getDestinationDir(), this.deploymentData
- .getIgnoreRegex(), this.deploymentData.isManageRootDir());
+ ChangesFileHashcodeMap current = original.rescan(this.deploymentData.getDestinationDir(),
+ this.deploymentData.getIgnoreRegex(), this.deploymentData.isManageRootDir());
FileHashcodeMap newFiles = getNewDeploymentFileHashcodeMap();
if (current.getUnknownContent() != null) {
@@ -457,7 +484,8 @@ public class Deployer {
int backupDeploymentId = props.getDeploymentId();
debug("Backing up files as part of update deployment. dryRun=", dryRun);
for (String fileToBackupPath : currentFilesToBackup) {
- backupFile(diff, backupDeploymentId, fileToBackupPath, dryRun);
+ boolean toBeDeleted = currentFilesToDelete.remove(fileToBackupPath);
+ backupFile(diff, backupDeploymentId, fileToBackupPath, dryRun, toBeDeleted);
}
}
@@ -503,8 +531,8 @@ public class Deployer {
return newFileHashCodeMap;
}
- private void backupFile(DeployDifferences diff, int deploymentId, final String fileToBackupPath, boolean dryRun)
- throws Exception {
+ private void backupFile(DeployDifferences diff, int deploymentId, final String fileToBackupPath, boolean dryRun,
+ boolean removeFileToBackup) throws Exception {
File bakFile;
@@ -536,8 +564,8 @@ public class Deployer {
String destDirDriveLetter = FileUtil.stripDriveLetter(destDirAbsPathBuilder);
if (destDirDriveLetter == null || driveLetter.equals(destDirDriveLetter)) {
bakFile = new File(backupDir, fileToBackupPath);
- fileToBackup = new File(this.deploymentData.getDestinationDir(), fileToBackupPathNoDriveLetter
- .toString());
+ fileToBackup = new File(this.deploymentData.getDestinationDir(),
+ fileToBackupPathNoDriveLetter.toString());
} else {
throw new Exception("Cannot backup relative path [" + fileToBackupPath
+ "] whose drive letter is different than the destination directory ["
@@ -549,20 +577,77 @@ public class Deployer {
}
}
+ boolean deleted = false; // will be true if we were told to delete the file and we actually did delete it
+
if (!dryRun) {
bakFile.getParentFile().mkdirs();
- FileUtil.copyFile(fileToBackup, bakFile);
+ // try to do a rename first if we are to remove the file, since this is more likely
+ // much faster and more efficient.
+ // if it fails (perhaps because we are crossing file systems), try a true copy
+ if (removeFileToBackup) {
+ boolean movedSuccessfully = fileToBackup.renameTo(bakFile);
+ if (movedSuccessfully) {
+ deleted = true;
+ } else {
+ FileUtil.copyFile(fileToBackup, bakFile);
+ deleted = fileToBackup.delete();
+ if (deleted == false) {
+ // TODO: what should we do? is it a major failure if we can't remove files here?
+ debug("Failed to delete file [", fileToBackup, "] but it is backed up");
+ if (diff != null) {
+ diff.addError(fileToBackupPath, "File [" + fileToBackup.getAbsolutePath()
+ + "] did not delete");
+ }
+ }
+ }
+ } else {
+ FileUtil.copyFile(fileToBackup, bakFile);
+ }
+ } else {
+ deleted = removeFileToBackup; // this is a dry run, pretend we deleted it if we were asked to
}
debug("Backed up file [", fileToBackup, "] to [", bakFile, "]. dryRun=", dryRun);
+ if (deleted) {
+ debug("Deleted file [", fileToBackup, "] after backing it up. dryRun=", dryRun);
+ }
if (diff != null) {
diff.addBackedUpFile(fileToBackupPath, bakFile.getAbsolutePath());
+ if (deleted) {
+ diff.addDeletedFile(fileToBackupPath);
+ }
}
return;
}
+ private void backupFiles(DeployDifferences diff, int deploymentId, File dirToBackup, boolean dryRun,
+ String relativeTo, boolean removeSourceFiles) throws Exception {
+ File[] files = dirToBackup.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to get the list of files in source directory [" + dirToBackup + "]");
+ }
+ if (files.length > 0) {
+ this.deploymentsMetadata.getMetadataDirectory().mkdirs(); // make sure we create this, might not be there yet
+ for (File file : files) {
+ if (file.isDirectory()) {
+ if (file.getName().equals(DeploymentsMetadata.METADATA_DIR)) {
+ continue; // skip the RHQ metadata directory, its where we are putting our backups!
+ }
+ backupFiles(diff, deploymentId, file, dryRun,
+ ((relativeTo == null) ? "" : relativeTo) + file.getName() + File.separatorChar,
+ removeSourceFiles);
+ } else {
+ backupFile(diff, deploymentId, ((relativeTo == null) ? "" : relativeTo) + file.getName(), dryRun,
+ removeSourceFiles);
+ }
+ }
+
+ files = null; // help GC
+ }
+ }
+
private FileHashcodeMap extractZipAndRawFiles(Map<String, String> currentFilesToLeaveAlone, DeployDifferences diff,
boolean dryRun) throws Exception {
@@ -615,8 +700,8 @@ public class Deployer {
ZipUtil.walkZipFile(zipFile, visitor);
// we have to compress the file again - our new compressed file will have the new realized files in them
if (!dryRun) {
- createZipFile(compressedFile, this.deploymentData.getDestinationDir(), visitor
- .getFileHashcodeMap());
+ createZipFile(compressedFile, this.deploymentData.getDestinationDir(),
+ visitor.getFileHashcodeMap());
}
}
@@ -1040,16 +1125,20 @@ public class Deployer {
private void debug(Object... objs) {
if (log.isDebugEnabled()) {
- String bundleName = this.deploymentData.getDeploymentProps().getBundleName();
- String bundleVersion = this.deploymentData.getDeploymentProps().getBundleVersion();
- int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
- StringBuilder str = new StringBuilder();
- str.append("Bundle [").append(bundleName).append(" v").append(bundleVersion).append(']');
- str.append("; Deployment [").append(deploymentId).append("]: ");
- for (Object o : objs) {
- str.append(o);
- }
- log.debug(str.toString());
+ log.debug(buildLogMessage(objs));
+ }
+ }
+
+ private String buildLogMessage(Object... objs) {
+ String bundleName = this.deploymentData.getDeploymentProps().getBundleName();
+ String bundleVersion = this.deploymentData.getDeploymentProps().getBundleVersion();
+ int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
+ StringBuilder str = new StringBuilder();
+ str.append("Bundle [").append(bundleName).append(" v").append(bundleVersion).append(']');
+ str.append("; Deployment [").append(deploymentId).append("]: ");
+ for (Object o : objs) {
+ str.append(o);
}
+ return str.toString();
}
}
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java b/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
index 31659bd..bb7ad34 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
@@ -22,21 +22,92 @@
*/
package org.rhq.core.util.file;
+import static java.util.Arrays.asList;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.commons.io.FileUtils.toFile;
+import static org.apache.commons.io.FileUtils.touch;
+import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+
+import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.testng.annotations.Test;
-import static java.util.Arrays.asList;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.apache.commons.io.FileUtils.toFile;
-import static org.apache.commons.io.FileUtils.touch;
-import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+import org.rhq.core.util.stream.StreamUtil;
@Test
public class FileUtilTest {
+ public void testCopyDirectory() throws Exception {
+ try {
+ FileUtil.copyDirectory(new File("this.does.not.exist"), new File("dummy"));
+ assert false : "the source directory did not exist, this should have failed because of that";
+ } catch (Exception ok) {
+ }
+
+ // create a source directory and a destination directory. Make sure we start off
+ // with a non-existent destination directory - we want the copyDirectory to create it for us.
+ File outDir = FileUtil.createTempDirectory("fileUtilTestCopyDir", ".dest", null);
+ assert outDir.delete() : "failed to start out with a non-existent dest directory";
+ assert !outDir.exists() : "dest directory should not exist"; // yes, I am paranoid
+
+ File inDir = FileUtil.createTempDirectory("fileUtilTestCopyDir", ".src", null);
+ try {
+ // create some test files in our source directory
+ String testFilename0 = "file0.txt";
+ String testFilename1 = "subdir" + File.separatorChar + "subfile1.txt";
+ String testFilename2 = "subdir" + File.separatorChar + "subfile2.txt";
+
+ File testFile = new File(inDir, testFilename0);
+ StreamUtil.copy(new ByteArrayInputStream("0".getBytes()), new FileOutputStream(testFile));
+ assert "0".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+
+ testFile = new File(inDir, testFilename1);
+ testFile.getParentFile().mkdirs();
+ StreamUtil.copy(new ByteArrayInputStream("1".getBytes()), new FileOutputStream(testFile));
+ assert "1".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+ testFile = new File(inDir, testFilename2);
+ testFile.getParentFile().mkdirs();
+ StreamUtil.copy(new ByteArrayInputStream("2".getBytes()), new FileOutputStream(testFile));
+ assert "2".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+
+ // copy our source directory and confirm the copies are correct
+ FileUtil.copyDirectory(inDir, outDir);
+
+ testFile = new File(outDir, testFilename0);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "0".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+ testFile = new File(outDir, testFilename1);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "1".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+ testFile = new File(outDir, testFilename2);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "2".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+
+ // let's test getDirectoryFiles while we are here
+ List<File> outFiles = FileUtil.getDirectoryFiles(outDir);
+ assert outFiles != null : outFiles;
+ assert outFiles.size() == 3 : outFiles;
+ assert outFiles.contains(new File(testFilename0)) : outFiles;
+ assert outFiles.contains(new File(testFilename1)) : outFiles;
+ assert outFiles.contains(new File(testFilename2)) : outFiles;
+ } finally {
+ // clean up our test
+ try {
+ FileUtil.purge(inDir, true);
+ } catch (Exception ignore) {
+ }
+ try {
+ FileUtil.purge(outDir, true);
+ } catch (Exception ignore) {
+ }
+ }
+ }
+
public void testStripDriveLetter() {
StringBuilder str;
@@ -142,8 +213,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit all files in directory");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit all files in directory");
}
@Test
@@ -176,8 +246,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit files in sub directories");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit files in sub directories");
}
@Test
@@ -210,8 +279,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit files in nested sub directories");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit files in nested sub directories");
}
public void testGetPattern() {
@@ -222,8 +290,8 @@ public class FileUtilTest {
assert regex.matcher("/basedir/test1.txt").matches();
assert !regex.matcher("/basedir/test2.txt").matches();
- regex = assertPatternsRegex("(/basedir/easy\\.txt)|(/basedir/test\\.txt)",
- new PathFilter("/basedir/easy.txt", null), new PathFilter("/basedir/test.txt", null));
+ regex = assertPatternsRegex("(/basedir/easy\\.txt)|(/basedir/test\\.txt)", new PathFilter("/basedir/easy.txt",
+ null), new PathFilter("/basedir/test.txt", null));
assert regex.matcher("/basedir/easy.txt").matches();
assert regex.matcher("/basedir/test.txt").matches();
@@ -244,8 +312,8 @@ public class FileUtilTest {
assert !regex.matcher("/basedir/subdir/foo.txt").matches();
assert !regex.matcher("/basedir/foo.txt.swp").matches();
- regex = assertPatternsRegex("(/var/lib/([^/]*\\.war))|(/var/lib/([^/]*\\.ear))",
- new PathFilter("/var/lib", "*.war"), new PathFilter("/var/lib", "*.ear"));
+ regex = assertPatternsRegex("(/var/lib/([^/]*\\.war))|(/var/lib/([^/]*\\.ear))", new PathFilter("/var/lib",
+ "*.war"), new PathFilter("/var/lib", "*.ear"));
assert regex.matcher("/var/lib/myapp.war").matches();
assert regex.matcher("/var/lib/myapp.ear").matches();
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java b/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
index 69d6d53..a69931a 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
@@ -230,12 +230,13 @@ public class DeployerTest {
final String file999 = "dir1" + fileSeparator + "file999";
try {
- if (ignore) {
- // create a file that will be retained because we will be ignoring it
- File ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
- fileToIgnore = new File(ignoreDir, "some-log.log");
- StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
- }
+ // this is a file that will be removed because our initial deployment is managing the root deploy dir
+ // later we will recreate it to see that we ignore it during the upgrade.
+ // note that during the initial deployment, we will still back it up.
+ File ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
+ fileToIgnore = new File(ignoreDir, "some-log.log");
+ StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
+ String fileToIgnorePath = ignoreDir.getName() + "/" + fileToIgnore.getName(); // yes, use /, even if we are on windows
File testZipFile1 = new File("target/test-classes/updater-test1.zip");
File testZipFile2 = new File("target/test-classes/updater-test2.zip");
@@ -267,15 +268,25 @@ public class DeployerTest {
deployer.deploy(diff);
- if (ignore) {
- assert "boo".equals(new String(StreamUtil.slurp(new FileInputStream(fileToIgnore))));
- assert diff.getIgnoredFiles().size() == 0 : "this was an initial deploy - nothing to ignore (ignore is only for updates)";
- }
+ // our initial deploy should have deleted this because we are managing the root dir
+ assert !fileToIgnore.exists() : "should have removed this file since we are managing the root dir";
+ assert !fileToIgnore.getParentFile().exists() : "should have removed this file since we are managing the root dir";
+ assert diff.getIgnoredFiles().size() == 0 : "this was an initial deploy - nothing to ignore (ignore is only for updates)";
assert diff.getAddedFiles().size() == 6 : diff;
- assert diff.getDeletedFiles().size() == 0 : diff;
+ assert diff.getDeletedFiles().size() == 1 : diff;
+ assert diff.getDeletedFiles().contains(fileToIgnorePath) : "should have deleted this unknown file" + diff;
assert diff.getChangedFiles().size() == 0 : diff;
assert diff.getRealizedFiles().size() == 0 : "No fileA to realize in this deployment: " + diff;
- assert diff.getBackedUpFiles().size() == 0 : "No fileA to realize in this deployment: " + diff;
+ assert diff.getBackedUpFiles().size() == 1 : diff;
+ assert diff.getBackedUpFiles().get(fileToIgnorePath) != null : "should have backed up this file" + diff;
+
+ if (ignore) {
+ // let's create this again to make sure we really do ignore it
+ ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
+ fileToIgnore = new File(ignoreDir, "some-log.log");
+ StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
+ fileToIgnorePath = ignoreDir.getName() + "/" + fileToIgnore.getName(); // yes, use /, even if we are on windows
+ }
StreamUtil.copy(new ByteArrayInputStream("X".getBytes()), new FileOutputStream(new File(tmpDir, file1)));
StreamUtil.copy(new ByteArrayInputStream("X".getBytes()), new FileOutputStream(updaterAabsolute));
@@ -295,7 +306,7 @@ public class DeployerTest {
templateEngine, ignoreRegex, true, null);
deployer = new Deployer(dd);
diff = new DeployDifferences();
- deployer.deploy(diff);
+ deployer.deploy(diff); // this is an upgrade
if (ignore) {
assert "boo".equals(new String(StreamUtil.slurp(new FileInputStream(fileToIgnore))));
@@ -396,11 +407,11 @@ public class DeployerTest {
assert diff.getChangedFiles().contains(fileB) : diff;
assert diff.getBackedUpFiles().size() == 4 : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterAabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterAabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterAabsoluteBackupTo2)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterAabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterAabsoluteBackupTo2)) : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterBabsoluteBackupTo2)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterBabsoluteBackupTo2)) : diff;
assert diff.getBackedUpFiles().containsKey(fileB) : diff;
assert diff.getBackedUpFiles().get(fileB).equals(diff.convertPath(fileBbackupTo2.getAbsolutePath())) : diff;
assert diff.getBackedUpFiles().containsKey(file999) : diff;
@@ -442,8 +453,8 @@ public class DeployerTest {
assert diff.getChangedFiles().contains(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
assert diff.getBackedUpFiles().size() == 1 : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterBabsoluteBackupTo3)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterBabsoluteBackupTo3)) : diff;
if (realize) {
assert diff.getRealizedFiles().size() == 1 : diff;
assert diff.getRealizedFiles().containsKey(fileA) : diff;
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java b/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
index f875576..2736f16 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
@@ -205,7 +205,15 @@ public class SimpleDeployerTest {
baseNoNewWithCurrentDifferentThanOriginal(true);
}
- public void testWithSubdirectories() throws Exception {
+ public void testWithSubdirectoriesManageRootDir() throws Exception {
+ testWithSubdirectories(true);
+ }
+
+ public void testWithSubdirectoriesNoManageRootDir() throws Exception {
+ testWithSubdirectories(false);
+ }
+
+ private void testWithSubdirectories(boolean manageRootDir) throws Exception {
// this test is different than all the rest, start with clean tmp/dest dirs with no beforeMethod buildup
FileUtil.purge(this.tmpDir, false);
FileUtil.purge(this.deployDir, false);
@@ -227,14 +235,40 @@ public class SimpleDeployerTest {
this.originalZipFiles.add(originalZipFile);
this.originalDeployProps = new DeploymentProperties(1, "simple", "1.0", "original test deployment");
DeploymentData dd = new DeploymentData(originalDeployProps, originalZipFiles, null, tmpDir, deployDir, null,
- null, null, null, true, null);
+ null, null, null, manageRootDir, null);
+ this.diff = new DeployDifferences();
Deployer deployer = new Deployer(dd);
- this.originalFileHashcodeMap = deployer.deploy(null);
+ this.originalFileHashcodeMap = deployer.deploy(this.diff);
assert new File(this.deployDir, origFileName1).exists();
assert new File(this.deployDir, origFileName2).exists();
- assert unrelated1.exists() : "the deployment removed unrelated file1";
- assert unrelated2.getParentFile().isDirectory() : "the deployment removed an unrelated dir";
- assert unrelated2.exists() : "the deployment removed unrelated file2";
+ if (manageRootDir) {
+ assert !unrelated1.exists() : "the deployment should have removed unrelated file1";
+ assert !unrelated2.getParentFile().isDirectory() : "the deployment should have removed an unrelated dir";
+ assert !unrelated2.exists() : "the deployment should have removed unrelated file2";
+
+ assert this.diff.getBackedUpFiles().size() == 2 : this.diff;
+ assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName1)).exists() : this.diff;
+ assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName2)).exists() : this.diff;
+ assert this.diff.getDeletedFiles().size() == 2 : this.diff;
+ assert this.diff.getDeletedFiles().contains(unrelatedFileName1) : this.diff;
+ assert this.diff.getDeletedFiles().contains(unrelatedFileName2) : this.diff;
+ } else {
+ assert this.diff.getBackedUpFiles().size() == 0 : this.diff;
+ assert this.diff.getDeletedFiles().size() == 0 : this.diff;
+ assert unrelated1.exists() : "the deployment removed unrelated file1";
+ assert unrelated2.getParentFile().isDirectory() : "the deployment removed an unrelated dir";
+ assert unrelated2.exists() : "the deployment removed unrelated file2";
+ }
+
+ assert this.diff.getAddedFiles().size() == 2 : this.diff;
+ assert this.diff.getAddedFiles().contains(origFileName1) : this.diff;
+ assert this.diff.getAddedFiles().contains(origFileName2) : this.diff;
+ assert this.diff.getChangedFiles().isEmpty() : this.diff;
+ assert this.diff.getIgnoredFiles().isEmpty() : this.diff;
+ assert this.diff.getRealizedFiles().isEmpty() : this.diff;
+ assert this.diff.getRestoredFiles().isEmpty() : this.diff;
+ assert !this.diff.wasCleaned() : this.diff;
+ assert this.diff.getErrors().isEmpty() : this.diff;
// deploy new content
this.newDeployProps = new DeploymentProperties(2, "simple", "2.0", "new test deployment");
@@ -246,19 +280,36 @@ public class SimpleDeployerTest {
new String[] { newFileName1, newFileName2 });
HashSet<File> newZipFiles = new HashSet<File>(1);
newZipFiles.add(newZipFile);
- dd = new DeploymentData(newDeployProps, newZipFiles, null, tmpDir, deployDir, null, null, null, null, true,
- null);
+ dd = new DeploymentData(newDeployProps, newZipFiles, null, tmpDir, deployDir, null, null, null, null,
+ manageRootDir, null);
deployer = new Deployer(dd);
FileHashcodeMap newFileHashcodeMap = deployer.deploy(this.diff);
+ assert newFileHashcodeMap != null;
assert new File(this.deployDir, newFileName1).exists();
assert new File(this.deployDir, newFileName2).exists();
assert !new File(this.deployDir, origFileName1).exists();
assert !new File(this.deployDir, origFileName2).exists();
- assert !unrelated1.exists() : "the deployment did not remove unrelated file1";
- assert !unrelated2.exists() : "the deployment did not remove unrelated file1";
- assert this.diff.getBackedUpFiles().size() == 2 : this.diff;
- assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName1)).exists() : this.diff;
- assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName2)).exists() : this.diff;
+ if (manageRootDir) {
+ assert !unrelated1.exists() : "the deployment did not remove unrelated file1";
+ assert !unrelated2.exists() : "the deployment did not remove unrelated file1";
+ } else {
+ assert unrelated1.exists() : "the deployment removed unrelated file1 but we aren't managing the root dir";
+ assert unrelated2.exists() : "the deployment removed unrelated file1 but we aren't managing the root dir";
+ }
+
+ assert this.diff.getAddedFiles().size() == 2 : this.diff;
+ assert this.diff.getAddedFiles().contains(newFileName1) : this.diff;
+ assert this.diff.getAddedFiles().contains(newFileName2) : this.diff;
+ assert this.diff.getDeletedFiles().size() == 2 : this.diff;
+ assert this.diff.getDeletedFiles().contains(origFileName1) : this.diff;
+ assert this.diff.getDeletedFiles().contains(origFileName2) : this.diff;
+ assert this.diff.getChangedFiles().isEmpty() : this.diff;
+ assert this.diff.getBackedUpFiles().isEmpty() : this.diff;
+ assert this.diff.getIgnoredFiles().isEmpty() : this.diff;
+ assert this.diff.getRealizedFiles().isEmpty() : this.diff;
+ assert this.diff.getRestoredFiles().isEmpty() : this.diff;
+ assert !this.diff.wasCleaned() : this.diff;
+ assert this.diff.getErrors().isEmpty() : this.diff;
}
private void baseX_X_X(boolean dryRun) throws Exception {
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
index a772ef0..d712401 100644
--- a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -231,11 +231,17 @@ public class AntBundlePluginComponentTest {
upgrade(true);
}
+ @Test(enabled = true)
+ public void testAntBundleInitialInstall() throws Exception {
+ doAntBundleInitialInstall(true);
+ }
+
/**
* Test deployment of an RHQ bundle recipe with archive file and raw file
+ * @param startClean if true, the destination directory will be non-existent and thus clean
+ * if false, this will put some junk files in the dest directory
*/
- @Test(enabled = true)
- public void testAntBundleInitialInstall() throws Exception {
+ private void doAntBundleInitialInstall(boolean startClean) throws Exception {
ResourceType resourceType = new ResourceType("testSimpleBundle2Type", "plugin", ResourceCategory.SERVER, null);
BundleType bundleType = new BundleType("testSimpleBundle2BType", resourceType);
Repo repo = new Repo("test-bundle-two");
@@ -273,6 +279,25 @@ public class AntBundlePluginComponentTest {
props.store(outputStream, "test.properties comment");
outputStream.close();
+ // if we are not to start clean, create some junk files that will need to be backed up and moved away
+ if (startClean == false) {
+ this.destDir.mkdirs();
+ File junk1 = new File(this.destDir, "junk1.properties");
+ Properties junkProps = new Properties();
+ junkProps.setProperty("junk1", "wot gorilla?");
+ FileOutputStream os = new FileOutputStream(junk1);
+ junkProps.store(os, "junk1.properties comment");
+ os.close();
+
+ File junk2 = new File(this.destDir, "junksubdir" + File.separatorChar + "junk2.properties");
+ junk2.getParentFile().mkdirs();
+ junkProps = new Properties();
+ junkProps.setProperty("junk2", "more junk");
+ os = new FileOutputStream(junk2);
+ junkProps.store(os, "junk2.properties comment");
+ os.close();
+ }
+
BundleDeployRequest request = new BundleDeployRequest();
request.setBundleFilesLocation(this.bundleFilesDir);
request.setResourceDeployment(new BundleResourceDeployment(deployment, null));
@@ -501,8 +526,129 @@ public class AntBundlePluginComponentTest {
assert "2".equals(props.getProperty("external2")) : "bundle purge removed our unmanaged file 2";
}
+ /**
+ * Test deployment of an RHQ bundle recipe where the deploy directory is to be fully managed.
+ * This is the typical use-case and the default behavior.
+ */
+ @Test(enabled = true)
+ public void testAntBundleManageRootDir() throws Exception {
+ ResourceType resourceType = new ResourceType("testManageRootDirBundle", "plugin", ResourceCategory.SERVER, null);
+ BundleType bundleType = new BundleType("testManageRootDirBundle", resourceType);
+ Repo repo = new Repo("testManageRootDirBundle");
+ PackageType packageType = new PackageType("testManageRootDirBundle", resourceType);
+ Bundle bundle = new Bundle("testManageRootDirBundle", bundleType, repo, packageType);
+ BundleVersion bundleVersion = new BundleVersion("testManageRootDirBundle", "1.0", bundle,
+ getRecipeFromFile("test-bundle-manage-root-dir.xml"));
+ BundleDestination destination = new BundleDestination(bundle, "testManageRootDirBundle", new ResourceGroup(
+ "testManageRootDirBundle"), DEST_BASE_DIR_NAME, this.destDir.getAbsolutePath());
+ Configuration config = new Configuration();
+
+ BundleDeployment deployment = new BundleDeployment();
+ deployment.setName("test bundle deployment name");
+ deployment.setBundleVersion(bundleVersion);
+ deployment.setConfiguration(config);
+ deployment.setDestination(destination);
+
+ // create bundle test files
+ File file0 = new File(this.bundleFilesDir, "zero.properties");
+ Properties props = new Properties();
+ props.setProperty("zero", "0");
+ FileOutputStream outputStream = new FileOutputStream(file0);
+ props.store(outputStream, "zero file");
+ outputStream.close();
+
+ File file1 = new File(this.bundleFilesDir, "one.properties");
+ props.clear();
+ props.setProperty("one", "1");
+ outputStream = new FileOutputStream(file1);
+ props.store(outputStream, "one file");
+ outputStream.close();
+
+ File file2 = new File(this.bundleFilesDir, "two.properties");
+ props.clear();
+ props.setProperty("two", "2");
+ outputStream = new FileOutputStream(file2);
+ props.store(outputStream, "two file");
+ outputStream.close();
+
+ // create some external test files that don't belong to the bundle but are in the dest dir (which is to be managed by the bundle)
+ this.destDir.mkdirs();
+ File external1 = new File(this.destDir, "external1.properties");
+ props.clear();
+ props.setProperty("external1", "1");
+ outputStream = new FileOutputStream(external1);
+ props.store(outputStream, "external1 file");
+ outputStream.close();
+
+ File external2 = new File(this.destDir, "extdir/external2.properties");
+ external2.getParentFile().mkdirs();
+ props.clear();
+ props.setProperty("external2", "2");
+ outputStream = new FileOutputStream(external2);
+ props.store(outputStream, "external2 file");
+ outputStream.close();
+
+ // deploy the bundle
+ BundleDeployRequest request = new BundleDeployRequest();
+ request.setBundleFilesLocation(this.bundleFilesDir);
+ request.setResourceDeployment(new BundleResourceDeployment(deployment, null));
+ request.setBundleManagerProvider(new MockBundleManagerProvider());
+ request.setAbsoluteDestinationDirectory(this.destDir);
+
+ BundleDeployResult results = plugin.deployBundle(request);
+
+ assertResultsSuccess(results);
+
+ // test that files were deployed in the proper place
+ props.clear();
+ loadProperties(props, new FileInputStream(new File(this.destDir, "zero.properties")));
+ assert "0".equals(props.getProperty("zero")) : "did not deploy bundle correctly 0";
+ loadProperties(props, new FileInputStream(new File(this.destDir, "subdir1/one.properties")));
+ assert "1".equals(props.getProperty("one")) : "did not deploy bundle correctly 1";
+ loadProperties(props, new FileInputStream(new File(this.destDir, "subdir2/two.properties")));
+ assert "2".equals(props.getProperty("two")) : "did not deploy bundle correctly 2";
+
+ DeploymentsMetadata metadata = new DeploymentsMetadata(this.destDir);
+ assert metadata.isManaged() == true : "missing metadata directory";
+ assert metadata.getCurrentDeploymentProperties().getManageRootDir() == true : "should be managing root dir";
+
+ // make sure our external files/directories were removed because
+ // they aren't part of the bundle and we are fully managing the dest dir
+ props.clear();
+ try {
+ loadProperties(props, new FileInputStream(new File(this.destDir, "external1.properties")));
+ assert false : "bundle deployment did not remove our managed file 1";
+ } catch (Exception ok) {
+ }
+ try {
+ loadProperties(props, new FileInputStream(new File(this.destDir, "extdir/external2.properties")));
+ assert false : "bundle deployment did not remove our managed file 2";
+ } catch (Exception ok) {
+ }
+
+ // now purge the bundle - this should purge everything in the deploy dir because we are fully managing it
+ BundlePurgeRequest purgeRequest = new BundlePurgeRequest();
+ purgeRequest.setLiveResourceDeployment(new BundleResourceDeployment(deployment, null));
+ purgeRequest.setBundleManagerProvider(new MockBundleManagerProvider());
+ purgeRequest.setAbsoluteDestinationDirectory(this.destDir);
+
+ BundlePurgeResult purgeResults = plugin.purgeBundle(purgeRequest);
+ assertResultsSuccess(purgeResults);
+
+ // make sure our bundle files have been completely purged; the metadata directory should have been purged too
+ assert new File(this.destDir, "zero.properties").exists() == false;
+ assert new File(this.destDir, "subdir1/one.properties").exists() == false;
+ assert new File(this.destDir, "subdir2/two.properties").exists() == false;
+ assert new File(this.destDir, "subdir1").exists() == false;
+ assert new File(this.destDir, "subdir2").exists() == false;
+ assert this.destDir.exists() == false : "deploy dir should not exist, we were told to fully manage it";
+
+ metadata = new DeploymentsMetadata(this.destDir);
+ assert metadata.getMetadataDirectory().exists() == false : "metadata directory should not exist";
+ }
+
private void upgrade(boolean clean) throws Exception {
- testAntBundleInitialInstall(); // install a bundle first
+ doAntBundleInitialInstall(clean); // install a bundle first
cleanPluginDirs(); // clean everything but the dest dir - we want to upgrade the destination
prepareBeforeTestMethod(); // prepare for our new test
diff --git a/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml b/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml
new file mode 100644
index 0000000..9b77dd8
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<project name="simple-build" default="main"
+ xmlns:rhq="antlib:org.rhq.bundle">
+
+ <rhq:bundle name="testManageRootDirBundle" version="1.0">
+ <rhq:deployment-unit name="simulated-war" manageRootDir="true">
+ <rhq:file name="zero.properties" destinationFile="zero.properties"/>
+ <rhq:file name="one.properties" destinationFile="subdir1/one.properties"/>
+ <rhq:file name="two.properties" destinationFile="subdir2/two.properties"/>
+ </rhq:deployment-unit>
+ </rhq:bundle>
+
+ <target name="main"/>
+
+</project>
\ No newline at end of file
12 years, 4 months
[rhq] 3 commits - modules/enterprise
by snegrea
modules/enterprise/gui/installer-war/pom.xml | 9 +--
modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java | 25 ++++++----
2 files changed, 20 insertions(+), 14 deletions(-)
New commits:
commit bfa42ba7f59974382e9c79f652926327f3efc28e
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jan 26 15:23:25 2012 -0600
Add code to reset and reinstall the database after an overwrite or upgrade test is run.
diff --git a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
index 6633cb7..e4fb711 100644
--- a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
+++ b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
@@ -27,6 +27,7 @@ import java.io.File;
import java.net.URL;
import java.util.Properties;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -67,6 +68,12 @@ public class DBInstallationTest {
installer.setLogDirectory(new File(LOG_DIRECTORY));
}
+ @AfterMethod
+ public void afterInstallation() throws Exception {
+ recreateTestDatabase();
+ installer.createNewDatabaseSchema(getInstallProperties());
+ }
+
@Test
public void overwriteJON230Schema() throws Exception {
installSchemaAndData("2.3.0");
commit 3f948097a57f7d20105474f2d2cc9a0e6e9dd892
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jan 26 11:03:40 2012 -0600
Revert "DBInstallationTest needs to use its own dedicated database"
This reverts commit cf001e9bc410896e57b7767164711fd8f819ccd8.
diff --git a/modules/enterprise/gui/installer-war/pom.xml b/modules/enterprise/gui/installer-war/pom.xml
index bd1474a..7f79832 100644
--- a/modules/enterprise/gui/installer-war/pom.xml
+++ b/modules/enterprise/gui/installer-war/pom.xml
@@ -35,8 +35,6 @@
<product.help.guide.agent>Running+the+RHQ+Agent</product.help.guide.agent>
<product.help.FAQ>FAQ</product.help.FAQ>
<product.help.config.props>http://support.rhq-project.org/display/JOPR2/Startup+Properties#Configuri...</product.help.config.props>
-
- <rhq.db.installation.test.db-name>rhq_installer_test_db</rhq.db.installation.test.db-name>
</properties>
<dependencies>
@@ -151,8 +149,6 @@
<rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password>
<rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name>
<rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password>
- <rhq.db.installation.test.db-name>${rhq.db.installation.test.db-name}</rhq.db.installation.test.db-name>
- <rhq.db.installation.test.connection-url>jdbc:postgresql://${rhq.test.ds.server-name}:5432/${rhq.db.installation.test.db-name}</rhq.db.installation.test.connection-url>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
index 3bff054..6633cb7 100644
--- a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
+++ b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
@@ -23,15 +23,18 @@
package org.rhq.enterprise.installer;
-import org.rhq.core.db.reset.DBReset;
-import org.rhq.core.db.setup.DBSetup;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import java.io.File;
import java.net.URL;
import java.util.Properties;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import org.rhq.core.db.reset.DBReset;
+import org.rhq.core.db.setup.DBSetup;
+import org.rhq.enterprise.installer.ServerInformation;
+import org.rhq.enterprise.installer.ServerProperties;
+
/**
* The tests in this class exercise the dbsetup/dbupgrade code that is run in the installer. The tests currently only
* run against postgresql. Support needs to be added for oracle. The tests do not do any post-install/upgrade
@@ -43,12 +46,12 @@ import java.util.Properties;
public class DBInstallationTest {
private final String LOG_DIRECTORY = System.getProperty("java.io.tmpdir", "rhq/installer-test");
- private final String DB_NAME = System.getProperty("rhq.db.installation.test.db-name", "rhq_installer_test_db");
+ private final String DB_NAME = System.getProperty("rhq.test.ds.db-name", "rhq_installer_test_db");
private final String USERNAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin");
private final String PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin");
private final String SERVER = System.getProperty("rhq.test.ds.server-name", "127.0.0.1");
- private final String DB_URL = System.getProperty("rhq.db.installation.test.connection-url",
- "jdbc:postgresql://" + SERVER + ":5432/" + DB_NAME);
+ private final String DB_URL = System.getProperty("rhq.test.ds.connection-url", "jdbc:postgresql://" + SERVER
+ + ":5432/" + DB_NAME);
private final String ADMIN_USERNAME = System.getProperty("rhq.db.admin.username", "postgres");
private final String ADMIN_PASSWORD = System.getProperty("rhq.db.admin.password", "postgres");
private static final String DB_TYPE_MAPPING = System.getProperty("rhq.test.ds.type-mapping", "PostgreSQL");
commit c1aa992c86006933eb955dc6d90ff9728f897863
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jan 26 11:02:28 2012 -0600
Revert "Updating the installer test to:"
This reverts commit 842ad5f20b752884d19e55d8f87e0e7252f78154.
diff --git a/modules/enterprise/gui/installer-war/pom.xml b/modules/enterprise/gui/installer-war/pom.xml
index c1dd476..bd1474a 100644
--- a/modules/enterprise/gui/installer-war/pom.xml
+++ b/modules/enterprise/gui/installer-war/pom.xml
@@ -145,13 +145,14 @@
<systemPropertyVariables>
<rhq.test.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.test.ds.type-mapping>
<rhq.test.ds.server-name>${rhq.test.ds.server-name}</rhq.test.ds.server-name>
- <rhq.test.ds.port>${rhq.test.ds.port}</rhq.test.ds.port>
- <rhq.db.installation.test.db-name>${rhq.db.installation.test.db-name}</rhq.db.installation.test.db-name>
+ <rhq.test.ds.db-name>${rhq.test.ds.db-name}</rhq.test.ds.db-name>
<rhq.test.ds.connection-url>${rhq.test.ds.connection-url}</rhq.test.ds.connection-url>
<rhq.db.admin.username>${rhq.db.admin.username}</rhq.db.admin.username>
<rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password>
<rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name>
<rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password>
+ <rhq.db.installation.test.db-name>${rhq.db.installation.test.db-name}</rhq.db.installation.test.db-name>
+ <rhq.db.installation.test.connection-url>jdbc:postgresql://${rhq.test.ds.server-name}:5432/${rhq.db.installation.test.db-name}</rhq.db.installation.test.connection-url>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -340,8 +341,8 @@
<id>oracle</id>
<activation>
<property>
- <name>rhq.test.ds.type-mapping</name>
- <value>Oracle10g</value>
+ <name>rhq.test.db.type</name>
+ <value>oracle</value>
</property>
</activation>
<build>
diff --git a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
index 81c5664..3bff054 100644
--- a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
+++ b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
@@ -47,9 +47,8 @@ public class DBInstallationTest {
private final String USERNAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin");
private final String PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin");
private final String SERVER = System.getProperty("rhq.test.ds.server-name", "127.0.0.1");
- private final String PORT = System.getProperty("rhq.test.ds.port", "5432");
- private final String DB_URL = System.getProperty("rhq.test.ds.connection-url", "jdbc:postgresql://" + SERVER
- + ":" + PORT + "/" + DB_NAME);
+ private final String DB_URL = System.getProperty("rhq.db.installation.test.connection-url",
+ "jdbc:postgresql://" + SERVER + ":5432/" + DB_NAME);
private final String ADMIN_USERNAME = System.getProperty("rhq.db.admin.username", "postgres");
private final String ADMIN_PASSWORD = System.getProperty("rhq.db.admin.password", "postgres");
private static final String DB_TYPE_MAPPING = System.getProperty("rhq.test.ds.type-mapping", "PostgreSQL");
12 years, 4 months
[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 10
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java | 11
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 18 -
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java | 149 +++++++++-
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 8
5 files changed, 180 insertions(+), 16 deletions(-)
New commits:
commit 04cd6df03ec0dd2bdd6093c313c55a4ff3cb3110
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 26 21:56:13 2012 +0100
First cut at content-based (re-)deployment
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 6fa678b..9651be2 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -51,6 +51,8 @@ public class ASConnection {
private ObjectMapper mapper;
public static boolean verbose = false; // This is a variable on purpose, so devs can switch it on in the debugger or in the agent
Authenticator passwordAuthenticator ;
+ private String host;
+ private int port;
/**
* Construct an ASConnection object. The real "physical" connection is done in
@@ -61,6 +63,8 @@ public class ASConnection {
* @param password password needed for authentication
*/
public ASConnection(String host, int port, String user, String password) {
+ this.host = host;
+ this.port = port;
try {
url = new URL("http", host, port, MANAGEMENT);
@@ -258,5 +262,11 @@ public class ASConnection {
}
}
+ public String getHost() {
+ return host;
+ }
+ public int getPort() {
+ return port;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index a5b8bdd..ff5aa94 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -66,8 +66,15 @@ public class ASUploadConnection {
public ASUploadConnection(String dcHost, int port, String user, String password) {
this.host = dcHost;
this.port = port;
- passwordAuthenticator = new AS7Authenticator(user,password);
- Authenticator.setDefault(passwordAuthenticator);
+ if (user!=null) {
+ passwordAuthenticator = new AS7Authenticator(user,password);
+ Authenticator.setDefault(passwordAuthenticator);
+ }
+ }
+
+ public ASUploadConnection(ASConnection asConnection) {
+ this.host=asConnection.getHost();
+ this.port=asConnection.getPort();
}
public OutputStream getOutputStream(String fileName) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index e4fa0e4..7510a8f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -70,7 +70,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-public class BaseComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>, MeasurementFacet, ConfigurationFacet, DeleteResourceFacet,
+public class BaseComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>, MeasurementFacet, ConfigurationFacet,
+ DeleteResourceFacet,
CreateChildResourceFacet, OperationFacet
{
private static final String INTERNAL = "_internal:";
@@ -341,13 +342,18 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo
if (fileName.startsWith("C:\\fakepath\\")) { // TODO this is a hack as the server adds the fake path somehow
fileName=fileName.substring("C:\\fakepath\\".length());
}
-
- String tmpName = fileName; // TODO figure out the tmp-name biz with the AS guys
+ String runtimeName = fileName;
+ PropertySimple rtNameProp = report.getPackageDetails().getDeploymentTimeConfiguration().getSimple("runtimeName");
+ if (rtNameProp != null) {
+ String rtn = rtNameProp.getStringValue();
+ if (rtn!=null && !rtn.isEmpty())
+ runtimeName = rtn;
+ }
JsonNode resultNode = uploadResult.get("result");
String hash = resultNode.get("BYTES_VALUE").getTextValue();
- return runDeploymentMagicOnServer(report, fileName, tmpName, hash);
+ return runDeploymentMagicOnServer(report, runtimeName, fileName, hash);
}
/**
@@ -367,7 +373,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo
ASConnection connection = getASConnection();
- Operation step1 = new Operation("add","deployment",deploymentName);
+ Operation step1 = new Operation("add","deployment",runtimeName);
// step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
List<Object> content = new ArrayList<Object>(1);
Map<String,Object> contentValues = new HashMap<String,Object>();
@@ -429,6 +435,8 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo
report.setStatus(CreateResourceStatus.SUCCESS);
report.setResourceName(runtimeName);
report.setResourceKey(resourceKey);
+ report.getPackageDetails().setSHA256(hash);
+ report.getPackageDetails().setInstallationTimestamp(System.currentTimeMillis());
log.info(" ... with success and key [" + resourceKey + "]" );
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
index 56eee84..2e6163d 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
@@ -1,18 +1,46 @@
package org.rhq.modules.plugins.jbossas7;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.codehaus.jackson.JsonNode;
+
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+import org.rhq.modules.plugins.jbossas7.json.ReadChildrenResources;
import org.rhq.modules.plugins.jbossas7.json.Result;
/**
* Deal with deployments
* @author Heiko W. Rupp
*/
-public class DeploymentComponent extends BaseComponent implements OperationFacet{
+public class DeploymentComponent extends BaseComponent implements OperationFacet, ContentFacet {
+
+ private boolean verbose = ASConnection.verbose;
@Override
public AvailabilityType getAvailability() {
@@ -21,7 +49,7 @@ public class DeploymentComponent extends BaseComponent implements OperationFacet
if (!res.isSuccess())
return AvailabilityType.DOWN;
- if (!(Boolean)(res.getResult()))
+ if (res.getResult()== null || !(Boolean)(res.getResult()))
return AvailabilityType.DOWN;
return AvailabilityType.UP;
@@ -50,4 +78,121 @@ public class DeploymentComponent extends BaseComponent implements OperationFacet
return result;
}
+
+
+ @Override
+ public List<DeployPackageStep> generateInstallationSteps(ResourcePackageDetails packageDetails) {
+ return new ArrayList<DeployPackageStep>();
+ }
+
+ @Override
+ public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages,
+ ContentServices contentServices) {
+
+ DeployPackagesResponse response = new DeployPackagesResponse();
+
+ if (packages.size()!=1) {
+ response.setOverallRequestResult(ContentResponseResult.FAILURE);
+ response.setOverallRequestErrorMessage("Can only deploy one package at a time");
+ }
+
+ ResourcePackageDetails detail = packages.iterator().next();
+
+ ASUploadConnection uploadConnection = new ASUploadConnection(getASConnection());
+ OutputStream out = uploadConnection.getOutputStream(detail.getFileName());
+ ResourceType resourceType = context.getResourceType();
+
+ log.info("trying " + resourceType.getName() + ", " + detail.getKey() );
+
+ contentServices.downloadPackageBits(context.getContentContext(),
+ detail.getKey(), out, true);
+
+ JsonNode uploadResult = uploadConnection.finishUpload();
+ if (verbose)
+ log.info(uploadResult);
+
+ if (ASUploadConnection.isErrorReply(uploadResult)) {
+ response.setOverallRequestResult(ContentResponseResult.FAILURE);
+ response.setOverallRequestErrorMessage(ASUploadConnection.getFailureDescription(uploadResult));
+
+ return response;
+ }
+ JsonNode resultNode = uploadResult.get("result");
+ String hash = resultNode.get("BYTES_VALUE").getTextValue();
+
+
+ CreateResourceReport report1 = new CreateResourceReport("", resourceType, new Configuration(),
+ new Configuration(), detail);
+ //CreateResourceReport report = runDeploymentMagicOnServer(report1,detail.getKey().getName(),hash, hash);
+
+ try {
+ redeployOnServer(detail.getKey().getName(), hash);
+ response.setOverallRequestResult(ContentResponseResult.SUCCESS);
+ }
+ catch (Exception e) {
+ response.setOverallRequestResult(ContentResponseResult.FAILURE);
+ }
+
+
+ return response;
+ }
+
+ private void redeployOnServer(String name, String hash) throws Exception {
+
+ Operation op = new Operation("full-replace-deployment", new Address());
+ op.addAdditionalProperty("name",name);
+ List<Object> content = new ArrayList<Object>(1);
+ Map<String,Object> contentValues = new HashMap<String,Object>();
+ contentValues.put("hash",new PROPERTY_VALUE("BYTES_VALUE",hash));
+ content.add(contentValues);
+ op.addAdditionalProperty("content",content);
+ Result result = getASConnection().execute(op);
+ if (result.isRolledBack())
+ throw new Exception(result.getFailureDescription());
+ }
+
+ @Override
+ public RemovePackagesResponse removePackages(Set<ResourcePackageDetails> packages) {
+ return null; // TODO: Customise this generated block
+ }
+
+ @Override
+ public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+
+ Set<ResourcePackageDetails> details = new HashSet<ResourcePackageDetails>();
+
+ // PackageType = "Deployment"
+ Address address1 = getAddress().getParent();
+ Operation op = new ReadChildrenResources(address1,"deployment");
+ ComplexResult cres = getASConnection().executeComplex(op);
+
+ if (!cres.isSuccess())
+ return details;
+
+ Map<String,Object> deployments = cres.getResult();
+ for (String key : deployments.keySet()) {
+ Map<String,Object> deployment = (Map<String, Object>) deployments.get(key);
+
+ List<Map> contentList = (List<Map>) deployment.get("content");
+ Map<String,Map> hashMap = contentList.get(0);
+ Map<String,String> bvMap = hashMap.get("hash");
+ String content = bvMap.get("BYTES_VALUE");
+ PackageDetailsKey pdKey = new PackageDetailsKey(key,
+ content, // no way to obtain the user defined version from the server
+ type.getName(),
+ "noarch"
+ );
+ ResourcePackageDetails detail = new ResourcePackageDetails(pdKey);
+ detail.setSHA256(content);
+
+ details.add(detail);
+ }
+
+ return details;
+ }
+
+ @Override
+ public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+ return null; // TODO: Customise this generated block
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index b044848..fdebf0a 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -185,8 +185,6 @@
displayType="summary" measurementType="dynamic" description="Max time for a request since last metric get" units="milliseconds"
displayName="Maximum request time"/>
- <metric property="server-state" dataType="trait" displayName="Server state" description="Detailed server state"
- displayType="summary"/>
<metric property="release-codename" dataType="trait" displayName="Code name of the release" displayType="summary"/>
<metric property="release-version" dataType="trait" displayName="Version of the server" displayType="summary"/>
<metric property="product-name" dataType="trait" displayName="Name of the product"/>
@@ -1108,17 +1106,13 @@
description="The number of times that statements from the cache were used"/>
<metric property="AverageBlockingTime" units="milliseconds"
description="The average time spent blocking for a connection"/>
- <metric property="MaxWaitTime" units="milliseconds"
- description="The maximum wait time for a connection" displayType="summary"/>
<metric property="ActiveCount"
description="The active count"/>
<metric property="CreatedCount" description="The created count" measurementType="trendsup"/>
<metric property="MaxCreationTime" description="The maximum time for creating a physical connection" units="milliseconds"/>
- <metric property="MaxWaitCount" description="The maximum number of threads waiting for a connection" units="milliseconds" displayType="summary"/>
<metric property="TotalCreationTime" description="The total time spent creating physical connections" measurementType="trendsup" units="milliseconds"/>
<metric property="AvailableCount" description="The available count" units="milliseconds"/>
<metric property="MaxUsedCount" description="The maximum number of connections used"/>
- <metric property="TimedOut" description="The timed out count" measurementType="trendsup" displayType="summary"/>
<metric property="TotalBlockingTime" description="The total blocking time" measurementType="trendsup" units="milliseconds"/>
<metric property="AverageCreationTime" description="The average time spent creating a physical connection" units="milliseconds"/>
<metric property="DestroyedCount" description="The destroyed count" measurementType="trendsup"/>
@@ -2155,7 +2149,7 @@ working area for individual server instances</li></ul>"/>
<content name="file" category="deployable" isCreationType="true" description="Deployments on this server group">
<configuration>
<c:group name="deployment" displayName="Deployment Options">
- <c:simple-property name="runtimeName" required="false"/>
+ <c:simple-property name="runtimeName" required="false" description="Runtime name of the uploaded file (e.g. 'my.war'). If not present, the file name is used."/>
</c:group>
</configuration>
</content>
12 years, 4 months
[rhq] 3 commits - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 13 +++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java | 7 --
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java | 19 +++++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java | 27 ++++++++++
4 files changed, 58 insertions(+), 8 deletions(-)
New commits:
commit 9586f50ca5fa7b8ab9046ee50a29223c2a6d0608
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 26 12:09:16 2012 +0100
BZ 766284 - Follow the type renaming from the plugin descriptor to again correctly detect server state.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
index 0352765..8fdb02e 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
@@ -18,13 +18,10 @@
*/
package org.rhq.modules.plugins.jbossas7;
-import java.util.ArrayList;
-import java.util.List;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.modules.plugins.jbossas7.json.Address;
import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
import org.rhq.modules.plugins.jbossas7.json.Result;
@@ -44,13 +41,13 @@ public class ManagedASComponent extends BaseComponent {
@Override
public AvailabilityType getAvailability() {
- if (context.getResourceType().getName().equals("JBossAS7 Managed Server")) {
+ if (context.getResourceType().getName().equals("Managed Server")) {
Address theAddress = new Address();
String host = pluginConfiguration.getSimpleValue("domainHost","local");
theAddress.add("host",host);
theAddress.add("server-config", myServerName);
Operation getStatus = new ReadAttribute(theAddress,"status");
- Result result = null;
+ Result result;
try {
result = connection.execute(getStatus);
} catch (Exception e) {
commit 667e32201f8701e6e0ebf04e2b57ff5f1570505b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 26 11:38:30 2012 +0100
Add a getParent() method to addresses.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
index 51fc3a2..ad0d6cf 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
@@ -195,4 +195,23 @@ public class Address {
PROPERTY_VALUE property_value = path.get(n);
return property_value.getKey() + "=" + property_value.getValue();
}
+
+ /**
+ * Return the parent Address of the current one. That is the address with one
+ * path segment less.
+ * If the current address is empty (the root), an empty address is returned.
+ * @return parent Address
+ */
+ public Address getParent() {
+ Address tmp = new Address();
+ int l = path.size();
+ if (l<1)
+ return tmp;
+
+ for (int i = 0; i < l-1 ; i++) {
+ tmp.path.add(path.get(i));
+ }
+
+ return tmp;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java
index 113bc53..882d377 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java
@@ -60,4 +60,31 @@ public class PathHandlingTest {
assert a.size()==3 : "Size was not 3, but "+ a.size();
assert !a.isEmpty();
}
+
+ public void getParent1() throws Exception {
+ String path = "subsystem=jms,profile=default,queue=foo";
+ Address a = new Address(path);
+ Address b = a.getParent();
+ assert b!=null;
+ assert b.size()==2;
+ assert b.get(0).equals("subsystem=jms");
+ assert b.get(1).equals("profile=default");
+ }
+
+ public void getParent2() throws Exception {
+ Address a = new Address();
+ Address b = a.getParent();
+ assert b!=null;
+ assert b.isEmpty();
+ assert b.size()==0;
+ }
+
+ public void getParent3() throws Exception {
+ Address a = new Address("foo=bar");
+ Address b = a.getParent();
+ assert b!=null;
+ assert b.isEmpty();
+ assert b.size()==0;
+ }
+
}
commit 12f4bb20d501b49093710dd9b86e28e884618989
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jan 25 13:10:45 2012 +0100
If the result is not a string, try to convert it accordingly.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 3f03e52..e4fa0e4 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -168,14 +168,14 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo
continue;
}
- String val = (String) res.getResult();
+ Object val = res.getResult();
if (val==null) // One of the AS7 ways of telling "This is not implemented" See also AS7-1454
continue;
if (req.getDataType()== DataType.MEASUREMENT) {
if (!val.equals("no metrics available")) { // AS 7 returns this
try {
- Double d = Double.parseDouble(val);
+ Double d = Double.parseDouble((String)val);
MeasurementDataNumeric data = new MeasurementDataNumeric(req,d);
report.addData(data);
} catch (NumberFormatException e) {
@@ -183,7 +183,14 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo
}
}
} else if (req.getDataType()== DataType.TRAIT) {
- MeasurementDataTrait data = new MeasurementDataTrait(req,val);
+
+ String realVal;
+ if (val instanceof String)
+ realVal = (String)val;
+ else
+ realVal = String.valueOf(val);
+
+ MeasurementDataTrait data = new MeasurementDataTrait(req,realVal);
report.addData(data);
}
}
12 years, 4 months
[rhq] modules/plugins
by snegrea
modules/plugins/oracle/pom.xml | 37 ++++------
modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/OracleServerComponentTest.java | 2
2 files changed, 16 insertions(+), 23 deletions(-)
New commits:
commit 2967bf90637cc80e7d43484adfc7826bb7b9c033
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Jan 25 14:33:40 2012 -0600
Use a more direct approach to disable tests. The tests will now run only oracle-test profile is explictly invoked.
Also corrected property bindings for database connection settings.
diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml
index 9a1f93e..509a614 100644
--- a/modules/plugins/oracle/pom.xml
+++ b/modules/plugins/oracle/pom.xml
@@ -26,24 +26,11 @@
</dependencies>
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ <profiles>
<profile>
<id>ojdbc-driver</id>
@@ -53,7 +40,7 @@
</property>
</activation>
- <!-- Make sure the Oracle JDBC jar gets included in the plugin jar's lib dir. -->
+ <!-- Make sure the Oracle JDBC jar gets included in the plugin jar's lib dir. -->
<build>
<plugins>
@@ -166,6 +153,11 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+
+ <properties>
+ <skipTests>false</skipTests>
+ </properties>
+
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
@@ -181,15 +173,15 @@
<systemProperties>
<property>
<name>oracle.url</name>
- <value>${oracle.url}</value>
+ <value>${rhq.test.ds.connection-url}</value>
</property>
<property>
- <name>oracle.userid</name>
- <value>${oracle.userid}</value>
+ <name>oracle.username</name>
+ <value>${rhq.test.ds.user-name}</value>
</property>
<property>
<name>oracle.password</name>
- <value>${oracle.password}</value>
+ <value>${rhq.test.ds.password}</value>
</property>
</systemProperties>
<!-- The below is required for tests to run against Oracle.
@@ -209,6 +201,7 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+
<build>
<plugins>
<plugin>
diff --git a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/OracleServerComponentTest.java b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/OracleServerComponentTest.java
index 949aaae..d9d2fb0 100644
--- a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/OracleServerComponentTest.java
+++ b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/OracleServerComponentTest.java
@@ -49,7 +49,7 @@ public class OracleServerComponentTest extends ComponentTest {
protected void setConfiguration(Configuration configuration, ResourceType resourceType) {
if (resourceType.getName().equals(ORACLE_SERVER)) {
log.info(configuration.getProperties());
- Pattern p = Pattern.compile("jdbc:.*:@(.*):(\\d+)/(\\w++)");
+ Pattern p = Pattern.compile("jdbc:.*:@(.*):(\\d+):(\\w++)");
String url = System.getProperty("oracle.url");
if (url == null)
throw new IllegalStateException("oracle.url system property not set");
12 years, 4 months
[rhq] Branch 'release/jon3.0.x' - modules/enterprise
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 15 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 11 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 10 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 26 +++++-----
4 files changed, 40 insertions(+), 22 deletions(-)
New commits:
commit a449c64328ab7c4b729e83adc3505fdf6ec34b90
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Dec 22 17:57:02 2011 -0500
[BZ 767734] conditionally disabling remaining tags references from Bundles.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 5ac460c..bbc4175 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -124,7 +124,11 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
+ deployment.getDestination().getName(), LinkManager.getBundleDestinationLink(version.getBundle().getId(),
deployment.getDestination().getId())));
addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDeployment_24.png"), deployment.getName()));
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
addMemberDeploymentsTable();
@@ -219,8 +223,8 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
// deployment represents content on the remote machines, showing purge only for live
// deployments makes sense).
if (deployment.isLive()) {
- IButton revertButton = new LocatableIButton(actionLayout.extendLocatorId("Revert"), MSG
- .view_bundle_revert());
+ IButton revertButton = new LocatableIButton(actionLayout.extendLocatorId("Revert"),
+ MSG.view_bundle_revert());
revertButton.setIcon("subsystems/bundle/BundleAction_Revert_16.png");
revertButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
@@ -252,8 +256,9 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
new Message(MSG.view_bundle_dest_purgeSuccessful(destinationName),
Message.Severity.Info));
// Bundle destination is purged, go back to bundle deployment view - it is not live anymore
- CoreGUI.goToView(LinkManager.getBundleDeploymentLink(bundle.getId(), deployment
- .getId()), true);
+ CoreGUI.goToView(
+ LinkManager.getBundleDeploymentLink(bundle.getId(), deployment.getId()),
+ true);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 1e47427..d0966f2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -101,7 +101,12 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
addMember(backButton);
addMember(header);
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
+
addMember(createSummaryForm());
addMember(createDeploymentsTable());
addMember(detail);
@@ -223,8 +228,8 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
new Message(MSG.view_bundle_dest_purgeSuccessful(destination.getName()),
Message.Severity.Info));
// Bundle destination is purged, go back to bundle destination view
- CoreGUI.goToView(LinkManager.getBundleDestinationLink(bundle.getId(), destination
- .getId()), true);
+ CoreGUI.goToView(
+ LinkManager.getBundleDestinationLink(bundle.getId(), destination.getId()), true);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index e8eabfa..7a39e5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -108,7 +108,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
addMember(backButton);
addMember(headerLabel);
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
addMember(tabs);
@@ -184,8 +188,8 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
StaticTextItem versionCountItem = new StaticTextItem("versionCount", MSG.view_bundle_list_versionsCount());
versionCountItem.setValue(bundle.getBundleVersions() != null ? bundle.getBundleVersions().size() : 0);
- StaticTextItem destinationsCountItem = new StaticTextItem("destinationsCount", MSG
- .view_bundle_list_destinationsCount());
+ StaticTextItem destinationsCountItem = new StaticTextItem("destinationsCount",
+ MSG.view_bundle_list_destinationsCount());
destinationsCountItem.setValue(bundle.getDestinations() != null ? bundle.getDestinations().size() : 0);
StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index 19116bb..5737a9c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -93,7 +93,10 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"), version.getName() + ": "
+ version.getVersion()));
- addMember(createTagEditor());
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
@@ -268,16 +271,17 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
criteria.fetchConfigurationDefinition(true);
criteria.fetchTags(true);
- bundleManager.findBundleVersionsByCriteriaWithDestinationFilter(criteria, new AsyncCallback<PageList<BundleVersion>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_bundle_version_loadFailure(), caught);
- }
+ bundleManager.findBundleVersionsByCriteriaWithDestinationFilter(criteria,
+ new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_bundle_version_loadFailure(), caught);
+ }
- public void onSuccess(PageList<BundleVersion> result) {
- BundleVersion version = result.get(0);
- ViewId nextPath = viewPath.next().getCurrent();
- viewBundleVersion(version, nextPath);
- }
- });
+ public void onSuccess(PageList<BundleVersion> result) {
+ BundleVersion version = result.get(0);
+ ViewId nextPath = viewPath.next().getCurrent();
+ viewBundleVersion(version, nextPath);
+ }
+ });
}
}
12 years, 4 months
[rhq] modules/enterprise
by lkrejci
modules/enterprise/gui/installer-war/pom.xml | 9 ++++-----
modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java | 5 +++--
2 files changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 842ad5f20b752884d19e55d8f87e0e7252f78154
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Jan 25 13:23:25 2012 +0100
Updating the installer test to:
1) Not execute on Oracle
2) Support port specification (in case connection url is missing)
3) Pass the rhq.db.installation.test.db-name to the TestNG test
diff --git a/modules/enterprise/gui/installer-war/pom.xml b/modules/enterprise/gui/installer-war/pom.xml
index bd1474a..c1dd476 100644
--- a/modules/enterprise/gui/installer-war/pom.xml
+++ b/modules/enterprise/gui/installer-war/pom.xml
@@ -145,14 +145,13 @@
<systemPropertyVariables>
<rhq.test.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.test.ds.type-mapping>
<rhq.test.ds.server-name>${rhq.test.ds.server-name}</rhq.test.ds.server-name>
- <rhq.test.ds.db-name>${rhq.test.ds.db-name}</rhq.test.ds.db-name>
+ <rhq.test.ds.port>${rhq.test.ds.port}</rhq.test.ds.port>
+ <rhq.db.installation.test.db-name>${rhq.db.installation.test.db-name}</rhq.db.installation.test.db-name>
<rhq.test.ds.connection-url>${rhq.test.ds.connection-url}</rhq.test.ds.connection-url>
<rhq.db.admin.username>${rhq.db.admin.username}</rhq.db.admin.username>
<rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password>
<rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name>
<rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password>
- <rhq.db.installation.test.db-name>${rhq.db.installation.test.db-name}</rhq.db.installation.test.db-name>
- <rhq.db.installation.test.connection-url>jdbc:postgresql://${rhq.test.ds.server-name}:5432/${rhq.db.installation.test.db-name}</rhq.db.installation.test.connection-url>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -341,8 +340,8 @@
<id>oracle</id>
<activation>
<property>
- <name>rhq.test.db.type</name>
- <value>oracle</value>
+ <name>rhq.test.ds.type-mapping</name>
+ <value>Oracle10g</value>
</property>
</activation>
<build>
diff --git a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
index 3bff054..81c5664 100644
--- a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
+++ b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
@@ -47,8 +47,9 @@ public class DBInstallationTest {
private final String USERNAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin");
private final String PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin");
private final String SERVER = System.getProperty("rhq.test.ds.server-name", "127.0.0.1");
- private final String DB_URL = System.getProperty("rhq.db.installation.test.connection-url",
- "jdbc:postgresql://" + SERVER + ":5432/" + DB_NAME);
+ private final String PORT = System.getProperty("rhq.test.ds.port", "5432");
+ private final String DB_URL = System.getProperty("rhq.test.ds.connection-url", "jdbc:postgresql://" + SERVER
+ + ":" + PORT + "/" + DB_NAME);
private final String ADMIN_USERNAME = System.getProperty("rhq.db.admin.username", "postgres");
private final String ADMIN_PASSWORD = System.getProperty("rhq.db.admin.password", "postgres");
private static final String DB_TYPE_MAPPING = System.getProperty("rhq.test.ds.type-mapping", "PostgreSQL");
12 years, 4 months
[rhq] Branch 'stefan/backingcontent' - 2 commits - modules/enterprise modules/plugins
by snegrea
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java | 10
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JarContentDelegate.java | 108 +++++-----
2 files changed, 65 insertions(+), 53 deletions(-)
New commits:
commit d2864d531dc9da059088236afc9d392671e7f323
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jan 24 16:56:57 2012 -0600
[BZ 781763] Added extra code to check if the directory for the JBoss server even exists before attempting to perform content discovery. If the folder is not there then the list will be empty since nothing is discovered.
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JarContentDelegate.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JarContentDelegate.java
index 33a2f02..af4243a 100644
--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JarContentDelegate.java
+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JarContentDelegate.java
@@ -79,61 +79,63 @@ public class JarContentDelegate extends FileContentDelegate {
public Set<ResourcePackageDetails> discoverDeployedPackages() {
Set<ResourcePackageDetails> packages = new HashSet<ResourcePackageDetails>();
- File[] files = this.directory.listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.getName().endsWith(getFileEnding()) && pathname.isFile();
- }
- });
-
- for (File file : files) {
- String manifestVersion = null;
- JarFile jf = null;
- try {
- Configuration config = new Configuration();
- jf = new JarFile(file);
- Manifest manifest = jf.getManifest();
-
- if (manifest != null) {
- Attributes attributes = manifest.getMainAttributes();
-
- manifestVersion = attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
-
- config.put(new PropertySimple("version", manifestVersion));
- config.put(new PropertySimple("title", attributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE)));
- config.put(new PropertySimple("url", attributes.getValue(Attributes.Name.IMPLEMENTATION_URL)));
- config
- .put(new PropertySimple("vendor", attributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR)));
-
- config.put(new PropertySimple("classpath", attributes.getValue(Attributes.Name.CLASS_PATH)));
- config.put(new PropertySimple("sealed", attributes.getValue(Attributes.Name.SEALED)));
+ if (this.directory != null && this.directory.exists() && this.directory.isDirectory()) {
+ File[] files = this.directory.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.getName().endsWith(getFileEnding()) && pathname.isFile();
}
- String sha256 = null;
- try {
- sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(file);
- } catch (Exception e) {
- // leave as null
- }
-
- ResourcePackageDetails details = new ResourcePackageDetails(new PackageDetailsKey(file.getName(),
- getVersion(sha256), getPackageTypeName(), "noarch"));
-
- packages.add(details);
- details.setFileCreatedDate(file.lastModified()); // Why don't we have a last modified time?
- details.setFileName(file.getName());
- details.setFileSize(file.length());
- details.setClassification(MIME_TYPE_JAR);
- details.setSHA256(sha256);
- details.setDisplayVersion(getDisplayVersion(file));
-
- details.setExtraProperties(config);
- } catch (IOException e) {
- // If we can't open it, don't worry about it, we just won't know the version
- } finally {
+ });
+
+ for (File file : files) {
+ String manifestVersion = null;
+ JarFile jf = null;
try {
- if (jf != null)
- jf.close();
- } catch (Exception e) {
- // Nothing we can do here ...
+ Configuration config = new Configuration();
+ jf = new JarFile(file);
+ Manifest manifest = jf.getManifest();
+
+ if (manifest != null) {
+ Attributes attributes = manifest.getMainAttributes();
+
+ manifestVersion = attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+
+ config.put(new PropertySimple("version", manifestVersion));
+ config.put(new PropertySimple("title", attributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE)));
+ config.put(new PropertySimple("url", attributes.getValue(Attributes.Name.IMPLEMENTATION_URL)));
+ config
+ .put(new PropertySimple("vendor", attributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR)));
+
+ config.put(new PropertySimple("classpath", attributes.getValue(Attributes.Name.CLASS_PATH)));
+ config.put(new PropertySimple("sealed", attributes.getValue(Attributes.Name.SEALED)));
+ }
+ String sha256 = null;
+ try {
+ sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(file);
+ } catch (Exception e) {
+ // leave as null
+ }
+
+ ResourcePackageDetails details = new ResourcePackageDetails(new PackageDetailsKey(file.getName(),
+ getVersion(sha256), getPackageTypeName(), "noarch"));
+
+ packages.add(details);
+ details.setFileCreatedDate(file.lastModified()); // Why don't we have a last modified time?
+ details.setFileName(file.getName());
+ details.setFileSize(file.length());
+ details.setClassification(MIME_TYPE_JAR);
+ details.setSHA256(sha256);
+ details.setDisplayVersion(getDisplayVersion(file));
+
+ details.setExtraProperties(config);
+ } catch (IOException e) {
+ // If we can't open it, don't worry about it, we just won't know the version
+ } finally {
+ try {
+ if (jf != null)
+ jf.close();
+ } catch (Exception e) {
+ // Nothing we can do here ...
+ }
}
}
}
commit 048e7de24274d36bcca51fbab6514bf6e80d4f3a
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jan 24 16:55:26 2012 -0600
[BZ 771418] Adding java docs for deprecated CLI method.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 498e0be..ff39171 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -505,6 +505,11 @@ public class ResourceClientProxy {
return remoteClient.getContentManager().getBackingPackageForResource(remoteClient.getSubject(), resourceClientProxy.resourceId);
}
+ /**
+ * @deprecated Superseded by ({@link #updateBackingContent(String, String)}
+ *
+ * @param fileName file name
+ */
@Deprecated
public void updateBackingContent(String filename) {
this.updateBackingContent(filename, null);
@@ -649,6 +654,11 @@ public class ResourceClientProxy {
public InstalledPackage getBackingContent();
+ /**
+ * @deprecated Superseded by ({@link #updateBackingContent(String, String)}
+ *
+ * @param fileName file name
+ */
@Deprecated
public void updateBackingContent(String fileName);
12 years, 4 months