JBoss Tools SVN: r34677 - in trunk: examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-09-13 08:26:47 -0400 (Tue, 13 Sep 2011)
New Revision: 34677
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/ImportDefaultMavenProjectExample.java
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples.cheatsheet/src/org/jboss/tools/project/examples/cheatsheet/actions/ImportProjectExample.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/ProjectTest.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java
Log:
JBIDE-9702 Refactor project examples plugin so that it can be used inside JBoss Central
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -10,12 +10,23 @@
************************************************************************************/
package org.jboss.tools.project.examples;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -25,12 +36,22 @@
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.internal.cheatsheets.state.DefaultStateManager;
+import org.eclipse.ui.internal.cheatsheets.views.CheatSheetView;
+import org.eclipse.ui.internal.cheatsheets.views.ViewUtilities;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.wst.validation.internal.operations.ValidationBuilder;
import org.jboss.tools.project.examples.fixes.ProjectExamplesFix;
@@ -39,6 +60,8 @@
import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectFix;
+import org.jboss.tools.project.examples.model.ProjectUtil;
+import org.jboss.tools.project.examples.wizard.ImportDefaultMavenProjectExample;
import org.osgi.framework.BundleContext;
/**
@@ -86,6 +109,7 @@
};
private Map<String, IImportProjectExample> importProjectExamplesMap;
+ private ImportDefaultMavenProjectExample defaultImportProjectExample;
/**
* The constructor
@@ -209,11 +233,15 @@
public IImportProjectExample getImportProjectExample(String importType) {
initImportProjectExamples();
+ if (importType == null) {
+ return defaultImportProjectExample;
+ }
return importProjectExamplesMap.get(importType);
}
private void initImportProjectExamples() {
if (importProjectExamplesMap == null) {
+ defaultImportProjectExample = new ImportDefaultMavenProjectExample();
importProjectExamplesMap = new HashMap<String,IImportProjectExample>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry
@@ -264,4 +292,153 @@
return null;
}
}
+
+ public static boolean downloadProject(Project project, IProgressMonitor monitor) {
+ if (project.isURLRequired()) {
+ String urlString = project.getUrl();
+ String name = project.getName();
+ URL url = null;
+ try {
+ url = new URL(urlString);
+ } catch (MalformedURLException e) {
+ ProjectExamplesActivator.log(e);
+ return false;
+ }
+ File file = ProjectUtil.getProjectExamplesFile(url, name,
+ ".zip", monitor); //$NON-NLS-1$
+ if (file == null) {
+ return false;
+ }
+ project.setFile(file);
+ }
+ return true;
+ }
+
+ public static void openWelcome(List<Project> projects) {
+ if (projects == null) {
+ return;
+ }
+ for(final Project project:projects) {
+ if (project.isWelcome()) {
+ String urlString = project.getWelcomeURL();
+ URL url = null;
+ if (urlString.startsWith("/")) { //$NON-NLS-1$
+ IPath path = new Path(urlString);
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (resource instanceof IFile && resource.isAccessible()) {
+ try {
+ url = resource.getRawLocationURI().toURL();
+ } catch (MalformedURLException e) {
+ ProjectExamplesActivator.log(e);
+ }
+ } else {
+ ProjectExamplesActivator.log(NLS.bind(Messages.NewProjectExamplesWizard_File_does_not_exist,urlString));
+ }
+ } else {
+ try {
+ url = new URL(urlString);
+ } catch (MalformedURLException e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ if (url!=null) {
+ final URL finalURL = url;
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ if (ProjectUtil.CHEATSHEETS.equals(project.getType())) {
+ CheatSheetView view = ViewUtilities.showCheatSheetView();
+ if (view == null) {
+ return;
+ }
+ IPath filePath = new Path(finalURL.getPath());
+ String id = filePath.lastSegment();
+ if (id == null) {
+ id = ""; //$NON-NLS-1$
+ }
+ view.getCheatSheetViewer().setInput(id, id, finalURL, new DefaultStateManager(), false);
+ } else {
+ try {
+ IWorkbenchBrowserSupport browserSupport = ProjectExamplesActivator.getDefault().getWorkbench().getBrowserSupport();
+ IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
+ browser.openURL(finalURL);
+ } catch (PartInitException e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ }
+
+ });
+
+ }
+ }
+ }
+ }
+
+ public static boolean extractZipFile(File file, File destination,
+ IProgressMonitor monitor) {
+ ZipFile zipFile = null;
+ destination.mkdirs();
+ try {
+ zipFile = new ZipFile(file);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ if (entry.isDirectory()) {
+ monitor.setTaskName("Extracting " + entry.getName());
+ File dir = new File(destination, entry.getName());
+ dir.mkdirs();
+ continue;
+ }
+ monitor.setTaskName("Extracting " + entry.getName());
+ File entryFile = new File(destination, entry.getName());
+ entryFile.getParentFile().mkdirs();
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = zipFile.getInputStream(entry);
+ out = new FileOutputStream(entryFile);
+ copy(in, out);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ ProjectExamplesActivator.log(e);
+ return false;
+ } finally {
+ if (zipFile != null) {
+ try {
+ zipFile.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return true;
+ }
+
+ public static void copy(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[16 * 1024];
+ int len;
+ while ((len = in.read(buffer)) >= 0) {
+ out.write(buffer, 0, len);
+ }
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -10,6 +10,7 @@
************************************************************************************/
package org.jboss.tools.project.examples.model;
+import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -39,6 +40,7 @@
private String importType;
private String importTypeDescription;
private ArchetypeModel archetypeModel = new ArchetypeModel();
+ private File file;
public Project() {
name=""; //$NON-NLS-1$
@@ -210,4 +212,12 @@
public boolean isURLRequired() {
return !ProjectExamplesActivator.MAVEN_ARCHETYPE.equals(importType);
}
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
}
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/ImportDefaultMavenProjectExample.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/ImportDefaultMavenProjectExample.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/ImportDefaultMavenProjectExample.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -0,0 +1,211 @@
+package org.jboss.tools.project.examples.wizard;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jdt.internal.core.OpenableElementInfo;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+import org.jboss.tools.project.examples.Messages;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.model.AbstractImportProjectExample;
+import org.jboss.tools.project.examples.model.Project;
+
+public class ImportDefaultMavenProjectExample extends
+ AbstractImportProjectExample {
+
+ private static final IOverwriteQuery OVERWRITE_ALL_QUERY = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return IOverwriteQuery.ALL;
+ }
+ };
+
+ @Override
+ public List<Project> importProject(Project projectDescription, File file,
+ IProgressMonitor monitor) throws Exception {
+ List<Project> projects = new ArrayList<Project>();
+ if (projectDescription.getIncludedProjects() == null) {
+ importSingleProject(projectDescription, file, monitor);
+ projects.add(projectDescription);
+ return projects;
+ } else {
+ List<String> projectNames = projectDescription.getIncludedProjects();
+ for (final String projectName : projectNames) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(projectName);
+ final boolean[] ret = new boolean[1];
+ if (project.exists()) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ ret[0] = MessageDialog.openQuestion(getActiveShell(),
+ Messages.NewProjectExamplesWizard_Question, NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
+ projectName));
+ }
+
+ });
+ if (!ret[0]) {
+ return projects;
+ }
+ project.delete(true, true, monitor);
+ }
+ project.create(monitor);
+ project.open(monitor);
+ ZipFile sourceFile = new ZipFile(file);
+ ZipLeveledStructureProvider structureProvider = new ZipLeveledStructureProvider(
+ sourceFile);
+
+ Enumeration<? extends ZipEntry> entries = sourceFile.entries();
+ ZipEntry entry = null;
+ List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
+ List<ZipEntry> directories = new ArrayList<ZipEntry>();
+ String prefix = projectName + "/"; //$NON-NLS-1$
+ while (entries.hasMoreElements()) {
+ entry = entries.nextElement();
+ if (entry.getName().startsWith(prefix)) {
+ if (!entry.isDirectory()) {
+ filesToImport.add(entry);
+ } else {
+ directories.add(entry);
+ }
+ }
+ }
+
+ structureProvider.setStrip(1);
+ ImportOperation operation = new ImportOperation(project.getFullPath(), structureProvider.getRoot(),
+ structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
+ operation.setContext(getActiveShell());
+ operation.run(monitor);
+ for (ZipEntry directory:directories) {
+ IPath resourcePath = new Path(directory.getName());
+ try {
+ workspace.getRoot().getFolder(resourcePath).create(false, true, null);
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ reconfigure(project, monitor);
+ }
+ }
+ return projects;
+ }
+
+ private void importSingleProject(Project projectDescription, File file,
+ IProgressMonitor monitor) throws CoreException, ZipException,
+ IOException, InvocationTargetException, InterruptedException {
+ final String projectName = projectDescription.getName();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(projectName);
+ final boolean[] ret = new boolean[1];
+ if (project.exists()) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ ret[0] = MessageDialog.openQuestion(getActiveShell(),
+ Messages.NewProjectExamplesWizard_Question, NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
+ projectName));
+ }
+
+ });
+ if (!ret[0]) {
+ return;
+ }
+ project.delete(true, true, monitor);
+ }
+ project.create(monitor);
+ project.open(monitor);
+ ZipFile sourceFile = new ZipFile(file);
+ ZipLeveledStructureProvider structureProvider = new ZipLeveledStructureProvider(
+ sourceFile);
+
+ Enumeration<? extends ZipEntry> entries = sourceFile.entries();
+ ZipEntry entry = null;
+ List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
+ List<ZipEntry> directories = new ArrayList<ZipEntry>();
+ String prefix = projectName + "/"; //$NON-NLS-1$
+ while (entries.hasMoreElements()) {
+ entry = entries.nextElement();
+ if (entry.getName().startsWith(prefix)) {
+ if (!entry.isDirectory()) {
+ filesToImport.add(entry);
+ } else {
+ directories.add(entry);
+ }
+ }
+ }
+
+ structureProvider.setStrip(1);
+ ImportOperation operation = new ImportOperation(project.getFullPath(), structureProvider.getRoot(),
+ structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
+ operation.setContext(getActiveShell());
+ operation.run(monitor);
+ for (ZipEntry directory:directories) {
+ IPath resourcePath = new Path(directory.getName());
+ try {
+ workspace.getRoot().getFolder(resourcePath).create(false, true, null);
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ reconfigure(project, monitor);
+
+ }
+
+ private static Shell getActiveShell() {
+ Display display = Display.getDefault();
+ final Shell[] ret = new Shell[1];
+ display.syncExec(new Runnable() {
+
+ public void run() {
+ ret[0] = Display.getCurrent().getActiveShell();
+ }
+
+ });
+ return ret[0];
+ }
+
+ private static void reconfigure(IProject project, IProgressMonitor monitor) throws CoreException {
+ if (project == null || !project.exists() || !project.isOpen() || !project.hasNature(JavaCore.NATURE_ID)) {
+ return;
+ }
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject != null && javaProject.exists() && javaProject.isOpen() && javaProject instanceof JavaProject) {
+ Object object = ((JavaProject) javaProject).getElementInfo();
+ if (object instanceof OpenableElementInfo) {
+ // copied from JavaProject.buildStructure(...)
+ OpenableElementInfo info = (OpenableElementInfo) object;
+ IClasspathEntry[] resolvedClasspath = ((JavaProject) javaProject).getResolvedClasspath();
+ IPackageFragmentRoot[] children = ((JavaProject) javaProject).computePackageFragmentRoots(resolvedClasspath,false, null /* no reverse map */);
+ info.setChildren(children);
+ ((JavaProject) javaProject).getPerProjectInfo().rememberExternalLibTimestamps();
+ }
+ }
+ }
+
+}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -15,25 +15,18 @@
*
*/
import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
@@ -44,16 +37,9 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.JavaProject;
-import org.eclipse.jdt.internal.core.OpenableElementInfo;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -79,7 +65,6 @@
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.IPreferenceConstants;
import org.eclipse.ui.internal.WorkbenchPlugin;
@@ -89,45 +74,21 @@
import org.eclipse.ui.internal.ide.IDEInternalPreferences;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.util.PrefUtil;
-import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider;
import org.eclipse.ui.internal.wizards.newresource.ResourceMessages;
import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.dialog.MarkerDialog;
-import org.jboss.tools.project.examples.fixes.SeamRuntimeFix;
-import org.jboss.tools.project.examples.fixes.WTPRuntimeFix;
import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
-import org.jboss.tools.project.examples.model.ProjectFix;
import org.jboss.tools.project.examples.model.ProjectUtil;
public class NewProjectExamplesWizard extends Wizard implements INewWizard {
- private static final IOverwriteQuery OVERWRITE_ALL_QUERY = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return IOverwriteQuery.ALL;
- }
- };
-
private List<Project> projects = new ArrayList<Project>();
- /**
- * The workbench.
- */
- private IWorkbench workbench;
-
- /**
- * The current selection.
- */
- private IStructuredSelection selection;
-
+
private NewProjectExamplesWizardPage page;
- private static Shell shell;
-
- protected static boolean overwrite;
-
private WorkspaceJob workspaceJob;
public NewProjectExamplesWizard() {
@@ -154,59 +115,35 @@
IStructuredSelection selection = page.getSelection();
Iterator iterator = selection.iterator();
projects.clear();
- List<File> files = new ArrayList<File>();
- File file = null;
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof Project) {
Project project = (Project) object;
- if (project.isURLRequired()) {
- String urlString = project.getUrl();
- String name = project.getName();
- URL url = null;
- try {
- url = new URL(urlString);
- } catch (MalformedURLException e) {
- ProjectExamplesActivator.log(e);
- continue;
- }
- file = ProjectUtil.getProjectExamplesFile(url, name,
- ".zip", monitor); //$NON-NLS-1$
- if (file == null) {
- return Status.CANCEL_STATUS;
- }
+ boolean success = ProjectExamplesActivator.downloadProject(project, monitor);
+ if (success) {
+ projects.add(project);
}
- projects.add(project);
- files.add(file);
}
}
try {
- int i = 0;
setName(Messages.NewProjectExamplesWizard_Importing);
for (final Project project : projects) {
- if (project.getImportType() == null) {
- importProject(project, files.get(i++), monitor);
- ProjectExamplesActivator.fix(project, monitor);
- } else {
- IImportProjectExample importProjectExample =
- ProjectExamplesActivator.getDefault().getImportProjectExample(project.getImportType());
- if (importProjectExample == null) {
- Display.getDefault().syncExec(new Runnable() {
+ IImportProjectExample importProjectExample =
+ ProjectExamplesActivator.getDefault().getImportProjectExample(project.getImportType());
+ if (importProjectExample == null) {
+ Display.getDefault().syncExec(new Runnable() {
- public void run() {
- MessageDialogWithToggle.openError(getShell(),
- Messages.NewProjectExamplesWizard_Error,
- "Cannot import a project of the '" + project.getImportType() + "' type.");
- }
-
- });
- return Status.OK_STATUS;
- }
- importProjectExample.importProject(project, files.get(i++), monitor);
- importProjectExample.fix(project, monitor);
+ public void run() {
+ MessageDialogWithToggle.openError(getShell(),
+ Messages.NewProjectExamplesWizard_Error,
+ "Cannot import a project of the '" + project.getImportType() + "' type.");
+ }
+ });
+ return Status.OK_STATUS;
}
+ importProjectExample.importProject(project, project.getFile(), monitor);
+ importProjectExample.fix(project, monitor);
}
-
} catch (final Exception e) {
Display.getDefault().syncExec(new Runnable() {
@@ -261,7 +198,7 @@
showQuickFix(projects);
}
}
- openWelcome();
+ ProjectExamplesActivator.openWelcome(projects);
}
public void running(IJobChangeEvent event) {
@@ -279,7 +216,7 @@
});
} else {
updatePerspective();
- openWelcome();
+ ProjectExamplesActivator.openWelcome(projects);
}
workspaceJob.schedule();
return true;
@@ -481,64 +418,7 @@
// Set the perspective.
page.setPerspective(persp);
}
- private void openWelcome() {
- for(final Project project:projects) {
- if (project.isWelcome()) {
- String urlString = project.getWelcomeURL();
- URL url = null;
- if (urlString.startsWith("/")) { //$NON-NLS-1$
- IPath path = new Path(urlString);
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- if (resource instanceof IFile && resource.isAccessible()) {
- try {
- url = resource.getRawLocationURI().toURL();
- } catch (MalformedURLException e) {
- ProjectExamplesActivator.log(e);
- }
- } else {
- ProjectExamplesActivator.log(NLS.bind(Messages.NewProjectExamplesWizard_File_does_not_exist,urlString));
- }
- } else {
- try {
- url = new URL(urlString);
- } catch (MalformedURLException e) {
- ProjectExamplesActivator.log(e);
- }
- }
- if (url!=null) {
- final URL finalURL = url;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (ProjectUtil.CHEATSHEETS.equals(project.getType())) {
- CheatSheetView view = ViewUtilities.showCheatSheetView();
- if (view == null) {
- return;
- }
- IPath filePath = new Path(finalURL.getPath());
- String id = filePath.lastSegment();
- if (id == null) {
- id = ""; //$NON-NLS-1$
- }
- view.getCheatSheetViewer().setInput(id, id, finalURL, new DefaultStateManager(), false);
- } else {
- try {
- IWorkbenchBrowserSupport browserSupport = ProjectExamplesActivator.getDefault().getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
- browser.openURL(finalURL);
- } catch (PartInitException e) {
- ProjectExamplesActivator.log(e);
- }
- }
- }
-
- });
-
- }
- }
- }
- }
-
public static void showQuickFix(final List<Project> projects) {
Display.getDefault().asyncExec(new Runnable() {
@@ -554,145 +434,8 @@
});
}
- public static void importProject(Project projectDescription, File file,
- IProgressMonitor monitor) throws Exception {
- if (projectDescription.getIncludedProjects() == null) {
- importSingleProject(projectDescription, file, monitor);
- } else {
- List<String> projects = projectDescription.getIncludedProjects();
- for (final String projectName : projects) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(projectName);
- if (project.exists()) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- overwrite = MessageDialog.openQuestion(getActiveShell(),
- Messages.NewProjectExamplesWizard_Question, NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
- projectName));
- }
-
- });
- if (!overwrite) {
- return;
- }
- project.delete(true, true, monitor);
- }
- project.create(monitor);
- project.open(monitor);
- ZipFile sourceFile = new ZipFile(file);
- ZipLeveledStructureProvider structureProvider = new ZipLeveledStructureProvider(
- sourceFile);
-
- Enumeration<? extends ZipEntry> entries = sourceFile.entries();
- ZipEntry entry = null;
- List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
- List<ZipEntry> directories = new ArrayList<ZipEntry>();
- String prefix = projectName + "/"; //$NON-NLS-1$
- while (entries.hasMoreElements()) {
- entry = entries.nextElement();
- if (entry.getName().startsWith(prefix)) {
- if (!entry.isDirectory()) {
- filesToImport.add(entry);
- } else {
- directories.add(entry);
- }
- }
- }
-
- structureProvider.setStrip(1);
- ImportOperation operation = new ImportOperation(project.getFullPath(), structureProvider.getRoot(),
- structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
- operation.setContext(getActiveShell());
- operation.run(monitor);
- for (ZipEntry directory:directories) {
- IPath resourcePath = new Path(directory.getName());
- try {
- workspace.getRoot().getFolder(resourcePath).create(false, true, null);
- } catch (Exception e) {
- ProjectExamplesActivator.log(e);
- }
- }
- reconfigure(project, monitor);
- }
- }
- }
-
- private static Shell getActiveShell() {
- Display display = Display.getDefault();
- shell = null;
- display.syncExec(new Runnable() {
-
- public void run() {
- shell = Display.getCurrent().getActiveShell();
- }
-
- });
- return shell;
- }
- private static void importSingleProject(Project projectDescription, File file,
- IProgressMonitor monitor) throws CoreException, ZipException,
- IOException, InvocationTargetException, InterruptedException {
- final String projectName = projectDescription.getName();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(projectName);
- if (project.exists()) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- overwrite = MessageDialog.openQuestion(getActiveShell(),
- Messages.NewProjectExamplesWizard_Question, NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
- projectName));
- }
-
- });
- if (!overwrite) {
- return;
- }
- project.delete(true, true, monitor);
- }
- project.create(monitor);
- project.open(monitor);
- ZipFile sourceFile = new ZipFile(file);
- ZipLeveledStructureProvider structureProvider = new ZipLeveledStructureProvider(
- sourceFile);
-
- Enumeration<? extends ZipEntry> entries = sourceFile.entries();
- ZipEntry entry = null;
- List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
- List<ZipEntry> directories = new ArrayList<ZipEntry>();
- String prefix = projectName + "/"; //$NON-NLS-1$
- while (entries.hasMoreElements()) {
- entry = entries.nextElement();
- if (entry.getName().startsWith(prefix)) {
- if (!entry.isDirectory()) {
- filesToImport.add(entry);
- } else {
- directories.add(entry);
- }
- }
- }
-
- structureProvider.setStrip(1);
- ImportOperation operation = new ImportOperation(project.getFullPath(), structureProvider.getRoot(),
- structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
- operation.setContext(getActiveShell());
- operation.run(monitor);
- for (ZipEntry directory:directories) {
- IPath resourcePath = new Path(directory.getName());
- try {
- workspace.getRoot().getFolder(resourcePath).create(false, true, null);
- } catch (Exception e) {
- ProjectExamplesActivator.log(e);
- }
- }
- reconfigure(project, monitor);
-
- }
-
+
public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
initializeDefaultPageImageDescriptor();
}
@@ -709,46 +452,5 @@
page = new NewProjectExamplesWizardPage();
addPage(page);
}
-
- private static List prepareFileList(IImportStructureProvider structure,
- ZipEntry entry, List list) {
- if (structure == null || entry == null)
- return null;
- if (list == null) {
- list = new ArrayList();
- }
- List son = structure.getChildren(entry);
- if (son == null)
- return list;
- Iterator it = son.iterator();
- while (it.hasNext()) {
- ZipEntry temp = (ZipEntry) it.next();
- if (temp.isDirectory()) {
- prepareFileList(structure, temp, list);
- } else {
- list.add(temp);
- }
- }
- return list;
- }
- private static void reconfigure(IProject project, IProgressMonitor monitor) throws CoreException {
- if (project == null || !project.exists() || !project.isOpen() || !project.hasNature(JavaCore.NATURE_ID)) {
- return;
- }
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null && javaProject.exists() && javaProject.isOpen() && javaProject instanceof JavaProject) {
- Object object = ((JavaProject) javaProject).getElementInfo();
- if (object instanceof OpenableElementInfo) {
- // copied from JavaProject.buildStructure(...)
- OpenableElementInfo info = (OpenableElementInfo) object;
- IClasspathEntry[] resolvedClasspath = ((JavaProject) javaProject).getResolvedClasspath();
- IPackageFragmentRoot[] children = ((JavaProject) javaProject).computePackageFragmentRoots(resolvedClasspath,false, null /* no reverse map */);
- info.setChildren(children);
- ((JavaProject) javaProject).getPerProjectInfo().rememberExternalLibTimestamps();
- }
- }
- }
-
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples.cheatsheet/src/org/jboss/tools/project/examples/cheatsheet/actions/ImportProjectExample.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples.cheatsheet/src/org/jboss/tools/project/examples/cheatsheet/actions/ImportProjectExample.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/examples/plugins/org.jboss.tools.project.examples.cheatsheet/src/org/jboss/tools/project/examples/cheatsheet/actions/ImportProjectExample.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -21,6 +21,7 @@
import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.cheatsheet.Activator;
+import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectUtil;
import org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard;
@@ -68,7 +69,9 @@
setName(Messages.NewProjectExamplesWizard_Importing);
try {
- NewProjectExamplesWizard.importProject(project, file, monitor);
+ IImportProjectExample importProjectExample = ProjectExamplesActivator.getDefault().getImportProjectExample(project.getImportType());
+ importProjectExample.importProject(project, file, monitor);
+ importProjectExample.fix(project, monitor);
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR,Activator.PLUGIN_ID,e.getMessage(),e);
throw new CoreException(status);
Modified: trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/ProjectTest.java
===================================================================
--- trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/ProjectTest.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/ProjectTest.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -31,6 +31,7 @@
import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Category;
+import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectUtil;
import org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard;
@@ -101,8 +102,9 @@
File file = ProjectUtil.getProjectExamplesFile(
url, name, ".zip", monitor); //$NON-NLS-1$
assertNotNull(file);
- NewProjectExamplesWizard.importProject(projectExample, file, monitor);
- ProjectExamplesActivator.fix(projectExample, monitor);
+ IImportProjectExample importProjectExample = ProjectExamplesActivator.getDefault().getImportProjectExample(projectExample.getImportType());
+ importProjectExample.importProject(projectExample, file, monitor);
+ importProjectExample.fix(projectExample, monitor);
}
@Test
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java 2011-09-13 12:20:40 UTC (rev 34676)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java 2011-09-13 12:26:47 UTC (rev 34677)
@@ -11,16 +11,9 @@
package org.jboss.tools.maven.project.examples;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Enumeration;
import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import org.apache.maven.model.Model;
import org.eclipse.core.resources.IProject;
@@ -43,10 +36,10 @@
import org.eclipse.m2e.core.project.MavenProjectInfo;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.eclipse.m2e.core.ui.internal.actions.OpenMavenConsoleAction;
-import org.eclipse.m2e.core.ui.internal.console.MavenConsole;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.progress.IProgressConstants;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.job.ProjectExamplesJob;
import org.jboss.tools.project.examples.model.AbstractImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
@@ -113,7 +106,7 @@
return projects;
}
}
- boolean ok = extractFile(file, destination, monitor);
+ boolean ok = ProjectExamplesActivator.extractZipFile(file, destination, monitor);
monitor.setTaskName("");
if (monitor.isCanceled()) {
return projects;
@@ -229,74 +222,7 @@
private static Shell getActiveShell() {
return Display.getDefault().getActiveShell();
}
-
- public boolean extractFile(File file, File destination,
- IProgressMonitor monitor) {
- ZipFile zipFile = null;
- destination.mkdirs();
- try {
- zipFile = new ZipFile(file);
- Enumeration<? extends ZipEntry> entries = zipFile.entries();
- while (entries.hasMoreElements()) {
- if (monitor.isCanceled()) {
- return false;
- }
- ZipEntry entry = (ZipEntry) entries.nextElement();
- if (entry.isDirectory()) {
- monitor.setTaskName("Extracting " + entry.getName());
- File dir = new File(destination, entry.getName());
- dir.mkdirs();
- continue;
- }
- monitor.setTaskName("Extracting " + entry.getName());
- File entryFile = new File(destination, entry.getName());
- entryFile.getParentFile().mkdirs();
- InputStream in = null;
- OutputStream out = null;
- try {
- in = zipFile.getInputStream(entry);
- out = new FileOutputStream(entryFile);
- copy(in, out);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
- } catch (IOException e) {
- MavenProjectExamplesActivator.log(e);
- return false;
- } finally {
- if (zipFile != null) {
- try {
- zipFile.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return true;
- }
- public static void copy(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[16 * 1024];
- int len;
- while ((len = in.read(buffer)) >= 0) {
- out.write(buffer, 0, len);
- }
- }
-
private static boolean deleteDirectory(File path, IProgressMonitor monitor) {
if (path.exists()) {
File[] files = path.listFiles();
14 years, 7 months
JBoss Tools SVN: r34675 - in trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test: src/org/jboss/ide/eclipse/as/openshift and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 08:15:53 -0400 (Tue, 13 Sep 2011)
New Revision: 34675
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/Activator.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/
Removed:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/StreamUtils.java
Log:
[JBIDE-9510] corrected package structure
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-13 12:15:53 UTC (rev 34675)
@@ -3,7 +3,7 @@
Bundle-Name: Openshift Test Plugin
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.test
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.openshift.internal.test.core.Activator
+Bundle-Activator: org.jboss.ide.eclipse.as.openshift.test.internal.core.Activator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.junit;bundle-version="[4.8.0,5.0.0)",
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.Status;
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationIntegrationTest {
-
- private IOpenshiftService openshiftService;
- private IOpenshiftService invalidCredentialsOpenshiftService;
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Before
- public void setUp() {
- this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
- this.invalidCredentialsOpenshiftService = new OpenshiftService(USERNAME, "bogus");
- }
-
- @Ignore
- @Test(expected = InvalidCredentialsOpenshiftException.class)
- public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
- invalidCredentialsOpenshiftService.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7);
- }
-
- @Ignore
- @Test
- public void canCreateApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- Cartridge cartridge = Cartridge.JBOSSAS_7;
- Application application = openshiftService.createApplication(applicationName, cartridge);
- assertNotNull(application);
- assertEquals(applicationName, application.getName());
- assertEquals(cartridge, application.getCartridge());
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canDestroyApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.destroyApplication(applicationName, Cartridge.JBOSSAS_7);
- }
-
- @Ignore
- @Test(expected = OpenshiftException.class)
- public void createDuplicateApplicationThrowsException() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canStopApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canStartStoppedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canStartStartedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- /**
- * freshly created apps are started
- *
- * @link
- * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
- */
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canStopStoppedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- /**
- * freshly created apps are started
- *
- * @link
- * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
- */
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Ignore
- @Test
- public void canRestartApplication() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- /**
- * freshly created apps are started
- *
- * @link
- * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
- */
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.restartApplication(applicationName, Cartridge.JBOSSAS_7);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- @Test
- public void canGetStatus() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- Application application = openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- Status status = openshiftService.getStatus(application);
- assertNotNull(status);
- } finally {
- silentlyDestroyApplication(applicationName, openshiftService);
- }
- }
-
- private String createRandomApplicationName() {
- return String.valueOf(System.currentTimeMillis());
- }
-
- private void silentlyDestroyApplication(String name, IOpenshiftService service) {
- try {
- service.destroyApplication(name, Cartridge.JBOSSAS_7);
- } catch (OpenshiftException e) {
- e.printStackTrace();
- }
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URLEncoder;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationTest {
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Test
- public void canMarshallApplicationCreateRequest() throws Exception {
- String expectedRequestString =
- "password="
- + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22"
- + "%2C+%22debug%22+%3A+%22true%22"
- + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
- + "%2C+%22action%22+%3A+%22configure%22"
- + "%2C+%22app_name%22+%3A+%22test-application%22"
- + "%7D";
-
- String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
- new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE, USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canMarshallApplicationDestroyRequest() throws Exception {
- String expectedRequestString =
- "password="
- + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+"
- + "%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22"
- + "%2C+%22debug%22+%3A+%22true%22"
- + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
- + "%2C+%22action%22+%3A+%22deconfigure%22"
- + "%2C+%22app_name%22+%3A+%22test-application%22"
- + "%7D";
-
- String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
- new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE, USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.fail;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-
-public class CartridgeAsserts {
-
- public static void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
- boolean found = false;
- for (Cartridge cartridge : cartridges) {
- if (cartridgeName.equals(cartridge.getName())) {
- found = true;
- break;
- }
- }
- if (!found) {
- fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
- }
- }
-
-
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,33 +0,0 @@
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class CartridgesIntegrationTest {
-
- private OpenshiftService openshiftService;
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Before
- public void setUp() {
- this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
- }
-
- @Ignore
- @Test
- public void canRequestListCartridges() throws Exception {
- List<Cartridge> cartridges = openshiftService.getCartridges();
- assertNotNull(cartridges);
- assertTrue(cartridges.size() > 0);
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
-import org.junit.Before;
-import org.junit.Test;
-
-public class DomainIntegrationTest {
-
- private OpenshiftService openshiftService;
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Before
- public void setUp() {
- this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
- }
-
- @Test
- public void canCreateDomain() throws Exception {
-
- String domainName = createRandomString();
- SSHKey sshKey = TestSSHKey.create();
- Domain domain = openshiftService.createDomain(domainName, sshKey);
-
- assertNotNull(domain);
- assertEquals(domainName, domain.getName());
- assertNotNull(domain.getUser());
- User user = domain.getUser();
- assertEquals(USERNAME, user.getRhlogin());
- assertNotNull(user.getUuid());
- }
-
- @Test
- public void canChangeDomain() throws Exception {
-
- String domainName = createRandomString();
- SSHKey sshKey = TestSSHKey.create();
- Domain domain = openshiftService.changeDomain(domainName, sshKey);
-
- assertNotNull(domain);
- assertEquals(domainName, domain.getName());
- assertNotNull(domain.getUser());
- User user = domain.getUser();
- assertEquals(USERNAME, user.getRhlogin());
- assertNotNull(user.getUuid());
- }
-
- private String createRandomString() {
- return String.valueOf(System.currentTimeMillis());
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
-import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class DomainTest {
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
- private static final String UUID = "0c82860dae904a4d87f8e5d87a5af840";
-
- @Test
- public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
- SSHKey sshKey = TestSSHKey.create();
- String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", false,
- sshKey.getPublicKeyContent());
-
- CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, USERNAME, true);
- String requestString =
- new OpenshiftJsonRequestFactory(
- PASSWORD,
- new DomainRequestJsonMarshaller().marshall(request))
- .create();
- assertEquals(expectedRequestString, requestString);
- }
-
- @Test
- public void canUnmarshallDomainCreateResponse() throws IOException, OpenshiftException {
- String domainName = "myDomain";
- String responseString = createDomainResponseString(USERNAME, UUID);
-
- responseString = JsonSanitizer.sanitize(responseString);
- OpenshiftResponse<Domain> response = new DomainResponseUnmarshaller(domainName).unmarshall(responseString);
-
- assertNotNull(response);
- Domain domain = response.getData();
- assertEquals(domainName, domain.getName());
- User user = domain.getUser();
- assertNotNull(user);
- assertEquals(USERNAME, user.getRhlogin());
- assertEquals(UUID, user.getUuid());
- }
-
- @Test
- public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
- SSHKey sshKey = TestSSHKey.create();
- String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", true,
- sshKey.getPublicKeyContent());
-
- ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, USERNAME, true);
- String requestString =
- new OpenshiftJsonRequestFactory(
- PASSWORD,
- new DomainRequestJsonMarshaller().marshall(request))
- .create();
- assertEquals(expectedRequestString, requestString);
- }
-
- private String createDomainRequestString(String password, String username, boolean debug, String namespace,
- boolean alter, String sshPublicKey) throws UnsupportedEncodingException {
- return "password="
- + password
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+"
- + "%22"
- + URLEncoder.encode(username, "UTF-8")
- + "%22"
- + "%2C+%22debug%22+%3A+%22" + String.valueOf(debug) + "%22"
- + "%2C+%22namespace%22+%3A+%22" + URLEncoder.encode(namespace, "UTF-8") + "%22"
- + "%2C+%22alter%22+%3A+%22" + String.valueOf(alter) + "%22"
- + "%2C+%22ssh%22+%3A+%22"
- + URLEncoder.encode(sshPublicKey, "UTF-8")
- + "%22"
- + "%7D";
- }
-
- /**
- * WARNING: the response this method returns matches the actual response
- * from the openshift service (9-12-2011). It is not valid json since it quotes the
- * nested json object
- * <p>
- * "data": "{\"rhlogin\": ...
- */
- private String createDomainResponseString(String username, String uuid) {
- return "{\"messages\":\"\",\"debug\":\"\",\"data\":\""
- + "{\\\"rhlogin\\\":\\\""
- + username
- + "\\\",\\\"uuid\\\":\\\""
- + uuid
- + "\\\"}"
- + "\",\"api\":\"1.1.1\",\"api_c\":[\"placeholder\"],\"result\":null,\"broker\":\"1.1.1\",\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],\"exit_code\":0}";
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.jboss.ide.eclipse.as.openshift.internal.test.core.CartridgeAsserts.assertThatContainsCartridge;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class ListCartridgesIntegrationTest {
-
- private OpenshiftService openshiftService;
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Before
- public void setUp() {
- this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
- }
-
- @Test
- public void canListCartridges() throws Exception {
- List<Cartridge> cartridges = openshiftService.getCartridges();
- assertNotNull(cartridges);
- assertTrue(cartridges.size() > 0);
- assertThatContainsCartridge("jbossas-7.0", cartridges);
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.jboss.ide.eclipse.as.openshift.internal.test.core.CartridgeAsserts.assertThatContainsCartridge;
-import static org.junit.Assert.assertEquals;
-
-import java.net.URLEncoder;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class ListCartridgesTest {
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Test
- public void canMarshallListCartridgesRequest() throws Exception {
- String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
-
- String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
- new ListCartridgesRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, listCartridgeRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
- String cartridgeListResponse =
- "{"
- + "\"messages\":\"\","
- + "\"debug\":\"\","
- + "\"data\":"
- + "\"{\\\"carts\\\":[\\\"perl-5.10\\\",\\\"jbossas-7.0\\\",\\\"wsgi-3.2\\\",\\\"rack-1.1\\\",\\\"php-5.3\\\"]}\","
- + "\"api\":\"1.1.1\","
- + "\"api_c\":[\"placeholder\"],"
- + "\"result\":null,"
- + "\"broker\":\"1.1.1\","
- + "\"broker_c\":["
- + "\"namespace\","
- + "\"rhlogin\","
- + "\"ssh\","
- + "\"app_uuid\","
- + "\"debug\","
- + "\"alter\","
- + "\"cartridge\","
- + "\"cart_type\","
- + "\"action\","
- + "\"app_name\","
- + "\"api"
- + "\"],"
- + "\"exit_code\":0}";
-
- cartridgeListResponse = JsonSanitizer.sanitize(cartridgeListResponse);
- OpenshiftResponse<List<Cartridge>> response =
- new ListCartridgesResponseUnmarshaller().unmarshall(cartridgeListResponse);
- assertEquals("", response.getMessages());
- assertEquals(false, response.isDebug());
-
- List<Cartridge> cartridges = response.getData();
- assertEquals(5, cartridges.size());
- assertThatContainsCartridge("perl-5.10", cartridges);
- assertThatContainsCartridge("jbossas-7.0", cartridges);
- assertThatContainsCartridge("wsgi-3.2", cartridges);
- assertThatContainsCartridge("rack-1.1", cartridges);
- assertThatContainsCartridge("php-5.3", cartridges);
- assertEquals(null, response.getResult());
- assertEquals(0, response.getExitCode());
- }
-
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-
-(a)RunWith(Suite.class)
-(a)Suite.SuiteClasses({
- ApplicationIntegrationTest.class,
- CartridgesIntegrationTest.class,
- DomainIntegrationTest.class,
- ListCartridgesIntegrationTest.class
-})
-/**
- * @author André Dietisheim
- */
-public class OpenshiftIntegrationTestSuite {
-
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-
-(a)RunWith(Suite.class)
-(a)Suite.SuiteClasses({
- ApplicationTest.class,
- ListCartridgesTest.class,
- DomainTest.class,
- UserInfoTest.class
-})
-/**
- * @author André Dietisheim
- */
-public class OpenshiftTestSuite {
-
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.junit.Test;
-
-public class SSHKeyTest {
-
- private static final String PASSPHRASE = "12345";
-
- @Test
- public void canCreatePublicKey() throws Exception {
- String publicKeyPath = createTempFile().getAbsolutePath();
- String privateKeyPath = createTempFile().getAbsolutePath();
- SSHKey sshKey = SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
- String publicKey = sshKey.getPublicKeyContent();
-
- assertNotNull(publicKey);
- assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
- assertTrue(!publicKey.contains(" ")); // no comment
- }
-
- @Test
- public void canLoadPublicKey() throws Exception {
- String publicKeyPath = createTempFile().getAbsolutePath();
- String privateKeyPath = createTempFile().getAbsolutePath();
- SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
-
- SSHKey sshKey = SSHKey.load(privateKeyPath, publicKeyPath);
- String publicKey = sshKey.getPublicKeyContent();
-
- assertNotNull(publicKey);
- assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
- assertTrue(!publicKey.contains(" ")); // no comment
- }
-
- private File createTempFile() throws IOException {
- return File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
- }
-}
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 12:13:05 UTC (rev 34674)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URLEncoder;
-
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class UserInfoTest {
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Test
- public void canMarshallUserInfoRequest() throws Exception {
- String expectedRequestString =
- "password=" + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22%2C+"
- + "%22debug%22+%3A+%22true%22"
- + "%7D";
-
- String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new UserInfoRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, userInfoRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/Activator.java (from rev 34670, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/Activator.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/Activator.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.Status;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationIntegrationTest {
+
+ private IOpenshiftService openshiftService;
+ private IOpenshiftService invalidCredentialsOpenshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ this.invalidCredentialsOpenshiftService = new OpenshiftService(USERNAME, "bogus");
+ }
+
+ @Ignore
+ @Test(expected = InvalidCredentialsOpenshiftException.class)
+ public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
+ invalidCredentialsOpenshiftService.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7);
+ }
+
+ @Ignore
+ @Test
+ public void canCreateApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ Cartridge cartridge = Cartridge.JBOSSAS_7;
+ Application application = openshiftService.createApplication(applicationName, cartridge);
+ assertNotNull(application);
+ assertEquals(applicationName, application.getName());
+ assertEquals(cartridge, application.getCartridge());
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canDestroyApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.destroyApplication(applicationName, Cartridge.JBOSSAS_7);
+ }
+
+ @Ignore
+ @Test(expected = OpenshiftException.class)
+ public void createDuplicateApplicationThrowsException() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStopApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStartStoppedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStartStartedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStopStoppedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canRestartApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.restartApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Test
+ public void canGetStatus() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ Application application = openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ Status status = openshiftService.getStatus(application);
+ assertNotNull(status);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ private String createRandomApplicationName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ private void silentlyDestroyApplication(String name, IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, Cartridge.JBOSSAS_7);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallApplicationCreateRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22configure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canMarshallApplicationDestroyRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22deconfigure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java (from rev 34670, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+
+public class CartridgeAsserts {
+
+ public static void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
+ boolean found = false;
+ for (Cartridge cartridge : cartridges) {
+ if (cartridgeName.equals(cartridge.getName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
+ }
+ }
+
+
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,33 @@
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Ignore
+ @Test
+ public void canRequestListCartridges() throws Exception {
+ List<Cartridge> cartridges = openshiftService.getCartridges();
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DomainIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Test
+ public void canCreateDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.createDomain(domainName, sshKey);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getName());
+ assertNotNull(domain.getUser());
+ User user = domain.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getUuid());
+ }
+
+ @Test
+ public void canChangeDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.changeDomain(domainName, sshKey);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getName());
+ assertNotNull(domain.getUser());
+ User user = domain.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getUuid());
+ }
+
+ private String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+ private static final String UUID = "0c82860dae904a4d87f8e5d87a5af840";
+
+ @Test
+ public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", false,
+ sshKey.getPublicKeyContent());
+
+ CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ @Test
+ public void canUnmarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ String domainName = "myDomain";
+ String responseString = createDomainResponseString(USERNAME, UUID);
+
+ responseString = JsonSanitizer.sanitize(responseString);
+ OpenshiftResponse<Domain> response = new DomainResponseUnmarshaller(domainName).unmarshall(responseString);
+
+ assertNotNull(response);
+ Domain domain = response.getData();
+ assertEquals(domainName, domain.getName());
+ User user = domain.getUser();
+ assertNotNull(user);
+ assertEquals(USERNAME, user.getRhlogin());
+ assertEquals(UUID, user.getUuid());
+ }
+
+ @Test
+ public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", true,
+ sshKey.getPublicKeyContent());
+
+ ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ private String createDomainRequestString(String password, String username, boolean debug, String namespace,
+ boolean alter, String sshPublicKey) throws UnsupportedEncodingException {
+ return "password="
+ + password
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22"
+ + URLEncoder.encode(username, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22" + String.valueOf(debug) + "%22"
+ + "%2C+%22namespace%22+%3A+%22" + URLEncoder.encode(namespace, "UTF-8") + "%22"
+ + "%2C+%22alter%22+%3A+%22" + String.valueOf(alter) + "%22"
+ + "%2C+%22ssh%22+%3A+%22"
+ + URLEncoder.encode(sshPublicKey, "UTF-8")
+ + "%22"
+ + "%7D";
+ }
+
+ /**
+ * WARNING: the response this method returns matches the actual response
+ * from the openshift service (9-12-2011). It is not valid json since it quotes the
+ * nested json object
+ * <p>
+ * "data": "{\"rhlogin\": ...
+ */
+ private String createDomainResponseString(String username, String uuid) {
+ return "{\"messages\":\"\",\"debug\":\"\",\"data\":\""
+ + "{\\\"rhlogin\\\":\\\""
+ + username
+ + "\\\",\\\"uuid\\\":\\\""
+ + uuid
+ + "\\\"}"
+ + "\",\"api\":\"1.1.1\",\"api_c\":[\"placeholder\"],\"result\":null,\"broker\":\"1.1.1\",\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],\"exit_code\":0}";
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.jboss.ide.eclipse.as.openshift.test.internal.core.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Test
+ public void canListCartridges() throws Exception {
+ List<Cartridge> cartridges = openshiftService.getCartridges();
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.jboss.ide.eclipse.as.openshift.test.internal.core.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallListCartridgesRequest() throws Exception {
+ String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
+
+ String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
+ new ListCartridgesRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, listCartridgeRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
+ String cartridgeListResponse =
+ "{"
+ + "\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":"
+ + "\"{\\\"carts\\\":[\\\"perl-5.10\\\",\\\"jbossas-7.0\\\",\\\"wsgi-3.2\\\",\\\"rack-1.1\\\",\\\"php-5.3\\\"]}\","
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":null,"
+ + "\"broker\":\"1.1.1\","
+ + "\"broker_c\":["
+ + "\"namespace\","
+ + "\"rhlogin\","
+ + "\"ssh\","
+ + "\"app_uuid\","
+ + "\"debug\","
+ + "\"alter\","
+ + "\"cartridge\","
+ + "\"cart_type\","
+ + "\"action\","
+ + "\"app_name\","
+ + "\"api"
+ + "\"],"
+ + "\"exit_code\":0}";
+
+ cartridgeListResponse = JsonSanitizer.sanitize(cartridgeListResponse);
+ OpenshiftResponse<List<Cartridge>> response =
+ new ListCartridgesResponseUnmarshaller().unmarshall(cartridgeListResponse);
+ assertEquals("", response.getMessages());
+ assertEquals(false, response.isDebug());
+
+ List<Cartridge> cartridges = response.getData();
+ assertEquals(5, cartridges.size());
+ assertThatContainsCartridge("perl-5.10", cartridges);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ assertThatContainsCartridge("wsgi-3.2", cartridges);
+ assertThatContainsCartridge("rack-1.1", cartridges);
+ assertThatContainsCartridge("php-5.3", cartridges);
+ assertEquals(null, response.getResult());
+ assertEquals(0, response.getExitCode());
+ }
+
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java (from rev 34670, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationIntegrationTest.class,
+ CartridgesIntegrationTest.class,
+ DomainIntegrationTest.class,
+ ListCartridgesIntegrationTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftIntegrationTestSuite {
+
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftTestSuite.java (from rev 34670, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftTestSuite.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationTest.class,
+ ListCartridgesTest.class,
+ DomainTest.class,
+ UserInfoTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftTestSuite {
+
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java (from rev 34670, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.junit.Test;
+
+public class SSHKeyTest {
+
+ private static final String PASSPHRASE = "12345";
+
+ @Test
+ public void canCreatePublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKey sshKey = SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKeyContent();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ @Test
+ public void canLoadPublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+
+ SSHKey sshKey = SSHKey.load(privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKeyContent();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ private File createTempFile() throws IOException {
+ return File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
+ }
+}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java (from rev 34674, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallUserInfoRequest() throws Exception {
+ String expectedRequestString =
+ "password=" + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22%2C+"
+ + "%22debug%22+%3A+%22true%22"
+ + "%7D";
+
+ String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new UserInfoRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, userInfoRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -8,14 +8,14 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes;
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes;
import java.io.File;
import java.io.IOException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.jboss.ide.eclipse.as.openshift.internal.test.core.utils.StreamUtils;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.StreamUtils;
/**
* @author André Dietisheim
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/StreamUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/StreamUtils.java 2011-09-13 12:15:53 UTC (rev 34675)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.test.core.utils;
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.utils;
import java.io.File;
import java.io.FileWriter;
14 years, 7 months
JBoss Tools SVN: r34674 - trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 08:13:05 -0400 (Tue, 13 Sep 2011)
New Revision: 34674
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
Log:
[JBIDE-9510] corrected package structure
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -19,7 +19,7 @@
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.Status;
-import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -15,10 +15,10 @@
import java.net.URLEncoder;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ApplicationRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
import org.junit.Test;
/**
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -6,7 +6,7 @@
import java.util.List;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -16,7 +16,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -21,13 +21,13 @@
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.DomainRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ChangeDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.DomainResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -17,7 +17,7 @@
import java.util.List;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -18,12 +18,12 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
import org.junit.Test;
/**
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 12:12:13 UTC (rev 34673)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 12:13:05 UTC (rev 34674)
@@ -14,9 +14,9 @@
import java.net.URLEncoder;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.UserInfoRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
import org.junit.Test;
/**
14 years, 7 months
JBoss Tools SVN: r34671 - in trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core: src/org/jboss/ide/eclipse/as/openshift/core and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 08:07:48 -0400 (Tue, 13 Sep 2011)
New Revision: 34671
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftCoreActivator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftCoreActivator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/utils/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/BadRequestException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/HttpClientException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/InternalServerErrorException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/NotFoundException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UnauthorizedException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ApplicationRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/DomainRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ListCartridgesRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/UserInfoRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationAction.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ListCartridgesRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/OpenshiftJsonRequestFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/UserInfoRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/OpenshiftResponse.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Base64Encoder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StreamUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StringUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java
Log:
[JBIDE-9510] corrected package structure
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-13 12:07:48 UTC (rev 34671)
@@ -3,7 +3,7 @@
Bundle-Name: Openshift Core Plugin
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.core
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftCoreActivator
+Bundle-Activator: org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftCoreActivator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.eclipse.core.runtime,
com.jcraft.jsch;bundle-version="[0.1.41,2.0.0)"
@@ -13,7 +13,7 @@
.
Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core,
- org.jboss.ide.eclipse.as.openshift.internal.core;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.ide.eclipse.as.openshift.internal.core.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.ide.eclipse.as.openshift.internal.core.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
+ org.jboss.ide.eclipse.as.openshift.core.internal;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.ide.eclipse.as.openshift.core.internal.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.ide.eclipse.as.openshift.core.internal.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,6 +1,6 @@
package org.jboss.ide.eclipse.as.openshift.core;
-import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.HttpClientException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.HttpClientException;
public interface IHttpClient {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core;
-import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftCoreActivator;
-import org.jboss.ide.eclipse.as.openshift.internal.core.utils.Base64Encoder;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftCoreActivator;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.Base64Encoder;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftCoreActivator.java (from rev 34637, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftCoreActivator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftCoreActivator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftCoreActivator.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class OpenshiftCoreActivator implements BundleActivator {
+
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.openshift.core";
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ OpenshiftCoreActivator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ OpenshiftCoreActivator.context = null;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftCoreActivator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java (from rev 34668, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.Status;
+import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.HttpClientException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.UnauthorizedException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.UrlConnectionHttpClient;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.AbstractDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftService implements IOpenshiftService {
+
+ private static final String BASE_URL = "https://openshift.redhat.com/broker";
+
+ private String username;
+ private String password;
+
+ public OpenshiftService(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public UserInfo getUserInfo() throws OpenshiftException {
+ UserInfoRequest userInfoRequest = new UserInfoRequest(username, true);
+ String url = userInfoRequest.getUrlString(BASE_URL);
+ try {
+ String userInfoRequestString = new UserInfoRequestJsonMarshaller().marshall(userInfoRequest);
+ String request = new OpenshiftJsonRequestFactory(password, userInfoRequestString).create();
+ String userInfoResponse = createHttpClient(url).post(request);
+ throw new UnsupportedOperationException();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", username, url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", username, url, e);
+ }
+ }
+
+ /**
+ * WARNING: the current server implementation returns invalid json.
+ *
+ * @see ListCartridgesResponseUnmarshaller
+ * @see JsonSanitizer#sanitize(String)
+ */
+ @Override
+ public List<Cartridge> getCartridges() throws OpenshiftException {
+ ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(username, true);
+ String url = listCartridgesRequest.getUrlString(BASE_URL);
+ try {
+ String listCartridgesRequestString =
+ new ListCartridgesRequestJsonMarshaller().marshall(listCartridgesRequest);
+ String request = new OpenshiftJsonRequestFactory(password, listCartridgesRequestString).create();
+ String listCatridgesReponse = createHttpClient(url).post(request);
+ listCatridgesReponse = JsonSanitizer.sanitize(listCatridgesReponse);
+ OpenshiftResponse<List<Cartridge>> response =
+ new ListCartridgesResponseUnmarshaller().unmarshall(listCatridgesReponse);
+ return response.getData();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ }
+ }
+
+ @Override
+ public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ return SSHKey.create(passPhrase, privateKeyPath, publicKeyPath);
+ }
+
+ @Override
+ public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ return SSHKey.load(privateKeyPath, publicKeyPath);
+ }
+
+ @Override
+ public Domain createDomain(String name, SSHKey sshKey) throws OpenshiftException {
+ return requestDomainAction(new CreateDomainRequest(name, sshKey, username, true));
+ }
+
+ @Override
+ public Domain changeDomain(String newName, SSHKey sshKey) throws OpenshiftException {
+ return requestDomainAction(new ChangeDomainRequest(newName, sshKey, username, true));
+ }
+
+ protected Domain requestDomainAction(AbstractDomainRequest request) throws OpenshiftException {
+ String url = request.getUrlString(BASE_URL);
+ try {
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ password,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ String responseString = createHttpClient(url).post(requestString);
+ responseString = JsonSanitizer.sanitize(responseString);
+ OpenshiftResponse<Domain> response =
+ new DomainResponseUnmarshaller(request.getName()).unmarshall(responseString);
+ return response.getData();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ }
+ }
+
+ @Override
+ public Application createApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.CONFIGURE, username,
+ true));
+ }
+
+ @Override
+ public Application destroyApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.DECONFIGURE,
+ username, true));
+ }
+
+ @Override
+ public Application startApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.START, username, true));
+ }
+
+ @Override
+ public Application restartApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.RESTART, username,
+ true));
+ }
+
+ @Override
+ public Application stopApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.STOP, username, true));
+ }
+
+ /**
+ * This seems not implemented yet on the server. The service simply returns
+ * a <code>null</code> data object. example response:
+ * <p>
+ * {"messages":"","debug":"","data":null,"api":"1.1.1","api_c":[
+ * "placeholder"
+ * ],"result":"Success","broker":"1.1.1","broker_c":["namespace"
+ * ,"rhlogin","ssh"
+ * ,"app_uuid","debug","alter","cartridge","cart_type","action"
+ * ,"app_name","api"],"exit_code":0}
+ */
+ @Override
+ public Status getStatus(Application application) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ // requestApplicationAction(
+ // new ApplicationRequest(application.getName(),
+ // application.getCartridge(), ApplicationAction.STOP, username, true));
+ }
+
+ protected Application requestApplicationAction(ApplicationRequest applicationRequest) throws OpenshiftException {
+ String url = applicationRequest.getUrlString(BASE_URL);
+ try {
+ String applicationRequestString =
+ new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
+ String request = new OpenshiftJsonRequestFactory(password, applicationRequestString).create();
+ String response = createHttpClient(url).post(request);
+
+ response = JsonSanitizer.sanitize(response);
+ OpenshiftResponse<Application> openshiftResponse =
+ new ApplicationResponseUnmarshaller(applicationRequest.getName(),
+ applicationRequest.getCartridge(), this).unmarshall(response);
+ return openshiftResponse.getData();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftException(
+ e, "Could not {0} application \"{1}\" at \"{2}\": Invalid url \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ } catch (UnauthorizedException e) {
+ throw new InvalidCredentialsOpenshiftException(
+ url, e,
+ "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url, username,
+ password);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not {0} application \"{1}\" at \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ }
+ }
+
+ private IHttpClient createHttpClient(String url) throws MalformedURLException {
+ return new UrlConnectionHttpClient(new URL(url));
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/BadRequestException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/BadRequestException.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/BadRequestException.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/HttpClientException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/HttpClientException.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/HttpClientException.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/InternalServerErrorException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/InternalServerErrorException.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/InternalServerErrorException.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/NotFoundException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/NotFoundException.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/NotFoundException.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UnauthorizedException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/UnauthorizedException.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UnauthorizedException.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/httpclient/UrlConnectionHttpClient.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.internal.core.httpclient;
+package org.jboss.ide.eclipse.as.openshift.core.internal.httpclient;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -7,7 +7,7 @@
import java.text.MessageFormat;
import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
-import org.jboss.ide.eclipse.as.openshift.internal.core.utils.StreamUtils;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.StreamUtils;
public class UrlConnectionHttpClient implements IHttpClient {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,12 +8,12 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.AbstractOpenshiftRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.AbstractOpenshiftRequest;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractOpenshiftMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractOpenshiftMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
public abstract class AbstractOpenshiftMarshaller<REQUEST extends IOpenshiftRequest> implements IOpenshiftMarshaller<REQUEST> {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ApplicationRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,13 +8,13 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/DomainRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/DomainRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/DomainRequestJsonMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,12 +8,12 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.AbstractDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.AbstractDomainRequest;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftRequest.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ListCartridgesRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,11 +8,11 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/UserInfoRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/UserInfoRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/UserInfoRequestJsonMarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,9 +8,9 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
+package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractDomainRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.IOpenshiftRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.utils.UrlBuilder;
-
-/**
- * @author André Dietisheim
- */
-public abstract class AbstractOpenshiftRequest implements IOpenshiftRequest {
-
- private String rhlogin;
- private boolean debug;
-
- public AbstractOpenshiftRequest(String username) {
- this(username, false);
- }
-
- public AbstractOpenshiftRequest(String username, boolean debug) {
- this.rhlogin = username;
- this.debug = debug;
- }
-
- public String getRhLogin() {
- return rhlogin;
- }
-
- public boolean isDebug() {
- return debug;
- }
-
- public URL getUrl(String baseUrl) throws MalformedURLException {
- return new UrlBuilder(baseUrl).path(getResourcePath()).toUrl();
- }
-
- public String getUrlString(String baseUrl) {
- return new UrlBuilder(baseUrl).path(getResourcePath()).toString();
- }
-
- protected abstract String getResourcePath();
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java (from rev 34668, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractOpenshiftRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.IOpenshiftRequest;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.UrlBuilder;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractOpenshiftRequest implements IOpenshiftRequest {
+
+ private String rhlogin;
+ private boolean debug;
+
+ public AbstractOpenshiftRequest(String username) {
+ this(username, false);
+ }
+
+ public AbstractOpenshiftRequest(String username, boolean debug) {
+ this.rhlogin = username;
+ this.debug = debug;
+ }
+
+ public String getRhLogin() {
+ return rhlogin;
+ }
+
+ public boolean isDebug() {
+ return debug;
+ }
+
+ public URL getUrl(String baseUrl) throws MalformedURLException {
+ return new UrlBuilder(baseUrl).path(getResourcePath()).toUrl();
+ }
+
+ public String getUrlString(String baseUrl) {
+ return new UrlBuilder(baseUrl).path(getResourcePath()).toString();
+ }
+
+ protected abstract String getResourcePath();
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ApplicationAction.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationAction.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
public enum ApplicationAction {
CONFIGURE, DECONFIGURE, START, STOP, RESTART, STATUS;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ApplicationRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/CreateDomainRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ListCartridgesRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ListCartridgesRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ListCartridgesRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
/**
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/OpenshiftJsonRequestFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/OpenshiftJsonRequestFactory.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/OpenshiftJsonRequestFactory.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/UserInfoRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/UserInfoRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/UserInfoRequest.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.request;
+package org.jboss.ide.eclipse.as.openshift.core.internal.request;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Application> {
-
- private String applicationName;
- private Cartridge cartridge;
-
- public ApplicationResponseUnmarshaller(String applicationName, Cartridge cartridge) {
- this.applicationName = applicationName;
- this.cartridge = cartridge;
- }
-
- @Override
- protected Application createOpenshiftObject(ModelNode node) {
- return new Application(applicationName, cartridge);
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java (from rev 34638, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Application> {
+
+ private String applicationName;
+ private Cartridge cartridge;
+ private IOpenshiftService service;
+
+ public ApplicationResponseUnmarshaller(String applicationName, Cartridge cartridge, IOpenshiftService service) {
+ this.applicationName = applicationName;
+ this.cartridge = cartridge;
+ this.service = service;
+ }
+
+ @Override
+ protected Application createOpenshiftObject(ModelNode node) {
+ return new Application(applicationName, cartridge, service);
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Domain;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/JsonSanitizer.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ListCartridgesResponseUnmarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/OpenshiftResponse.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/OpenshiftResponse.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/OpenshiftResponse.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.response;
+package org.jboss.ide.eclipse.as.openshift.core.internal.response;
/**
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Base64Encoder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/utils/Base64Encoder.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Base64Encoder.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -26,7 +26,7 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package org.jboss.ide.eclipse.as.openshift.internal.core.utils;
+package org.jboss.ide.eclipse.as.openshift.core.internal.utils;
public class Base64Encoder {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StreamUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/utils/StreamUtils.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StreamUtils.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.internal.core.utils;
+package org.jboss.ide.eclipse.as.openshift.core.internal.utils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StringUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/utils/StringUtils.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/StringUtils.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core.utils;
+package org.jboss.ide.eclipse.as.openshift.core.internal.utils;
/**
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/utils/UrlBuilder.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.internal.core.utils;
+package org.jboss.ide.eclipse.as.openshift.core.internal.utils;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftCoreActivator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftCoreActivator.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftCoreActivator.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class OpenshiftCoreActivator implements BundleActivator {
-
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.openshift.core";
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- public void start(BundleContext bundleContext) throws Exception {
- OpenshiftCoreActivator.context = bundleContext;
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
- OpenshiftCoreActivator.context = null;
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-13 11:53:25 UTC (rev 34670)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-13 12:07:48 UTC (rev 34671)
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.internal.core;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.jboss.ide.eclipse.as.openshift.core.Status;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
-import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.HttpClientException;
-import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.UnauthorizedException;
-import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.UrlConnectionHttpClient;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ApplicationRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.DomainRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.UserInfoRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.AbstractDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ChangeDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.ApplicationResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.DomainResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
-
-/**
- * @author André Dietisheim
- */
-public class OpenshiftService implements IOpenshiftService {
-
- private static final String BASE_URL = "https://openshift.redhat.com/broker";
-
- private String username;
- private String password;
-
- public OpenshiftService(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- public UserInfo getUserInfo() throws OpenshiftException {
- UserInfoRequest userInfoRequest = new UserInfoRequest(username, true);
- String url = userInfoRequest.getUrlString(BASE_URL);
- try {
- String userInfoRequestString = new UserInfoRequestJsonMarshaller().marshall(userInfoRequest);
- String request = new OpenshiftJsonRequestFactory(password, userInfoRequestString).create();
- String userInfoResponse = createHttpClient(url).post(request);
- throw new UnsupportedOperationException();
- } catch (MalformedURLException e) {
- throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", username, url, e);
- } catch (HttpClientException e) {
- throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", username, url, e);
- }
- }
-
- /**
- * WARNING: the current server implementation returns invalid json.
- *
- * @see ListCartridgesResponseUnmarshaller
- * @see JsonSanitizer#sanitize(String)
- */
- @Override
- public List<Cartridge> getCartridges() throws OpenshiftException {
- ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(username, true);
- String url = listCartridgesRequest.getUrlString(BASE_URL);
- try {
- String listCartridgesRequestString =
- new ListCartridgesRequestJsonMarshaller().marshall(listCartridgesRequest);
- String request = new OpenshiftJsonRequestFactory(password, listCartridgesRequestString).create();
- String listCatridgesReponse = createHttpClient(url).post(request);
- listCatridgesReponse = JsonSanitizer.sanitize(listCatridgesReponse);
- OpenshiftResponse<List<Cartridge>> response =
- new ListCartridgesResponseUnmarshaller().unmarshall(listCatridgesReponse);
- return response.getData();
- } catch (MalformedURLException e) {
- throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
- } catch (HttpClientException e) {
- throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
- }
- }
-
- @Override
- public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
- return SSHKey.create(passPhrase, privateKeyPath, publicKeyPath);
- }
-
- @Override
- public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
- return SSHKey.load(privateKeyPath, publicKeyPath);
- }
-
- @Override
- public Domain createDomain(String name, SSHKey sshKey) throws OpenshiftException {
- return requestDomainAction(new CreateDomainRequest(name, sshKey, username, true));
- }
-
- @Override
- public Domain changeDomain(String newName, SSHKey sshKey) throws OpenshiftException {
- return requestDomainAction(new ChangeDomainRequest(newName, sshKey, username, true));
- }
-
- protected Domain requestDomainAction(AbstractDomainRequest request) throws OpenshiftException {
- String url = request.getUrlString(BASE_URL);
- try {
- String requestString =
- new OpenshiftJsonRequestFactory(
- password,
- new DomainRequestJsonMarshaller().marshall(request))
- .create();
- String responseString = createHttpClient(url).post(requestString);
- responseString = JsonSanitizer.sanitize(responseString);
- OpenshiftResponse<Domain> response =
- new DomainResponseUnmarshaller(request.getName()).unmarshall(responseString);
- return response.getData();
- } catch (MalformedURLException e) {
- throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
- } catch (HttpClientException e) {
- throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
- }
- }
-
- @Override
- public Application createApplication(String name, Cartridge cartridge) throws OpenshiftException {
- return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.CONFIGURE, username,
- true));
- }
-
- @Override
- public Application destroyApplication(String name, Cartridge cartridge) throws OpenshiftException {
- return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.DECONFIGURE,
- username, true));
- }
-
- @Override
- public Application startApplication(String name, Cartridge cartridge) throws OpenshiftException {
- return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.START, username, true));
- }
-
- @Override
- public Application restartApplication(String name, Cartridge cartridge) throws OpenshiftException {
- return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.RESTART, username,
- true));
- }
-
- @Override
- public Application stopApplication(String name, Cartridge cartridge) throws OpenshiftException {
- return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.STOP, username, true));
- }
-
- /**
- * This seems not implemented yet on the server. The service simply returns
- * a <code>null</code> data object. example response:
- * <p>
- * {"messages":"","debug":"","data":null,"api":"1.1.1","api_c":[
- * "placeholder"
- * ],"result":"Success","broker":"1.1.1","broker_c":["namespace"
- * ,"rhlogin","ssh"
- * ,"app_uuid","debug","alter","cartridge","cart_type","action"
- * ,"app_name","api"],"exit_code":0}
- */
- @Override
- public Status getStatus(Application application) throws OpenshiftException {
- throw new UnsupportedOperationException();
- // requestApplicationAction(
- // new ApplicationRequest(application.getName(),
- // application.getCartridge(), ApplicationAction.STOP, username, true));
- }
-
- protected Application requestApplicationAction(ApplicationRequest applicationRequest) throws OpenshiftException {
- String url = applicationRequest.getUrlString(BASE_URL);
- try {
- String applicationRequestString =
- new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
- String request = new OpenshiftJsonRequestFactory(password, applicationRequestString).create();
- String response = createHttpClient(url).post(request);
-
- response = JsonSanitizer.sanitize(response);
- OpenshiftResponse<Application> openshiftResponse =
- new ApplicationResponseUnmarshaller(applicationRequest.getName(),
- applicationRequest.getCartridge(), this).unmarshall(response);
- return openshiftResponse.getData();
- } catch (MalformedURLException e) {
- throw new OpenshiftException(
- e, "Could not {0} application \"{1}\" at \"{2}\": Invalid url \"{2}\"",
- applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
- } catch (UnauthorizedException e) {
- throw new InvalidCredentialsOpenshiftException(
- url, e,
- "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
- applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url, username,
- password);
- } catch (HttpClientException e) {
- throw new OpenshiftEndpointException(
- url, e, "Could not {0} application \"{1}\" at \"{2}\"",
- applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
- }
- }
-
- private IHttpClient createHttpClient(String url) throws MalformedURLException {
- return new UrlConnectionHttpClient(new URL(url));
- }
-}
14 years, 7 months
JBoss Tools SVN: r34670 - in trunk/as/tests: org.jboss.ide.eclipse.as.egit.test/src/org/jboss/ide/eclipse/as/egit/internal/test and 16 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 07:53:25 -0400 (Tue, 13 Sep 2011)
New Revision: 34670
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.classpath
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.project
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.settings/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.settings/org.eclipse.jdt.core.prefs
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/build.properties
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/src/org/jboss/ide/eclipse/as/egit/internal/test/EGitUtilsTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/.classpath
Log:
[JBIDE-9510] moving org.jboss.ide.eclipse.as.openshift.test to tests
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/src/org/jboss/ide/eclipse/as/egit/internal/test/EGitUtilsTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/src/org/jboss/ide/eclipse/as/egit/internal/test/EGitUtilsTest.java 2011-09-13 11:51:57 UTC (rev 34669)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/src/org/jboss/ide/eclipse/as/egit/internal/test/EGitUtilsTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -19,13 +19,15 @@
public class EGitUtilsTest {
private static final String GIT_EMAIL = "dummyUser(a)redhat.com";
-
private static final String GIT_USER = "dummyUser";
-
+ private static final String REPO2_REMOTE_NAME = "openshift";
+
protected final TestUtils testUtils = new TestUtils();
private TestRepository testRepository;
+ private TestRepository testRepository2;
private TestProject testProject;
+ private TestProject testProject2;
private TestRepository clonedTestRepository;
@Before
@@ -39,7 +41,14 @@
testRepository.setUserAndEmail(GIT_USER, GIT_EMAIL);
testRepository.connect(testProject.getProject());
+ this.testProject2 = new TestProject(true);
+
+ this.testRepository2 = new TestRepository(TestUtils.createGitDir(testProject2));
+ testRepository2.setUserAndEmail(GIT_USER, GIT_EMAIL);
+ testRepository2.connect(testProject2.getProject());
+
this.clonedTestRepository = cloneRepository(testRepository);
+ clonedTestRepository.addRemoteTo(REPO2_REMOTE_NAME, testRepository2.getRepository());
}
private TestRepository cloneRepository(TestRepository repository) throws URISyntaxException,
@@ -54,9 +63,11 @@
public void tearDown() throws Exception {
testRepository.dispose();
clonedTestRepository.dispose();
-
+ testRepository2.dispose();
+ Activator.getDefault().getRepositoryCache().clear();
+
testProject.dispose();
- Activator.getDefault().getRepositoryCache().clear();
+ testProject2.dispose();
}
@Test
@@ -96,35 +107,42 @@
@Test
public void fileAddedToCloneIsInRemoteAfterPush() throws Exception {
- TestProject testProject2 = null;
- TestRepository testRepository2 = null;
String fileName = "c.txt";
String fileContent = "adietish(a)redhat.com";
- String remoteRepoName = "openshift";
-
- try {
- testProject2 = new TestProject(true);
- File gitDir = TestUtils.createGitDir(testProject2);
- testRepository2 = new TestRepository(gitDir);
- clonedTestRepository.addRemoteTo(remoteRepoName, testRepository2.getRepository());
- File file = clonedTestRepository.createFile(fileName, fileContent);
- clonedTestRepository.addAndCommit(file, "adding a file");
+ File file = clonedTestRepository.createFile(fileName, fileContent);
+ clonedTestRepository.addAndCommit(file, "adding a file");
- EGitUtils.push(remoteRepoName, clonedTestRepository.getRepository(), null);
+ EGitUtils.push(REPO2_REMOTE_NAME, clonedTestRepository.getRepository(), null);
- // does origin contain file added to clone?
- testUtils.assertRepositoryContainsFilesWithContent(
- clonedTestRepository.getRepository(),
- fileName,
- fileContent);
- } finally {
- if (testProject2 != null) {
- testProject2.dispose();
- }
- if (testRepository2 != null) {
- testRepository2.dispose();
- }
- }
+ // does origin contain file added to clone?
+ testUtils.assertRepositoryContainsFilesWithContent(
+ testRepository2.getRepository(),
+ fileName,
+ fileContent);
}
+
+ @Test
+ public void forcedPushRemovesFileInRemote() throws Exception {
+ String fileName = "c.txt";
+ String fileContent = "adietish(a)redhat.com";
+
+ IFile fileInRepo2 = testUtils.addFileToProject(
+ testProject2.getProject(),
+ fileName,
+ fileContent);
+ testRepository2.track(fileInRepo2);
+
+ File fileInClone = clonedTestRepository.createFile(fileName, fileContent);
+ clonedTestRepository.addAndCommit(fileInClone, "adding a file");
+
+ EGitUtils.push(REPO2_REMOTE_NAME, clonedTestRepository.getRepository(), null);
+
+ // does origin contain file added to clone?
+ testUtils.assertRepositoryContainsFilesWithContent(
+ clonedTestRepository.getRepository(),
+ fileName,
+ fileContent);
+ }
+
}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.classpath
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.classpath (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.classpath 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.project
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.project (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.project 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.openshift.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/.settings/org.eclipse.jdt.core.prefs 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,8 @@
+#Thu Aug 25 16:44:11 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Openshift Test Plugin
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.ide.eclipse.as.openshift.internal.test.core.Activator
+Bundle-Vendor: JBoss by Red Hat
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
+ org.junit;bundle-version="[4.8.0,5.0.0)",
+ org.jboss.ide.eclipse.as.openshift.core;bundle-version="[1.0.0,2.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/build.properties
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/build.properties (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/build.properties 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.Status;
+import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationIntegrationTest {
+
+ private IOpenshiftService openshiftService;
+ private IOpenshiftService invalidCredentialsOpenshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ this.invalidCredentialsOpenshiftService = new OpenshiftService(USERNAME, "bogus");
+ }
+
+ @Ignore
+ @Test(expected = InvalidCredentialsOpenshiftException.class)
+ public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
+ invalidCredentialsOpenshiftService.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7);
+ }
+
+ @Ignore
+ @Test
+ public void canCreateApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ Cartridge cartridge = Cartridge.JBOSSAS_7;
+ Application application = openshiftService.createApplication(applicationName, cartridge);
+ assertNotNull(application);
+ assertEquals(applicationName, application.getName());
+ assertEquals(cartridge, application.getCartridge());
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canDestroyApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.destroyApplication(applicationName, Cartridge.JBOSSAS_7);
+ }
+
+ @Ignore
+ @Test(expected = OpenshiftException.class)
+ public void createDuplicateApplicationThrowsException() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStopApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStartStoppedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStartStartedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canStopStoppedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void canRestartApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express/doc/API
+ */
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.restartApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Test
+ public void canGetStatus() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ Application application = openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ Status status = openshiftService.getStatus(application);
+ assertNotNull(status);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ private String createRandomApplicationName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ private void silentlyDestroyApplication(String name, IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, Cartridge.JBOSSAS_7);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallApplicationCreateRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22configure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canMarshallApplicationDestroyRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22deconfigure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgeAsserts.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+
+public class CartridgeAsserts {
+
+ public static void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
+ boolean found = false;
+ for (Cartridge cartridge : cartridges) {
+ if (cartridgeName.equals(cartridge.getName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
+ }
+ }
+
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/CartridgesIntegrationTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,33 @@
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Ignore
+ @Test
+ public void canRequestListCartridges() throws Exception {
+ List<Cartridge> cartridges = openshiftService.getCartridges();
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DomainIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Test
+ public void canCreateDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.createDomain(domainName, sshKey);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getName());
+ assertNotNull(domain.getUser());
+ User user = domain.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getUuid());
+ }
+
+ @Test
+ public void canChangeDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.changeDomain(domainName, sshKey);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getName());
+ assertNotNull(domain.getUser());
+ User user = domain.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getUuid());
+ }
+
+ private String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ChangeDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.DomainResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+ private static final String UUID = "0c82860dae904a4d87f8e5d87a5af840";
+
+ @Test
+ public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", false,
+ sshKey.getPublicKeyContent());
+
+ CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ @Test
+ public void canUnmarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ String domainName = "myDomain";
+ String responseString = createDomainResponseString(USERNAME, UUID);
+
+ responseString = JsonSanitizer.sanitize(responseString);
+ OpenshiftResponse<Domain> response = new DomainResponseUnmarshaller(domainName).unmarshall(responseString);
+
+ assertNotNull(response);
+ Domain domain = response.getData();
+ assertEquals(domainName, domain.getName());
+ User user = domain.getUser();
+ assertNotNull(user);
+ assertEquals(USERNAME, user.getRhlogin());
+ assertEquals(UUID, user.getUuid());
+ }
+
+ @Test
+ public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", true,
+ sshKey.getPublicKeyContent());
+
+ ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ private String createDomainRequestString(String password, String username, boolean debug, String namespace,
+ boolean alter, String sshPublicKey) throws UnsupportedEncodingException {
+ return "password="
+ + password
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22"
+ + URLEncoder.encode(username, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22" + String.valueOf(debug) + "%22"
+ + "%2C+%22namespace%22+%3A+%22" + URLEncoder.encode(namespace, "UTF-8") + "%22"
+ + "%2C+%22alter%22+%3A+%22" + String.valueOf(alter) + "%22"
+ + "%2C+%22ssh%22+%3A+%22"
+ + URLEncoder.encode(sshPublicKey, "UTF-8")
+ + "%22"
+ + "%7D";
+ }
+
+ /**
+ * WARNING: the response this method returns matches the actual response
+ * from the openshift service (9-12-2011). It is not valid json since it quotes the
+ * nested json object
+ * <p>
+ * "data": "{\"rhlogin\": ...
+ */
+ private String createDomainResponseString(String username, String uuid) {
+ return "{\"messages\":\"\",\"debug\":\"\",\"data\":\""
+ + "{\\\"rhlogin\\\":\\\""
+ + username
+ + "\\\",\\\"uuid\\\":\\\""
+ + uuid
+ + "\\\"}"
+ + "\",\"api\":\"1.1.1\",\"api_c\":[\"placeholder\"],\"result\":null,\"broker\":\"1.1.1\",\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],\"exit_code\":0}";
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesIntegrationTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.jboss.ide.eclipse.as.openshift.internal.test.core.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Test
+ public void canListCartridges() throws Exception {
+ List<Cartridge> cartridges = openshiftService.getCartridges();
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.jboss.ide.eclipse.as.openshift.internal.test.core.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallListCartridgesRequest() throws Exception {
+ String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
+
+ String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
+ new ListCartridgesRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, listCartridgeRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
+ String cartridgeListResponse =
+ "{"
+ + "\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":"
+ + "\"{\\\"carts\\\":[\\\"perl-5.10\\\",\\\"jbossas-7.0\\\",\\\"wsgi-3.2\\\",\\\"rack-1.1\\\",\\\"php-5.3\\\"]}\","
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":null,"
+ + "\"broker\":\"1.1.1\","
+ + "\"broker_c\":["
+ + "\"namespace\","
+ + "\"rhlogin\","
+ + "\"ssh\","
+ + "\"app_uuid\","
+ + "\"debug\","
+ + "\"alter\","
+ + "\"cartridge\","
+ + "\"cart_type\","
+ + "\"action\","
+ + "\"app_name\","
+ + "\"api"
+ + "\"],"
+ + "\"exit_code\":0}";
+
+ cartridgeListResponse = JsonSanitizer.sanitize(cartridgeListResponse);
+ OpenshiftResponse<List<Cartridge>> response =
+ new ListCartridgesResponseUnmarshaller().unmarshall(cartridgeListResponse);
+ assertEquals("", response.getMessages());
+ assertEquals(false, response.isDebug());
+
+ List<Cartridge> cartridges = response.getData();
+ assertEquals(5, cartridges.size());
+ assertThatContainsCartridge("perl-5.10", cartridges);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ assertThatContainsCartridge("wsgi-3.2", cartridges);
+ assertThatContainsCartridge("rack-1.1", cartridges);
+ assertThatContainsCartridge("php-5.3", cartridges);
+ assertEquals(null, response.getResult());
+ assertEquals(0, response.getExitCode());
+ }
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftIntegrationTestSuite.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationIntegrationTest.class,
+ CartridgesIntegrationTest.class,
+ DomainIntegrationTest.class,
+ ListCartridgesIntegrationTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftIntegrationTestSuite {
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationTest.class,
+ ListCartridgesTest.class,
+ DomainTest.class,
+ UserInfoTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftTestSuite {
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/SSHKeyTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.junit.Test;
+
+public class SSHKeyTest {
+
+ private static final String PASSPHRASE = "12345";
+
+ @Test
+ public void canCreatePublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKey sshKey = SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKeyContent();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ @Test
+ public void canLoadPublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+
+ SSHKey sshKey = SSHKey.load(privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKeyContent();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ private File createTempFile() throws IOException {
+ return File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallUserInfoRequest() throws Exception {
+ String expectedRequestString =
+ "password=" + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22%2C+"
+ + "%22debug%22+%3A+%22true%22"
+ + "%7D";
+
+ String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new UserInfoRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, userInfoRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class TestSSHKey {
+
+ private static final String privateKey =
+ "-----BEGIN RSA PRIVATE KEY-----\n" +
+ "Proc-Type: 4,ENCRYPTED\n" +
+ "DEK-Info: DES-EDE3-CBC,30E8B3A668E44D77\n" +
+ "\n" +
+ "wsXCU31SUTYhjPnOiW56UlZ7VXKlIjItLo5Wrk5LwCLv/OERK7UWJkrwM2bHPb6n\n" +
+ "3zAaDDZfQe786URQjfmUYWBdVeI7DrRMwoLaaUcR1tuJtMu3Jv3CK72YMkOzGapZ\n" +
+ "ZAAoTno/GRhTwptXG1KPSqKyzfqlxjbZry1HZmY+P6ikw9DWOPZC6rISIqQ3u9zm\n" +
+ "iPvi/Oo7JWZtX1d1MYp3vVt2bo2duD4RSoXWWaW471WUOIQZUh0V4dxp+eAHZziu\n" +
+ "osAfU4WoIrrSCSVl2uiKS2Zijn77PvcCXnm45eMQpww32AlslzIBNsMzUXhPtVAZ\n" +
+ "a9uvfZxlOIRu4ObN7AB3WExucbBHCvTOgxpSs95br1QtfMVl62d9VkIAXg1x9gH8\n" +
+ "kjcEP+0OS3EItYTFj1tCKC8GgBImj44AxbPSWu3SfTnYfAtFnO0pUqhPOBN63DCC\n" +
+ "XxzMm13UeER7Z3s968Swa48r6LRAbHI8JD0Ld4E02fgBYM/N/aGtPppD0FoJJwo3\n" +
+ "QVafS2PY+bALgy4qrI9daOo1mTS3gWDSAG0QbLoKd3hD8ZnLEk6rfR/0SE34Fc7j\n" +
+ "mviCy78C16hkllhWz27ROl5pheHV0Xt6ZlUsNWVz7tg/AcIFB0geMuzuM0Kd7ufj\n" +
+ "g5c8mhlI06n4vzo0uB6UXtwTBzNqyUl8yxA31S2VJfBZxkEwKc5cktNUiejQuWbU\n" +
+ "iwapdiSR0gNGyYBNMYax9OOfYH+BBQeD5kboVU3yvT7UNcz0T9GZiEhfvcaYSP8C\n" +
+ "ejQ1vuTNTKMrgyLpNi/4Sq8lm8OukRqQyE0EKYCwvkI=\n" +
+ "-----END RSA PRIVATE KEY-----";
+
+ private static final String publicKey =
+ "ssh-rsa "
+ +
+ "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5Z" +
+ "wktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG" +
+ "1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw" +
+ "== created by org.jboss.ide.eclipse.as.openshift.core";
+
+ public static SSHKey create() throws IOException, OpenshiftException {
+ File privateKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(privateKey, privateKeyFile);
+
+ File publicKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(publicKey, publicKeyFile);
+
+ return SSHKey.load(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
+ }
+
+ private static String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java 2011-09-13 11:53:25 UTC (rev 34670)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.internal.test.core.utils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+
+public class StreamUtils {
+
+ public static void writeTo(String data, String path) throws IOException {
+ writeTo(data, new File(path));
+ }
+
+ public static void writeTo(String data, File file) throws IOException {
+ StringReader reader = null;
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(file);
+ reader = new StringReader(data);
+ for (int character = -1; (character = reader.read()) != -1;) {
+ writer.write(character);
+ }
+ } finally {
+ if (writer != null) {
+ writer.flush();
+ writer.close();
+ }
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/.classpath
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/.classpath 2011-09-13 11:51:57 UTC (rev 34669)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/.classpath 2011-09-13 11:53:25 UTC (rev 34670)
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
14 years, 7 months
JBoss Tools SVN: r34669 - trunk/as/plugins.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 07:51:57 -0400 (Tue, 13 Sep 2011)
New Revision: 34669
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/
Log:
[JBIDE-9510] moving test plugin to tests
14 years, 7 months
JBoss Tools SVN: r34668 - in trunk/as/plugins: org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-13 07:45:38 -0400 (Tue, 13 Sep 2011)
New Revision: 34668
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ApplicationRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/DomainRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ListCartridgesRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/UserInfoRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
Log:
[JBIDE-9510] corrected package structure
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-13 11:45:38 UTC (rev 34668)
@@ -13,7 +13,7 @@
.
Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core,
- org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.internal.core;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.internal.core.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.internal.core.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -25,13 +25,13 @@
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.Status;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.HttpClientException;
import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.UnauthorizedException;
import org.jboss.ide.eclipse.as.openshift.internal.core.httpclient.UrlConnectionHttpClient;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.UserInfoRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.AbstractDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractOpenshiftMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/AbstractOpenshiftMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -1,4 +1,4 @@
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
public abstract class AbstractOpenshiftMarshaller<REQUEST extends IOpenshiftRequest> implements IOpenshiftMarshaller<REQUEST> {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ApplicationRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/DomainRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/DomainRequestJsonMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/DomainRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/IOpenshiftRequest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/IOpenshiftRequest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ListCartridgesRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/UserInfoRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/UserInfoRequestJsonMarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/marshalling/UserInfoRequestJsonMarshaller.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
+package org.jboss.ide.eclipse.as.openshift.internal.core.marshalling;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractOpenshiftRequest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -13,7 +13,7 @@
import java.net.MalformedURLException;
import java.net.URL;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.IOpenshiftRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.IOpenshiftRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.utils.UrlBuilder;
/**
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -15,7 +15,7 @@
import java.net.URLEncoder;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ApplicationRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -21,7 +21,7 @@
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.DomainRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -18,7 +18,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.ListCartridgesRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
import org.jboss.ide.eclipse.as.openshift.internal.core.response.JsonSanitizer;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 11:09:13 UTC (rev 34667)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-13 11:45:38 UTC (rev 34668)
@@ -14,7 +14,7 @@
import java.net.URLEncoder;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.marshalling.UserInfoRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
import org.junit.Test;
14 years, 7 months