JBoss Tools SVN: r15689 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-06-03 13:54:47 -0400 (Wed, 03 Jun 2009)
New Revision: 15689
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/HqlTask.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java
Log:
- custom task fix
- namespace fix
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-06-03 17:51:45 UTC (rev 15688)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-06-03 17:54:47 UTC (rev 15689)
@@ -686,6 +686,7 @@
else if ("esb".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.serviceTask";
else if ("mail".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.mailTask";
else if ("task".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.humanTask";
+ else if ("custom".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.customTask";
else if ("sub-process".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.subprocessTask";
else if ("decision".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.exclusiveGateway";
else if ("join".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.parallelJoinGateway";
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-06-03 17:51:45 UTC (rev 15688)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-06-03 17:54:47 UTC (rev 15689)
@@ -200,7 +200,7 @@
else if ("org.jboss.tools.flow.jpdl4.serviceTask".equals(elementId)) return "esb";
else if ("org.jboss.tools.flow.jpdl4.humanTask".equals(elementId)) return "task";
else if ("org.jboss.tools.flow.jpdl4.subprocessTask".equals(elementId)) return "sub-process";
- else if ("org.jboss.tools.flow.jpdl4.customTask".equals(elementId)) return "node";
+ else if ("org.jboss.tools.flow.jpdl4.customTask".equals(elementId)) return "custom";
else if ("org.jboss.tools.flow.jpdl4.exclusiveGateway".equals(elementId)) return "decision";
else if ("org.jboss.tools.flow.jpdl4.parallelJoinGateway".equals(elementId)) return "join";
else if ("org.jboss.tools.flow.jpdl4.parallelForkGateway".equals(elementId)) return "fork";
@@ -942,7 +942,7 @@
} else if (element instanceof SubprocessTask) {
buffer.append("</sub-process>");
} else if (element instanceof CustomTask) {
- buffer.append("</node>");
+ buffer.append("</custom>");
} else if (element instanceof ExclusiveGateway) {
buffer.append("</decision>");
} else if (element instanceof ForkParallelGateway) {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/HqlTask.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/HqlTask.java 2009-06-03 17:51:45 UTC (rev 15688)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/HqlTask.java 2009-06-03 17:54:47 UTC (rev 15689)
@@ -1,8 +1,21 @@
package org.jboss.tools.flow.jpdl4.model;
+import java.util.ArrayList;
+import java.util.List;
+
public class HqlTask extends Task {
+ public static final String VAR = "org.jboss.tools.flow.jpdl4.model.hqlTask.var";
+ public static final String UNIQUE = "org.jboss.tools.flow.jpdl4.model.hqlTask.unique";
+ public static final String QUERY = "org.jboss.tools.flow.jpdl4.model.hqlTask.query";
+ public static final String ARGS = "org.jboss.tools.flow.jpdl4.model.hqlTask.args";
+
+ private String variableName;
+ private String unique;
+ private String query;
+ private List<Field> fields = new ArrayList<Field>();
+
protected boolean isPropagationExclusive() {
return true;
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java 2009-06-03 17:51:45 UTC (rev 15688)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java 2009-06-03 17:54:47 UTC (rev 15689)
@@ -23,7 +23,7 @@
private String getInitialContentsAsString() {
StringBuffer buffer = new StringBuffer();
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n");
- buffer.append("<process xmlns=\"http://jbpm.org/4/jpdl\" name=\"");
+ buffer.append("<process xmlns=\"http://jbpm.org/4.0/jpdl\" name=\"");
buffer.append(getFileName().substring(0, getFileName().lastIndexOf(getFileExtension()) - 1));
buffer.append("\">\n</process>");
return buffer.toString();
15 years, 9 months
JBoss Tools SVN: r15688 - in trunk/documentation/whatsnew: jst/images and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-03 13:51:45 -0400 (Wed, 03 Jun 2009)
New Revision: 15688
Added:
trunk/documentation/whatsnew/jst/images/
trunk/documentation/whatsnew/jst/images/facesconfigca.png
trunk/documentation/whatsnew/jst/jst-news-3.1.0.M1.html
Modified:
trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
Log:
New and noteworthy for JSF 3.1.0.M1
Added: trunk/documentation/whatsnew/jst/images/facesconfigca.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/jst/images/facesconfigca.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/jst/jst-news-3.1.0.M1.html
===================================================================
--- trunk/documentation/whatsnew/jst/jst-news-3.1.0.M1.html (rev 0)
+++ trunk/documentation/whatsnew/jst/jst-news-3.1.0.M1.html 2009-06-03 17:51:45 UTC (rev 15688)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css"/>
+<title>JST/JSF 3.1.0.M1 What's New</title>
+</head>
+<body>
+<h1>JST/JSF 3.1.0.M1 What's New</h1>
+
+<p align="right"><a href="../index.html">< Main Index</a></p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>faces-config.xml Editor</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>openOn</b></p></td>
+ <td valign="top"><p>EL Resolver can now be navigated to via OpenOn's from faces-config.xml.</p>
+ <p><img src="images/facesconfigca.png"/></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3900">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
Property changes on: trunk/documentation/whatsnew/jst/jst-news-3.1.0.M1.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
===================================================================
--- trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html 2009-06-03 17:32:58 UTC (rev 15687)
+++ trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html 2009-06-03 17:51:45 UTC (rev 15688)
@@ -11,7 +11,7 @@
<body>
<h1>Seam tools 3.1.0.M1 What's New</h1>
-<p align="right"><a href="../index.html">< Main Index</a></p>
+<p align="right"><a href="../index.html">< Main Index</a> <a href="../jst/jst-news-3.1.0.M1.html">JST/JSF Tools News ></a></p>
<table border="0" cellpadding="10" cellspacing="0" width="80%">
<tr>
@@ -38,7 +38,7 @@
<tr>
<td valign="top" align="left">
<p><b>JBPM OpenOn</b></p></td>
- <td valign="top"><p>BPM process and pageflow definitions can now be navigate to directly via OpenOn's from source tab of components.xml editor.</p>
+ <td valign="top"><p>BPM process and pageflow definitions can now be navigated to directly via OpenOn's from source tab of components.xml editor.</p>
<p><img src="images/bpmopenons.png"/></p>
<p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4002">Related Jira</a></small></p>
</td>
@@ -50,7 +50,7 @@
<tr>
<td valign="top" align="left"><a name="itemnam2e" id="itemname2"></a><b>Drools OpenOn</b></td>
<td width="70%" valign="top">
- <p>Drools rule files can now be navigate to directly via OpenOn's from source tab of components.xml editor.</p>
+ <p>Drools rule files can now be navigated to directly via OpenOn's from source tab of components.xml editor.</p>
<p><img src="images/droolsopenons.png"/></p>
<p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3901">Related Jira</a></small></p>
</td>
@@ -80,7 +80,7 @@
<tr>
<td valign="top" align="left">
<p><b>OpenOn</b></p></td>
- <td valign="top"><p>Image file can now be navigate to directly via OpenOn's from <s:graphicImage@value>.</p>
+ <td valign="top"><p>Image file can now be navigated to directly via OpenOn's from <s:graphicImage@value>.</p>
<p>Also OpenOn works for template attribute of <s:decorate>.</p>
<p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4019">Related Jira</a></small></p>
</td>
15 years, 9 months
JBoss Tools SVN: r15687 - in trunk/documentation/whatsnew: seam/images and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-03 13:32:58 -0400 (Wed, 03 Jun 2009)
New Revision: 15687
Added:
trunk/documentation/whatsnew/seam/images/decorateca.png
trunk/documentation/whatsnew/vpe/images/jsfcca.png
Modified:
trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
trunk/documentation/whatsnew/vpe/vpe-news-3.1.0.M1.html
Log:
New and noteworthy for Seam/VPE 3.1.0.M1
Added: trunk/documentation/whatsnew/seam/images/decorateca.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/decorateca.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
===================================================================
--- trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html 2009-06-03 16:43:27 UTC (rev 15686)
+++ trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html 2009-06-03 17:32:58 UTC (rev 15687)
@@ -11,7 +11,7 @@
<body>
<h1>Seam tools 3.1.0.M1 What's New</h1>
-<p align="right"><a href="../index.html">< Main Index</a> <a href="../jst/jst-news-3.1.0.M1.html">JST/JSF Tools News ></a></p>
+<p align="right"><a href="../index.html">< Main Index</a></p>
<table border="0" cellpadding="10" cellspacing="0" width="80%">
<tr>
@@ -71,9 +71,36 @@
</td>
</tr>
<tr>
+ <td colspan="2">
+ <hr/>
+ <h3>Visual Editor</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>OpenOn</b></p></td>
+ <td valign="top"><p>Image file can now be navigate to directly via OpenOn's from <s:graphicImage@value>.</p>
+ <p>Also OpenOn works for template attribute of <s:decorate>.</p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4019">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
<td colspan="2"><hr />
</td>
</tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>Code Assist</b></p></td>
+ <td valign="top"><p>Code assist works now for template attribute of <s:decorate>.</p>
+ <p><img src="images/decorateca.png"/></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4021">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
</table>
Added: trunk/documentation/whatsnew/vpe/images/jsfcca.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/vpe/images/jsfcca.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/whatsnew/vpe/vpe-news-3.1.0.M1.html
===================================================================
--- trunk/documentation/whatsnew/vpe/vpe-news-3.1.0.M1.html 2009-06-03 16:43:27 UTC (rev 15686)
+++ trunk/documentation/whatsnew/vpe/vpe-news-3.1.0.M1.html 2009-06-03 17:32:58 UTC (rev 15687)
@@ -92,9 +92,20 @@
<tr>
<td colspan="2">
<hr />
+ <h3>Source editor</h3>
+ <hr />
</td>
</tr>
+ <tr>
+ <td valign="top" align="left"><a name="itemname3" id="itemname3"></a><b>OpenOn for Richfaces</b></td>
+ <td valign="top">
+ <p>OpenOn works for HTML tags which has 'jsfc' attribute as if this tag was correspondent JSF tag.</p>
+ <p><img src="images/jsfcca.png" alt="Vpe Vertilal split" /></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-1739">Related Jira</a></small></p>
+ </td>
+ </tr>
+
</table>
</body>
15 years, 9 months
JBoss Tools SVN: r15686 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-06-03 12:43:27 -0400 (Wed, 03 Jun 2009)
New Revision: 15686
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-2808: Improve/refactor org.jboss.tools.common.kb plugin.
The skeleton to prompt for the tag attribute names is added
The skeleton to prompt for the tag attribute values is added
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-06-03 16:33:44 UTC (rev 15685)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-06-03 16:43:27 UTC (rev 15686)
@@ -144,18 +144,19 @@
- /*
+ /**
* Calculates and adds the attribute name proposals to the Content Assist Request object
*/
protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
System.out.println("AbstractXMLContentAssistProcessor: addAttributeNameProposals() invoked");
}
- /*
+ /**
* Calculates and adds the attribute value proposals to the Content Assist Request object
*/
protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
-
+ System.out.println("AbstractXMLContentAssistProcessor: addAttributeValueProposals() invoked");
+/*
IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
// Find the attribute region and name for which this position should
@@ -203,6 +204,7 @@
else {
setErrorMessage(UNKNOWN_CONTEXT);
}
+ */
}
/*
@@ -320,10 +322,6 @@
* @return
*/
- void a() {}
- ///
-
-
/**
* Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
*
@@ -450,28 +448,6 @@
}
/**
- * For internal use only!
- * Returns the parent Element for the Attribute or TEXT nodes
- *
- * @param xmlDocument
- * @return
- */
- protected Node _getParentElement(Document xmlDocument) {
- Node n = findNodeForOffset(xmlDocument, getOffset());
- if (n == null)
- return null;
-
- if (n instanceof Element)
- return n;
-
- if (n instanceof Attr) {
- return ((Attr) n).getOwnerElement();
- } else {
- return n.getParentNode();
- }
- }
-
- /**
* Returns name of the parent attribute/tag name
*
* @return
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-06-03 16:33:44 UTC (rev 15685)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-06-03 16:43:27 UTC (rev 15686)
@@ -39,11 +39,14 @@
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
import org.jboss.tools.jst.web.kb.taglib.TagLibriryManager;
+import org.w3c.dom.Attr;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
public class JspContentAssistProcessor extends XmlContentAssistProcessor {
- /*
+ /**
* (non-Javadoc)
* @see org.jboss.tools.jst.jsp.contentassist.XmlContentAssistProcessor#createContext()
*/
@@ -65,6 +68,11 @@
return context;
}
+ /**
+ * Collects the namespaces over the JSP-page and sets them up to the context specified.
+ *
+ * @param context
+ */
protected void setNameSpaces(JspContextImpl context) {
IStructuredModel sModel = StructuredModelManager
.getModelManager()
@@ -114,9 +122,14 @@
}
private static final ITagLibrary[] EMPTY_LIBRARIES = new ITagLibrary[0];
+
/**
- */
-
+ * Returns the Tag Libraries for the namespaces collected in the context.
+ * Important: The context must be created using createContext() method before using this method.
+ *
+ * @param context The context object instance
+ * @return
+ */
protected ITagLibrary[] getTagLibraries(IPageContext context) {
Map<String, INameSpace> nameSpaces = context.getNameSpaces(getOffset());
if (nameSpaces == null || nameSpaces.isEmpty())
@@ -135,60 +148,233 @@
(ITagLibrary[])tagLibraries.toArray(new ITagLibrary[tagLibraries.size()]));
}
+ /**
+ * Returns the resource bundles
+ *
+ * @return
+ */
protected IResourceBundle[] getResourceBundles() {
// TODO
return null;
}
+ /**
+ * Returns the <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
+ *
+ * @return
+ */
@Override
protected IPageContext getContext() {
return (IPageContext)super.getContext();
}
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ * Important: The context must be created using createContext() method before using this method.
+ *
+ * @param prefix
+ * @return
+ */
@Override
+ protected String getUri(String prefix) {
+ if (prefix == null || prefix.length() == 0)
+ return null;
+
+ Map<String, INameSpace> nameSpaces = getContext().getNameSpaces(getOffset());
+ if (nameSpaces == null || nameSpaces.isEmpty())
+ return null;
+
+ for (INameSpace nameSpace : nameSpaces.values()) {
+ if (prefix.equals(nameSpace.getPrefix())) {
+ return nameSpace.getURI();
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Checks if the specified attribute exists
+ *
+ * @param attrName Name of attribute to check
+ */
+ private boolean isExistingAttribute(String attrName) {
+ IStructuredModel sModel = StructuredModelManager.getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return false;
+
+ Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
+ .getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return false;
+
+ Node n = findNodeForOffset(xmlDocument, getOffset());
+ if (n == null)
+ return false;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ return false;
+ }
+ }
+
+ if (n == null)
+ return false;
+
+ return (((Element)n).getAttribute(attrName) != null);
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+
+ }
+
+ /**
+ * Calculates and adds the attribute name proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ @Override
protected void addTagNameProposals(
ContentAssistRequest contentAssistRequest, int childPosition) {
// TODO Auto-generated method stub
System.out.println("JspContentAssistProcessor: addTagNameProposals() invoked");
- String matchString = contentAssistRequest.getMatchString();
- String query = matchString;
- if (query == null)
- query = "";
- if (query.indexOf(KbQuery.PREFIX_SEPARATOR) > -1) {
- query = matchString.substring(query.indexOf(KbQuery.PREFIX_SEPARATOR) + 1);
+ try {
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = "";
+ String stringQuery = "<" + matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+
+ System.out.println("Tag Name proposal [" + (i + 1) + "/" + proposals.length + "]: " + textProposal.getReplacementString());
+
+ String replacementString = textProposal.getReplacementString() + ">";
+ if (!replacementString.endsWith("/>")) {
+ replacementString += "</" + textProposal.getLabel() + ">";
+ }
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ String displayString = textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance() + 10000;
+
+
+ CustomCompletionProposal proposal = new CustomCompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
+ contentAssistRequest.addProposal(proposal);
+ }
+ } finally {
+ System.out.println("JspContentAssistProcessor: addTagNameProposals() exited");
}
- String stringQuery = "<" + matchString;
+ return;
+ }
+
+ /**
+ * Calculates and adds the attribute name proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+ protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("JspContentAssistProcessor: addAttributeNameProposals() invoked");
+ try {
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = "";
+ String stringQuery = matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_NAME, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
- KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
-
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
- System.out.println("Tag Name proposal [" + (i + 1) + "/" + proposals.length + "]: " + textProposal.getReplacementString());
+ System.out.println("Tag Attribute proposal [" + (i + 1) + "/" + proposals.length + "]: " + textProposal.getReplacementString());
+
+ if (isExistingAttribute(textProposal.getLabel()))
+ continue;
+
+ String replacementString = textProposal.getReplacementString() + "=\"\"";
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ String displayString = textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance() + 10000;
+
+
+ CustomCompletionProposal proposal = new CustomCompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
+ contentAssistRequest.addProposal(proposal);
+ }
+ } finally {
+ System.out.println("JspContentAssistProcessor: addAttributeNameProposals() exited");
+ }
+ }
+
+ /**
+ * Calculates and adds the attribute value proposals to the Content Assist Request object
+ */
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("JspContentAssistProcessor: addAttributeValueProposals() invoked");
+ try {
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = "";
+ String stringQuery = matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
- String replacementString = textProposal.getReplacementString() + ">";
-
- int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPosition = getCursorPositionForProposedText(replacementString);
- Image image = textProposal.getImage();
- String displayString = textProposal.getLabel();
- IContextInformation contextInformation = null;
- String additionalProposalInfo = textProposal.getContextInfo();
- int relevance = textProposal.getRelevance() + 10000;
-
-
-// cursorAdjustment = proposedText.length() +
- // 1;
- // proposedText += "></" +
- // getRequiredName(parent, elementDecl) + ">";
- // //$NON-NLS-2$//$NON-NLS-1$
-
-
- CustomCompletionProposal proposal = new CustomCompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
- contentAssistRequest.addProposal(proposal);
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+
+ System.out.println("Tag Attribute Value proposal [" + (i + 1) + "/" + proposals.length + "]: " + textProposal.getReplacementString());
+
+ if (isExistingAttribute(textProposal.getLabel()))
+ continue;
+
+ String replacementString = textProposal.getReplacementString() + "=\"\"";
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ String displayString = textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance() + 10000;
+
+
+ CustomCompletionProposal proposal = new CustomCompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
+ contentAssistRequest.addProposal(proposal);
+ }
+ } finally {
+ System.out.println("JspContentAssistProcessor: addAttributeValueProposals() exited");
}
- return;
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-06-03 16:33:44 UTC (rev 15685)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-06-03 16:43:27 UTC (rev 15686)
@@ -16,8 +16,10 @@
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.jst.web.kb.IFaceletPageContext;
+import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
public class XmlContentAssistProcessor extends AbstractXMLContentAssistProcessor {
@@ -66,7 +68,12 @@
return kbQuery;
}
- @Override
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ *
+ * @Override org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#getUri(String)
+ */
protected String getUri(String prefix) {
return null;
}
15 years, 9 months
JBoss Tools SVN: r15685 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-06-03 12:33:44 -0400 (Wed, 03 Jun 2009)
New Revision: 15685
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
Log:
JBIDE-2808: Improve/refactor org.jboss.tools.common.kb plugin.
getProposals() method is fixed: Another NullPointerException is fixed.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-06-03 16:24:06 UTC (rev 15684)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-06-03 16:33:44 UTC (rev 15685)
@@ -264,6 +264,8 @@
}
} else {
for (int i = 0; i < components.length; i++) {
+ if (components[i] == null)
+ continue;
TextProposal[] componentProposals = components[i].getProposals(query, context);
for (int j = 0; j < componentProposals.length; j++) {
proposals.add(componentProposals[j]);
15 years, 9 months
JBoss Tools SVN: r15684 - trunk/jbpm/docs/converter_ref/en/modules.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2009-06-03 12:24:06 -0400 (Wed, 03 Jun 2009)
New Revision: 15684
Modified:
trunk/jbpm/docs/converter_ref/en/modules/overview.xml
Log:
Jbds-153 - Key Features chapter created.
Modified: trunk/jbpm/docs/converter_ref/en/modules/overview.xml
===================================================================
--- trunk/jbpm/docs/converter_ref/en/modules/overview.xml 2009-06-03 16:18:51 UTC (rev 15683)
+++ trunk/jbpm/docs/converter_ref/en/modules/overview.xml 2009-06-03 16:24:06 UTC (rev 15684)
@@ -1,9 +1,52 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<chapter id="overview">
<title>BPMN Convert Overview</title>
- <para>This chapter gives you a short overview of JBoss BPMN Convert module</para>
- <para>JBoss BPMN Convert module is a tool used for a BPMN file translation</para>
+ <para>This chapter gives you a short overview of JBoss BPMN Convert module.</para>
+ <para>JBoss BPMN Convert module is a tool used for a BPMN file translation.</para>
<para>As a part of JBoss tools, JBoss BPMN Convert module implements BPMN -> JPDL translation. You can get a basic JPDL file from a BPMN file by using this module.</para>
<para>The BPMN file may be written by hands or with the help of some editors. In this guide, we use STP BPMN editor to draw a BPMN file.</para>
- <para>You can download the editor which is included into BPMN Modeler from Eclipse download or update site. On the <ulink url="http://www.eclipse.org/bpmn">Eclipse BPMN project page</ulink> you can find the necessary links and other related information</para>
- </chapter>
\ No newline at end of file
+ <para>You can download the editor which is included into BPMN Modeler from Eclipse download or update site. On the <ulink url="http://www.eclipse.org/bpmn">Eclipse BPMN project page</ulink> you can find the necessary links and other related information.</para>
+
+<section>
+ <title>Key Features of JBoss BPMN Convert module</title>
+ <para>For a start, we propose you to look through the table of main features of JBoss BPMN Convert module:</para>
+
+ <table>
+
+ <title>Key Functionality of JBoss BPMN Convert module</title>
+ <tgroup cols="3">
+
+ <colspec colnum="1" align="left" colwidth="2*"/>
+ <colspec colnum="2" colwidth="4*"/>
+ <colspec colnum="3" align="left" colwidth="2*"/>
+
+ <thead>
+ <row>
+ <entry>Feature</entry>
+ <entry>Benefit</entry>
+ <entry>Chapter</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry><para>STP BPMN Editor</para></entry>
+ <entry><para>JBoss BPMN Convert module contains STP Business Process Modeling Notation (BPMN) Editor which is a tool to express any processes in a graphical form (simple diagrams with a set of some graphical elements). Created BPMN files can then be converted to jPDL.</para></entry>
+ <entry>
+ <link linkend="createbpmnfile">creating a BPMN file by STP BPMN editor</link>
+ </entry>
+ </row>
+
+
+ </tbody>
+
+ </tgroup>
+ </table>
+
+
+
+</section>
+
+
+</chapter>
\ No newline at end of file
15 years, 9 months
JBoss Tools SVN: r15683 - trunk/seam/docs/reference/en/images/create_new_seam.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-06-03 12:18:51 -0400 (Wed, 03 Jun 2009)
New Revision: 15683
Modified:
trunk/seam/docs/reference/en/images/create_new_seam/create_seam_5.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-751 -Some out-of-date screens of New server wizard were updated. </p>
</body></html>
Modified: trunk/seam/docs/reference/en/images/create_new_seam/create_seam_5.png
===================================================================
(Binary files differ)
15 years, 9 months
JBoss Tools SVN: r15682 - trunk/as/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-06-03 12:12:48 -0400 (Wed, 03 Jun 2009)
New Revision: 15682
Modified:
trunk/as/docs/reference/en/modules/runtimes_servers.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-751 -The possibility to restore the server name to a default value was described in the Doc - JBossAS.</p>
</body></html>
Modified: trunk/as/docs/reference/en/modules/runtimes_servers.xml
===================================================================
--- trunk/as/docs/reference/en/modules/runtimes_servers.xml 2009-06-03 15:35:39 UTC (rev 15681)
+++ trunk/as/docs/reference/en/modules/runtimes_servers.xml 2009-06-03 16:12:48 UTC (rev 15682)
@@ -287,7 +287,10 @@
or stopping, and runtimes keep track of the location of the installation. Thus, each server
instance must be backed by an appropriate runtime. </para>
- <para>From the list of already declared runtimes in the combo box below the view it's
+ <para> <emphasis><property> New server wizard </property></emphasis> allows to name the server appropriately in the <emphasis><property>Server name field </property></emphasis >or you can use a generated default name.If it's nessecary to restore the default name,after you defined yours, click the Reset default button(<inlinemediaobject> <imageobject>
+ <imagedata fileref="images/runtimes_servers/runtimes_servers_4d.png"/>
+ </imageobject></inlinemediaobject>).
+ From the list of already declared runtimes in the combo box below the view it's
possible to select which runtime you want your server to be backed by. If there is no
runtime that matches your needs just press the <emphasis>
<property>Add...</property>
@@ -313,7 +316,7 @@
associated runtime.</para>
<para>Either way, after targeting your server to a runtime, the final screen in this wizard is
largely confirmational, giving you a chance to verify that you've selected the
- appropriate runtime. It also allows to name the server appropriately. </para>
+ appropriate runtime. </para>
<figure>
<title>Installed Server Runtime Environments</title>
15 years, 9 months
JBoss Tools SVN: r15681 - in trunk/hibernatetools/tests: org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-06-03 11:35:39 -0400 (Wed, 03 Jun 2009)
New Revision: 15681
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4366 - code refactoring
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2009-06-03 15:35:39 UTC (rev 15681)
@@ -22,8 +22,8 @@
Bundle-Localization: plugin
Export-Package: org.hibernate.eclipse.console.test,
org.hibernate.eclipse.console.test.project,
+ org.hibernate.eclipse.console.test.project.xpl,
org.hibernate.eclipse.console.test.utils,
- org.hibernate.eclipse.console.test.xpl,
org.hibernate.eclipse.hqleditor.preferences,
org.jmock,
org.jmock.api,
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -3,7 +3,9 @@
import java.io.IOException;
import org.hibernate.eclipse.console.test.mappingproject.HibernateAllMappingTests;
+import org.hibernate.eclipse.console.views.test.QueryPageViewerTest;
import org.hibernate.eclipse.hqleditor.preferences.HQLEditorPreferencePageTest;
+import org.hibernate.eclipse.mapper.HBMInfoExtractorTest;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -23,6 +25,9 @@
suite.addTestSuite( HibernateAllMappingTests.class );
suite.addTestSuite(HQLEditorPreferencePageTest.class);
+
+ suite.addTestSuite(QueryPageViewerTest.class);
+ suite.addTestSuite(HBMInfoExtractorTest.class);
// core tests
//Properties properties = new Properties();
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -23,6 +23,7 @@
protected void tearDown() throws Exception {
}
+ @SuppressWarnings("unchecked")
public void testJavaFormatting() throws JavaModelException, MalformedTreeException, BadLocationException {
/*
IFile file = ResourcesPlugin
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -34,11 +34,6 @@
public static final boolean STOP_AFTER_MISSING_PACK = false;
/**
- * Shows each test run as individual
- */
- public static final boolean SHOW_EACH_TEST = true;
-
- /**
* Delay in milliseconds after each package
*/
public static final int EACTH_PACK_TEST_DELAY = 0;
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -41,13 +41,35 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HbmExportExceptionTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ protected ConfigurableTestProject testProject = null;
+
+ public HbmExportExceptionTest() {
+ }
+
+ public HbmExportExceptionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ testProject = null;
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testHbmExportExceptionTest() throws Exception {
- IPackageFragment pack = HibernateAllMappingTests.getActivePackage();
- try{
+ try {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG = knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
consCFG.build();
@@ -64,9 +86,9 @@
Configuration config = consCFG.getConfiguration();
//delete old hbm files
- assertNotNull( pack );
- if (pack.getNonJavaResources().length > 0){
- Object[] ress = pack.getNonJavaResources();
+ assertNotNull( testPackage );
+ if (testPackage.getNonJavaResources().length > 0){
+ Object[] ress = testPackage.getNonJavaResources();
for (int i = 0; i < ress.length; i++) {
if (ress[i] instanceof IFile){
IFile res = (IFile)ress[i];
@@ -90,9 +112,9 @@
collector.formatFiles();
try {//build generated configuration
- pack.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
- pack.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- ConsoleConfigUtils.customizeCfgXmlForPack(pack);
+ testPackage.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
+ testPackage.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ ConsoleConfigUtils.customizeCfgXmlForPack(testPackage);
assertNotNull(consCFG);
consCFG.reset();
@@ -110,22 +132,21 @@
config = consCFG.getConfiguration();
} catch (CoreException e) {
String out = NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
- new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, pack.getPath(), e.getMessage() } );
+ new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, testPackage.getPath(), e.getMessage() } );
fail(out);
}
} catch (ExporterException e){
throw (Exception)e.getCause();
}
} catch (Exception e){
- String newMessage = "\nPackage " + pack.getElementName() + ":";
+ String newMessage = "\nPackage " + testPackage.getElementName() + ":"; //$NON-NLS-1$ //$NON-NLS-2$
throw new WripperException(newMessage, e);
}
}
private File getSrcFolder() throws JavaModelException{
- ConfigurableTestProject mapProject = ConfigurableTestProject.getTestProject();
PackageFragmentRoot packageFragmentRoot = null;
- IPackageFragmentRoot[] roots = mapProject.getIJavaProject().getAllPackageFragmentRoots();
+ IPackageFragmentRoot[] roots = testProject.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length && packageFragmentRoot == null; i++) {
if (roots[i].getClass() == PackageFragmentRoot.class) {
packageFragmentRoot = (PackageFragmentRoot) roots[i];
@@ -134,10 +155,35 @@
assertNotNull(packageFragmentRoot);
return packageFragmentRoot.getResource().getLocation().toFile();
}
+
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
+
+ public ConfigurableTestProject getTestProject() {
+ return testProject;
+ }
+
+ public void setTestProject(ConfigurableTestProject testProject) {
+ this.testProject = testProject;
+ }
}
class WripperException extends Exception {
+ private static final long serialVersionUID = 8192540921613389467L;
private String message;
public WripperException(String message, Exception cause){
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import java.io.File;
import java.util.regex.Pattern;
import junit.framework.Test;
@@ -34,25 +35,33 @@
import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.FilesTransfer;
import org.hibernate.eclipse.console.utils.ProjectUtils;
+/**
+ *
+ */
+@SuppressWarnings("restriction")
public class HibernateAllMappingTests extends TestCase {
- private ConfigurableTestProject project;
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
- private static IPackageFragment activePackage;
+ protected ConfigurableTestProject testProject = null;
+ protected TestResult result = null;
+
public HibernateAllMappingTests(String name) {
super(name);
}
- private TestResult result = null;
-
protected void setUp() throws Exception {
super.setUp();
- this.project = ConfigurableTestProject.getTestProject();
+ testProject = new ConfigurableTestProject("JUnitTestProj"); //$NON-NLS-1$
+ consoleConfigName = testProject.getIProject().getName();
+ testPackage = null;
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.ui.resourcePerspective")); //$NON-NLS-1$
@@ -65,18 +74,18 @@
throw new RuntimeException(e);
}
- packageExplorer.selectAndReveal(project.getIJavaProject());
+ packageExplorer.selectAndReveal(testProject.getIJavaProject());
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
- IPath cfgFilePath = new Path(ConfigurableTestProject.PROJECT_NAME + "/" + //$NON-NLS-1$
- FilesTransfer.SRC_FOLDER + "/" + ConsoleConfigUtils.CFG_FILE_NAME); //$NON-NLS-1$
- ConsoleConfigUtils.createConsoleConfig(ConsoleConfigUtils.ConsoleCFGName,
- cfgFilePath, ConfigurableTestProject.PROJECT_NAME);
- ProjectUtils.toggleHibernateOnProject(project.getIProject(), true, ConsoleConfigUtils.ConsoleCFGName);
- project.getIProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPath cfgFilePath = new Path(testProject.getIProject().getName() + File.separator +
+ TestProject.SRC_FOLDER + File.separator + ConsoleConfigUtils.CFG_FILE_NAME);
+ ConsoleConfigUtils.createConsoleConfig(consoleConfigName,
+ cfgFilePath, testProject.getIProject().getName());
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), true, consoleConfigName);
+ testProject.getIProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
}
/* (non-Javadoc)
@@ -89,22 +98,19 @@
}
public void tearDown() throws Exception {
- ProjectUtils.toggleHibernateOnProject(project.getIProject(), false, ConsoleConfigUtils.ConsoleCFGName);
- ConsoleConfigUtils.deleteConsoleConfig(ConsoleConfigUtils.ConsoleCFGName);
- project.deleteIProject(false);
- project = null;
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), false, consoleConfigName);
+ ConsoleConfigUtils.deleteConsoleConfig(consoleConfigName);
+ testProject.deleteIProject(false);
+ testProject = null;
+ consoleConfigName = null;
+ testPackage = null;
super.tearDown();
}
- protected ConfigurableTestProject getProject() {
- return this.project;
- }
-
public void testEachPackWithTestSet() throws JavaModelException {
long start_time = System.currentTimeMillis();
- TestSuite suite = TestSet.getTests();
int pack_count = 0;
- IPackageFragmentRoot[] roots = project.getIJavaProject().getAllPackageFragmentRoots();
+ IPackageFragmentRoot[] roots = testProject.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getClass() != PackageFragmentRoot.class) {
continue;
@@ -116,9 +122,9 @@
if (!(javaElement instanceof IPackageFragment)) {
continue;
}
- IPackageFragment pack = (IPackageFragment)javaElement;
+ testPackage = (IPackageFragment)javaElement;
// use packages only with compilation units
- if (pack.getCompilationUnits().length == 0) {
+ if (testPackage.getCompilationUnits().length == 0) {
continue;
}
if (Customization.U_TEST_PACKS_PATTERN) {
@@ -131,13 +137,9 @@
int prev_failCount = result.failureCount();
int prev_errCount = result.errorCount();
- if (Customization.SHOW_EACH_TEST) {
- // this display result for each test in JUinit view
- suite = TestSet.getTests();
- }
+ TestSuite suite = TestSet.createTestSuite(consoleConfigName, testPackage, testProject);
- activePackage = pack;
- customizeCfgXml(pack);
+ customizeCfgXml(testPackage);
//==============================
//run all tests for package
//suite.run(result);
@@ -148,23 +150,25 @@
closeAllEditors();
//==============================
pack_count++;
- if (Customization.USE_CONSOLE_OUTPUT){
- System.out.print( result.errorCount() - prev_errCount + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
- System.out.print( result.failureCount() - prev_failCount + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ if (Customization.USE_CONSOLE_OUTPUT) {
+ System.out.print(result.errorCount() - prev_errCount + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print(result.failureCount() - prev_failCount + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
long period = System.currentTimeMillis() - st_pack_time;
String time = period / 1000 + "." + (period % 1000) / 100; //$NON-NLS-1$
System.out.println( time +ConsoleTestMessages.HibernateAllMappingTests_seconds +
" {" + javaElement.getElementName() + "}"); //$NON-NLS-1$//$NON-NLS-2$
}
- if (Customization.STOP_AFTER_MISSING_PACK){
- if (result.failureCount() > prev_failCount) break;
+ if (Customization.STOP_AFTER_MISSING_PACK) {
+ if (result.failureCount() > prev_failCount) {
+ break;
+ }
}
prev_failCount = result.failureCount();
prev_errCount = result.errorCount();
}
}
- if (Customization.USE_CONSOLE_OUTPUT){
+ if (Customization.USE_CONSOLE_OUTPUT) {
System.out.println( "====================================================="); //$NON-NLS-1$
System.out.print( result.errorCount() + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
System.out.print( result.failureCount() + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
@@ -187,11 +191,28 @@
protected void closeAllEditors() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
}
-
- /**
- * @return the activePackage
- */
- public static synchronized IPackageFragment getActivePackage() {
- return activePackage;
+
+ public String getConsoleConfigName() {
+ return consoleConfigName;
}
+
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
+
+ public ConfigurableTestProject getTestProject() {
+ return testProject;
+ }
+
+ public void setTestProject(ConfigurableTestProject testProject) {
+ this.testProject = testProject;
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -12,6 +12,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
@@ -20,8 +21,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.mapping.PersistentClass;
@@ -32,9 +32,29 @@
*
*/
public class OpenMappingDiagramTest extends TestCase {
+
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenMappingDiagramTest() {
+ }
+
+ public OpenMappingDiagramTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenMappingDiagram() {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG = knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -45,7 +65,7 @@
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out = NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
- new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
fail(out);
}
@@ -61,7 +81,7 @@
} catch (PartInitException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagram_for_not_opened,
new Object[]{persClass.getClassName(), ex.getMessage()});
@@ -72,5 +92,19 @@
//close all editors
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -14,6 +14,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
@@ -24,8 +25,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -39,9 +39,28 @@
*/
public class OpenMappingFileTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenMappingFileTest() {
+ }
+
+ public OpenMappingFileTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenMappingFileTest() {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG = knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -53,7 +72,7 @@
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
- new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
fail(out);
}
if (persClasses.length > 0){
@@ -82,10 +101,10 @@
Throwable ex = null;
try {
editor = OpenMappingAction.run(consCFG, compositeProperty, parentProperty);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_property_is_empty_package,
- new Object[]{compositeProperty.getNodeName(), HibernateAllMappingTests.getActivePackage().getElementName()});
+ new Object[]{compositeProperty.getNodeName(), testPackage.getElementName()});
fail(out);
}
Object[] compProperties = new PropertyWorkbenchAdapter().getChildren(compositeProperty);
@@ -102,10 +121,10 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_property_not_opened_package,
- new Object[]{compositeProperty.getNodeName(), HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{compositeProperty.getNodeName(), testPackage.getElementName(), ex.getMessage()});
fail(out);
}
}
@@ -115,10 +134,10 @@
Throwable ex = null;
try {
editor = OpenMappingAction.run(consCFG, selection);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_is_empty_package,
- new Object[]{selection, HibernateAllMappingTests.getActivePackage().getElementName()});
+ new Object[]{selection, testPackage.getElementName()});
fail(out);
}
} catch (PartInitException e) {
@@ -128,15 +147,27 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_not_opened_package,
- new Object[]{selection, HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{selection, testPackage.getElementName(), ex.getMessage()});
fail(out);
}
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -14,6 +14,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
@@ -24,8 +25,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenSourceAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -40,10 +40,29 @@
*/
public class OpenSourceFileTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenSourceFileTest() {
+ }
+
+ public OpenSourceFileTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenSourceFileTest() {
//fail("test fail");
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG = knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -53,12 +72,12 @@
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
assertTrue(configs[0] instanceof Configuration);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
- } catch (InvalidMappingException ex){
+ } catch (InvalidMappingException ex) {
String out = NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
- HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage());
+ testPackage.getElementName(), ex.getMessage());
fail(out);
}
- if (persClasses.length > 0){
+ if (persClasses.length > 0) {
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[0] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
@@ -67,7 +86,9 @@
openTest(persClass, consCFG, fullyQualifiedName);
fields = new PersistentClassWorkbenchAdapter().getChildren(persClass);
for (int j = 0; j < fields.length; j++) {
- if (fields[j].getClass() != Property.class) continue;
+ if (fields[j].getClass() != Property.class) {
+ continue;
+ }
fullyQualifiedName = persClass.getClassName();
// test Properties
openTest(fields[j], consCFG, fullyQualifiedName);
@@ -77,7 +98,9 @@
Object[] compProperties = new PropertyWorkbenchAdapter().getChildren(fields[j]);
for (int k = 0; k < compProperties.length; k++) {
- if (compProperties[k].getClass() != Property.class) continue;
+ if (compProperties[k].getClass() != Property.class) {
+ continue;
+ }
//test Composite properties
openTest(compProperties[k], consCFG, fullyQualifiedName);
}
@@ -94,7 +117,7 @@
Throwable ex = null;
try {
editor = OpenSourceAction.run(consCFG, selection, fullyQualifiedName);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out = NLS.bind(ConsoleTestMessages.OpenSourceFileTest_highlighted_region_for_is_empty, selection);
fail(out);
@@ -106,7 +129,7 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenSourceFileTest_mapping_file_for_not_opened,
fullyQualifiedName/*.getClassName()*/, ex.getMessage());
@@ -114,6 +137,19 @@
}
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import org.eclipse.jdt.core.IPackageFragment;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
import junit.framework.TestSuite;
@@ -18,22 +20,33 @@
* @author Dmitry Geraskov
*
*/
-public class TestSet{
-
+public class TestSet {
+
/**
* use only addTestSuit to prevent errors!!!
* @return
*/
- public static TestSuite getTests() {
+ public static TestSuite createTestSuite(String consoleConfigName,
+ IPackageFragment testPackage, ConfigurableTestProject testProject) {
TestSuite suite = new TestSuite(ConsoleTestMessages.TestSet_test_for_mappingtestproject);
- addPackTests(suite);
+ HbmExportExceptionTest test1 = new HbmExportExceptionTest("testHbmExportExceptionTest"); //$NON-NLS-1$
+ test1.setConsoleConfigName(consoleConfigName);
+ test1.setTestPackage(testPackage);
+ test1.setTestProject(testProject);
+ OpenSourceFileTest test2 = new OpenSourceFileTest("testOpenSourceFileTest"); //$NON-NLS-1$
+ test2.setConsoleConfigName(consoleConfigName);
+ test2.setTestPackage(testPackage);
+ OpenMappingFileTest test3 = new OpenMappingFileTest("testOpenMappingFileTest"); //$NON-NLS-1$
+ test3.setConsoleConfigName(consoleConfigName);
+ test3.setTestPackage(testPackage);
+ OpenMappingDiagramTest test4 = new OpenMappingDiagramTest("testOpenMappingDiagram"); //$NON-NLS-1$
+ test4.setConsoleConfigName(consoleConfigName);
+ test4.setTestPackage(testPackage);
+ //
+ suite.addTest(test1);
+ suite.addTest(test2);
+ suite.addTest(test3);
+ suite.addTest(test4);
return suite;
}
-
- private static void addPackTests(TestSuite suite) {
- suite.addTestSuite(HbmExportExceptionTest.class);
- //suite.addTestSuite(OpenSourceFileTest.class);
- //suite.addTestSuite(OpenMappingFileTest.class);
- //suite.addTestSuite(OpenMappingDiagramTest.class);
- }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -16,14 +16,12 @@
import java.util.List;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
@@ -31,64 +29,22 @@
import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
import org.hibernate.eclipse.console.test.mappingproject.Customization;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
-
/**
*
- *
* @author Dmitry Geraskov
+ * @author Vitali Yemialyanchyk
*/
-public class ConfigurableTestProject {
+public class ConfigurableTestProject extends TestProject {
- private static ConfigurableTestProject singleton = null;
-
- public static final String PROJECT_NAME = "ConfigurableTestProject"; //$NON-NLS-1$
public static final String RESOURCE_PATH = "res/project/"; //$NON-NLS-1$
- private IProject project;
- private IJavaProject javaProject;
-
- public static ConfigurableTestProject getTestProject(){
- if (singleton == null){
- singleton = new ConfigurableTestProject();
- }
- return singleton;
+ public ConfigurableTestProject(String projectName) {
+ super(projectName);
}
- private ConfigurableTestProject() {
- initialize();
- }
-
- private void initialize(){
- try{
- buildBigTestProject();
- }catch(Exception e){
- throw new RuntimeException(e);
- }
- }
-
- public IProject getIProject(){
- return this.project;
- }
-
- public IJavaProject getIJavaProject(){
- return this.javaProject;
- }
-
- public void deleteIProject(boolean deleteContent) {
- try {
- project.delete(deleteContent, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
- }
-
- private void buildBigTestProject() throws JavaModelException, CoreException, IOException {
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
-
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ super.buildProject();
IPath resourcePath = new Path(RESOURCE_PATH);
File resourceFolder = resourcePath.toFile();
URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(RESOURCE_PATH);
@@ -100,14 +56,13 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
-
long startCopyFiles = System.currentTimeMillis();
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(project, javaProject);
+ IPackageFragmentRoot sourceFolder = createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder.getResource());
long startCopyLibs = System.currentTimeMillis();
- List<IPath> libs = commonUtil.copyLibs(project, javaProject, resourceFolder);
+ List<IPath> libs = copyLibs(resourceFolder);
long startBuild = System.currentTimeMillis();
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ generateClassPath(libs, sourceFolder);
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
long stopBuild = System.currentTimeMillis();
if (Customization.USE_CONSOLE_OUTPUT){
@@ -117,5 +72,4 @@
System.out.println("build: " + ( ( stopBuild - startBuild ) / 1000 )); //$NON-NLS-1$
}
}
-
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -4,10 +4,6 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-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.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -19,44 +15,20 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-public class SimpleTestProject {
-
- IProject project;
- IJavaProject javaProject;
+public class SimpleTestProject extends TestProject {
- final private String projectName;
-
public static final String PACKAGE_NAME = "test"; //$NON-NLS-1$
public static final String TYPE_NAME = "TestClass"; //$NON-NLS-1$
public static final String FILE_NAME = "TestClass.java"; //$NON-NLS-1$
-
- public SimpleTestProject(String projectName) {
- this.projectName=projectName;
- initialize();
- }
-
public SimpleTestProject() {
- projectName = "HibernateToolsTestProject"; //$NON-NLS-1$
- initialize();
+ super("HibernateToolsTestProject"); //$NON-NLS-1$
}
- void initialize(){
- try{
- buildSimpleTestProject();
- }catch(Exception e){
- throw new RuntimeException(e);
- }
+ public SimpleTestProject(String projectName) {
+ super(projectName);
}
-
- public IProject getIProject(){
- return this.project;
- }
- public IJavaProject getIJavaProject(){
- return this.javaProject;
- }
-
public String getFullyQualifiedTestClassName(){
return PACKAGE_NAME + "." + TYPE_NAME; //$NON-NLS-1$
}
@@ -76,84 +48,14 @@
return getTestClassType().getField("testField"); //$NON-NLS-1$
}
- public void deleteIProject() {
- try {
- project.delete(true, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- }
-
- public void deleteIProject(boolean deleteContent) {
- try {
- project.delete(deleteContent, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- }
-
- protected void buildSimpleTestProject() throws JavaModelException, CoreException, IOException {
- project = buildNewProject(projectName);
- javaProject = buildJavaProject(project);
-
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ super.buildProject();
buildType(buildPackage(PACKAGE_NAME, project, javaProject), FILE_NAME);
-
}
- private IProject buildNewProject(String projectName) {
-
- // get a project handle
- final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
- .getRoot().getProject(projectName);
-
- // get a project descriptor
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace
- .newProjectDescription(newProjectHandle.getName());
-
- try {
- createAndOpenProject(description, newProjectHandle);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- return newProjectHandle;
- }
-
- private void createAndOpenProject(IProjectDescription description,
- IProject projectHandle) throws CoreException {
-
- projectHandle.create(description, null);
- projectHandle.open(IResource.BACKGROUND_REFRESH, null);
- }
-
- private IJavaProject buildJavaProject(IProject project) {
-
- IJavaProject javaProject = JavaCore.create(project);
- try {
- setJavaNature(project);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
- return javaProject;
- }
-
- private void setJavaNature(IProject project) throws CoreException {
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { JavaCore.NATURE_ID });
- project.setDescription(description, null);
- }
-
-
private IPackageFragmentRoot buildSourceFolder(IProject project,
IJavaProject javaProject) throws CoreException {
- IFolder folder = project.getFolder("src"); //$NON-NLS-1$
+ IFolder folder = project.getFolder(SRC_FOLDER);
folder.create(false, true, null);
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
IClasspathEntry[] newEntries = { JavaCore
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -46,8 +46,6 @@
public static final String CFG_FILE_NAME = "hibernate.cfg.xml"; //$NON-NLS-1$
- public static final String ConsoleCFGName = "testConfigName"; //$NON-NLS-1$
-
/**
* Create hibernate.cfg.xml file content for the particular test package content.
* @param pack
@@ -126,6 +124,10 @@
wdialog.close();
}
+ /**
+ * Delete console configuration with given name.
+ * @param name
+ */
public static void deleteConsoleConfig(String name) {
final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
final ConsoleConfiguration consoleConfig = knownConfigurations.find(name);
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -23,9 +23,6 @@
private FilesTransfer() {}
- public static final String SRC_FOLDER = "src"; //$NON-NLS-1$
- public static final String LIB_FOLDER = "lib"; //$NON-NLS-1$
-
public static final FileFilter filterFiles = new FileFilter() {
public boolean accept(File pathname) {
return !pathname.isDirectory();
@@ -34,21 +31,17 @@
public static final FileFilter filterFolders = new FileFilter() {
public boolean accept(File pathname) {
- // exclude ".svn" and other unnecessary folders
- if (pathname.getName().charAt(0) == '.') {
+ // exclude hidden files/folders
+ if (pathname.isHidden()) {
return false;
}
- if (LIB_FOLDER.equals(pathname.getName())) {
- return false;
- }
return pathname.isDirectory();
}
};
public static final FileFilter filterJars = new FileFilter() {
public boolean accept(File pathname) {
- return !pathname.isDirectory()
- || pathname.getName().endsWith(".jar"); //$NON-NLS-1$
+ return pathname.isFile() && pathname.getName().endsWith(".jar"); //$NON-NLS-1$
}
};
@@ -124,4 +117,51 @@
}
}
}
+
+ /**
+ * Delete the whole directory
+ * @param path
+ */
+ public static void delete(File path) {
+ if (path.exists()) {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ delete(files[i]);
+ } else {
+ deleteFile(files[i]);
+ }
+ }
+ }
+ deleteFile(path);
+
+ }
+
+ /**
+ * Delete single file
+ * @param file
+ */
+ public static void deleteFile(File file) {
+ try {
+ if (!file.delete()) {
+ throw new RuntimeException(getMessage(file));
+ }
+ } catch (Throwable e) {
+ throw new RuntimeException(getMessage(file) ,e);
+ }
+ }
+
+
+ private static String getMessage(File file) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Cannot remove the "); //$NON-NLS-1$
+ buffer.append(file.getAbsolutePath());
+ buffer.append(" file. "); //$NON-NLS-1$
+ if (file.exists() && file.isDirectory()) {
+ String[] files = file.list();
+ buffer.append("List="); //$NON-NLS-1$
+ buffer.append(files.toString());
+ }
+ return buffer.toString();
+ }
}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.test.utils;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.internal.ErrorEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.utils.OpenMappingUtils;
-import org.hibernate.mapping.PersistentClass;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-@SuppressWarnings("restriction")
-public class ProjectUtil {
-
-
- public static String getPersistentClassName(PersistentClass persClass) {
- if (persClass == null) {
- return ""; //$NON-NLS-1$
- }
- return persClass.getEntityName() != null ? persClass.getEntityName() : persClass.getClassName();
- }
-
- /**
- * Sometimes we have exceptions while opening editors.
- * IDE catches this exceptions and opens ErrorEditorPart instead of
- * our editor. To be sure that editor opened without exception use this method.
- * It gets occurred exception from the editor if it was and passes it up.
- *
- * @param editor
- * @return
- * @throws Throwable
- */
- public static Throwable getExceptionIfItOccured(IEditorPart editor){
- if (editor instanceof ErrorEditorPart){
- Class<ErrorEditorPart> clazz = ErrorEditorPart.class;
- Field field;
- try {
- field = clazz.getDeclaredField("error"); //$NON-NLS-1$
-
- field.setAccessible(true);
-
- Object error = field.get(editor);
- if (error instanceof IStatus) {
- IStatus err_status = (IStatus) error;
- if (err_status.getSeverity() == Status.ERROR){
- return err_status.getException();
- }
- }
- // catch close means that exception occurred but we can't get it
- } catch (SecurityException e) {
- return new RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_exception_from_erroreditorpart + e.getMessage());
- } catch (NoSuchFieldException e) {
- return new RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage());
- } catch (IllegalArgumentException e) {
- return new RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage());
- } catch (IllegalAccessException e) {
- return new RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage());
- }
- }
- return null;
- }
-
- public static boolean checkHighlighting(IEditorPart editor){
- ITextEditor[] tEditors = OpenMappingUtils.getTextEditors(editor);
- boolean highlighted = false;
- for (int i = 0; i < tEditors.length && !highlighted; i++) {
- ITextEditor textEditor = tEditors[i];
- ISelection selection = textEditor.getSelectionProvider().getSelection();
- if (selection instanceof TextSelection){
- TextSelection tSelection = (TextSelection)selection;
- highlighted = tSelection.getLength() > 0;
- }
- }
- return highlighted;
- }
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.test.utils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-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.IStatus;
-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.core.JavaModelException;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-
-/**
- *
- */
-public class TestUtilsCommon {
-
- public static final Path JRE_CONTAINER = new Path(
- "org.eclipse.jdt.launching.JRE_CONTAINER"); //$NON-NLS-1$
-
-
- public IProject buildNewProject(String projectName) {
- // get a project handle
- final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
- .getRoot().getProject(projectName);
-
- // get a project descriptor
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace
- .newProjectDescription(newProjectHandle.getName());
-
- try {
- createAndOpenProject(description, newProjectHandle);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- return newProjectHandle;
- }
-
- public void createAndOpenProject(IProjectDescription description,
- IProject projectHandle) throws CoreException {
-
- try {
- projectHandle.create(description, null);
- } catch (ResourceException re) {
- // if the project exist - ignore exception
- if (re.getStatus().getCode() != 374 || re.getStatus().getSeverity() != IStatus.ERROR ||
- !"org.eclipse.core.resources".equals(re.getStatus().getPlugin())) { //$NON-NLS-1$
- throw re;
- }
- }
- projectHandle.open(IResource.BACKGROUND_REFRESH, null);
- }
-
- public IJavaProject buildJavaProject(IProject project) {
- IJavaProject javaProject = JavaCore.create(project);
- try {
- setJavaNature(project);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- javaProject.setOption(JavaCore.COMPILER_COMPLIANCE,
- JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
- JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
- return javaProject;
- }
-
- public void setJavaNature(IProject project) throws CoreException {
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { JavaCore.NATURE_ID });
- project.setDescription(description, null);
- }
-
- public IPackageFragmentRoot createFolder(IProject project,
- IJavaProject javaProject, String strFolder) throws CoreException {
- IFolder folder = project.getFolder(strFolder);
- if (!folder.exists()) {
- folder.create(true, true, null);
- IPackageFragmentRoot root = javaProject
- .getPackageFragmentRoot(folder);
- /*
- * IClasspathEntry[] newEntries = { JavaCore
- * .newSourceEntry(root.getPath()) , JavaCore
- * .newContainerEntry(JRE_CONTAINER)};
- * javaProject.setRawClasspath(newEntries, null);
- */
- return root;
- }
- return javaProject.getPackageFragmentRoot(folder);
- }
-
- public IPackageFragmentRoot createSourceFolder(IProject project,
- IJavaProject javaProject) throws CoreException {
- return createFolder(project, javaProject, FilesTransfer.SRC_FOLDER);
- }
-
- public List<IPath> copyLibs(IProject project, IJavaProject javaProject,
- File res) throws CoreException {
- return copyLibs2(project, javaProject,
- res.getAbsolutePath() + File.separator + FilesTransfer.LIB_FOLDER);
- }
-
- public List<IPath> copyLibs2(IProject project, IJavaProject javaProject,
- String absolutePath) throws CoreException {
- IFolder dst = project.getFolder(FilesTransfer.LIB_FOLDER);
- if (!dst.exists()) {
- dst.create(true, true, null);
- javaProject.getPackageFragmentRoot(dst);
- }
- File libFolder = new File(absolutePath);
- if (!libFolder.exists()) {
- String out = NLS.bind(
- ConsoleTestMessages.MappingTestProject_folder_not_found,
- absolutePath);
- throw new RuntimeException(out);
- }
- List<IPath> libs = new ArrayList<IPath>();
- FilesTransfer.copyFolder(libFolder, dst, FilesTransfer.filterJars,
- FilesTransfer.filterFolders, libs);
- return libs;
- }
-
- public void generateClassPath(IJavaProject javaProject, List<IPath> libs,
- IPackageFragmentRoot sourceFolder) throws JavaModelException {
- List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- // entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
- for (IPath lib_path : libs) {
- entries.add(JavaCore.newLibraryEntry(lib_path, null, null));
- }
- entries.add(JavaCore.newSourceEntry(sourceFolder.getPath()));
- entries.add(JavaCore.newContainerEntry(JRE_CONTAINER));
- javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]),
- null);
- }
-}
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java (from rev 15639, trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.utils;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.internal.ErrorEditorPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.utils.OpenMappingUtils;
+import org.hibernate.mapping.PersistentClass;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class Utils {
+
+
+ public static String getPersistentClassName(PersistentClass persClass) {
+ if (persClass == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return persClass.getEntityName() != null ? persClass.getEntityName() : persClass.getClassName();
+ }
+
+ /**
+ * Sometimes we have exceptions while opening editors.
+ * IDE catches this exceptions and opens ErrorEditorPart instead of
+ * our editor. To be sure that editor opened without exception use this method.
+ * It gets occurred exception from the editor if it was and passes it up.
+ *
+ * @param editor
+ * @return
+ * @throws Throwable
+ */
+ public static Throwable getExceptionIfItOccured(IEditorPart editor){
+ if (!(editor instanceof ErrorEditorPart)) {
+ return null;
+ }
+ String ex = null;
+ try {
+ Class<ErrorEditorPart> clazz = ErrorEditorPart.class;
+ Field field = clazz.getDeclaredField("error"); //$NON-NLS-1$
+ field.setAccessible(true);
+ Object error = field.get(editor);
+ if (error instanceof IStatus) {
+ IStatus err_status = (IStatus) error;
+ if (err_status.getSeverity() == Status.ERROR) {
+ return err_status.getException();
+ }
+ }
+ // catch close means that exception occurred but we can't get it
+ } catch (SecurityException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_exception_from_erroreditorpart + e.getMessage();
+ } catch (NoSuchFieldException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage();
+ } catch (IllegalArgumentException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage();
+ } catch (IllegalAccessException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart + e.getMessage();
+ }
+ if (ex == null) {
+ return null;
+ }
+ return new RuntimeException(ex);
+ }
+
+ /**
+ * Checks has the editor selection or not
+ * @param editor
+ * @return
+ */
+ public static boolean hasSelection(IEditorPart editor){
+ ITextEditor[] tEditors = OpenMappingUtils.getTextEditors(editor);
+ boolean res = false;
+ for (int i = 0; i < tEditors.length && !res; i++) {
+ ITextEditor textEditor = tEditors[i];
+ ISelection selection = textEditor.getSelectionProvider().getSelection();
+ if (selection instanceof TextSelection){
+ TextSelection tSelection = (TextSelection)selection;
+ res = tSelection.getLength() > 0;
+ }
+ }
+ return res;
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -23,10 +23,19 @@
*/
public class HBMInfoExtractorTest extends TestCase {
private HBMInfoExtractorStub sourceLocator = new HBMInfoExtractorStub();
+ private ConfigurableTestProject testProj = null;
+ protected void setUp() throws Exception {
+ testProj = new ConfigurableTestProject("HBMInfoProj"); //$NON-NLS-1$
+ }
+
+ protected void tearDown() throws Exception {
+ testProj.deleteIProject();
+ testProj = null;
+ }
+
public void executeJavaTypeHandlerTest(String start, String attributeName) {
sourceLocator.setPackageName("org"); //$NON-NLS-1$
- ConfigurableTestProject testProj = ConfigurableTestProject.getTestProject();
IJavaProject project = testProj.getIJavaProject();
JavaTypeHandler javaTypeHandler = new JavaTypeHandler(sourceLocator);
ICompletionProposal[] res =
@@ -54,7 +63,6 @@
public void executePackageHandlerTest(String start, String attributeName) {
sourceLocator.setPackageName("org"); //$NON-NLS-1$
- ConfigurableTestProject testProj = ConfigurableTestProject.getTestProject();
IJavaProject project = testProj.getIJavaProject();
PackageHandler packageHandler = new PackageHandler(sourceLocator);
ICompletionProposal[] res =
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -1,6 +1,5 @@
package org.hibernate.eclipse.jdt.ui.test;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -30,7 +29,7 @@
import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.HQLDetector;
import org.hibernate.eclipse.jdt.ui.internal.HQLProblem;
@@ -50,9 +49,9 @@
return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) { //$NON-NLS-1$
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
//set up project #3: file system structure with project as source folder
@@ -63,6 +62,7 @@
JavaProjectHelper.addToClasspath(getIJavaProject(), JavaRuntime.getDefaultJREContainerEntry());
IPackageFragmentRoot addLibraryWithImport = JavaProjectHelper.addLibraryWithImport(getIJavaProject(), Path.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3,getIJavaProject().getRawClasspath().length);
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -9,7 +9,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -20,7 +19,8 @@
import org.eclipse.ui.PlatformUI;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.utils.FilesTransfer;
public class HibernateErrorsTest extends HibernateConsoleTest {
@@ -39,9 +39,9 @@
// see JBIDE-1012
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
// set up project #3: file system structure with project as
// source folder
@@ -58,6 +58,7 @@
IPackageFragmentRoot addLibraryWithImport = JavaProjectHelper
.addLibraryWithImport(getIJavaProject(), Path
.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3, getIJavaProject().getRawClasspath().length);
@@ -152,33 +153,9 @@
getProject().getIProject().delete(false, true, null);
waitForJobs();
- delete(file);
+ FilesTransfer.delete(file);
}
- private void delete(File path) {
- if (path.exists()) {
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- delete(files[i]);
- } else {
- deleteFile(files[i]);
- }
- }
- }
- deleteFile(path);
-
- }
-
- private void deleteFile(File file) {
- try {
- if (!file.delete())
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() + " file."); //$NON-NLS-1$//$NON-NLS-2$
- } catch (Throwable e) {
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() + " file.",e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
public void testDummy() throws JavaModelException {
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -28,7 +28,8 @@
import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.utils.FilesTransfer;
import org.hibernate.eclipse.console.utils.ProjectUtils;
public class HibernateErrorsTest2 extends HibernateConsoleTest {
@@ -49,9 +50,9 @@
return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) { //$NON-NLS-1$
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
//set up project #3: file system structure with project as source folder
@@ -62,6 +63,7 @@
JavaProjectHelper.addToClasspath(getIJavaProject(), JavaRuntime.getDefaultJREContainerEntry());
IPackageFragmentRoot addLibraryWithImport = JavaProjectHelper.addLibraryWithImport(getIJavaProject(), Path.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3,getIJavaProject().getRawClasspath().length);
@@ -166,50 +168,12 @@
}, new NullProgressMonitor());
}
waitForJobs();
- delete(file);
+ FilesTransfer.delete(file);
}
public void testDummy() throws JavaModelException {
}
- private void delete(File path) {
- if (path.exists()) {
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- delete(files[i]);
- } else {
- deleteFile(files[i]);
- }
- }
- }
- deleteFile(path);
-
- }
-
- private void deleteFile(File file) {
- try {
- if (!file.delete()) {
- throw new RuntimeException(getMessage(file));
- }
- } catch (Throwable e) {
- throw new RuntimeException(getMessage(file),e);
- }
- }
-
- private String getMessage(File file) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Cannot remove the "); //$NON-NLS-1$
- buffer.append(file.getAbsolutePath());
- buffer.append(" file. "); //$NON-NLS-1$
- if (file.exists() && file.isDirectory()) {
- String[] files = file.list();
- buffer.append("List="); //$NON-NLS-1$
- buffer.append(files.toString());
- }
- return buffer.toString();
- }
-
protected SimpleTestProject getProject() {
return this.project;
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -18,7 +18,6 @@
import java.util.List;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -32,8 +31,8 @@
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.osgi.util.NLS;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
@@ -59,23 +58,16 @@
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
- protected IProject project;
- protected IJavaProject javaProject;
+ protected TestProject project = null;
protected String testSelection;
protected void setUp() throws Exception {
}
protected void tearDown() throws Exception {
- try {
- project.delete(true, true, null);
- project = null;
- javaProject = null;
- } catch (CoreException e) {
- fail(e.getMessage());
- }
- assertNull(project);
- assertNull(javaProject);
+ assertNotNull(project);
+ project.deleteIProject();
+ project = null;
}
public void testTransformerFields() {
@@ -102,9 +94,8 @@
fail(e1.getMessage());
}
assertNotNull(project);
- assertNotNull(javaProject);
//
- javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
+ IJavaProject javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
assertNotNull(javaProject);
try {
javaProject.getProject().open(null);
@@ -172,7 +163,7 @@
}
protected ASTNode getGenerated(String strName) {
- ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
+ ICompilationUnit icu = Utils.findCompilationUnit(project.getIJavaProject(),
"test.annotated." + testSelection + //$NON-NLS-1$
"." + strName); //$NON-NLS-1$
ASTParser parser = ASTParser.newParser(AST.JLS3);
@@ -221,9 +212,7 @@
protected void createTestProject() throws JavaModelException,
CoreException, IOException {
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
+ project = new TestProject(PROJECT_NAME);
File resourceFolder = getResourceItem(RESOURCE_PATH);
if (!resourceFolder.exists()) {
String out = NLS.bind(
@@ -231,8 +220,7 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(
- project, javaProject);
+ IPackageFragmentRoot sourceFolder = project.createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder
.getResource());
File resourceFolderLib = getResourceItem(TESTRESOURCE_PATH);
@@ -242,9 +230,8 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- List<IPath> libs = commonUtil.copyLibs2(project, javaProject,
- resourceFolderLib.getAbsolutePath());
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ List<IPath> libs = project.copyLibs2(resourceFolderLib.getAbsolutePath());
+ project.generateClassPath(libs, sourceFolder);
}
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2009-06-03 15:35:02 UTC (rev 15680)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2009-06-03 15:35:39 UTC (rev 15681)
@@ -11,7 +11,6 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -23,8 +22,8 @@
import org.eclipse.osgi.util.NLS;
import org.hibernate.cfg.Configuration;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
@@ -49,8 +48,7 @@
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
- protected IProject project;
- protected IJavaProject javaProject;
+ protected TestProject project = null;
protected void setUp() throws Exception {
try {
@@ -63,8 +61,8 @@
fail(e1.getMessage());
}
assertNotNull(project);
+ IJavaProject javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
assertNotNull(javaProject);
- assertNotNull(ProjectUtils.findJavaProject(PROJECT_NAME));
try {
javaProject.getProject().open(null);
} catch (CoreException e) {
@@ -80,7 +78,7 @@
protected Configuration getConfigurationFor(String... cuNames){
Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
for (int i = 0; i < cuNames.length; i++) {
- ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
+ ICompilationUnit icu = Utils.findCompilationUnit(project.getIJavaProject(),
cuNames[i]);
assertNotNull(icu);
selectionCU.add(icu);
@@ -88,7 +86,7 @@
ConfigurationActor actor = new ConfigurationActor(selectionCU);
Map<IJavaProject, Configuration> configurations = actor.createConfigurations();
assertEquals(1, configurations.size());
- Configuration config = configurations.get(javaProject);
+ Configuration config = configurations.get(project.getIJavaProject());
assertNotNull(config);
return config;
}
@@ -100,68 +98,68 @@
}
public void testId(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
Property aId= a.getIdentifierProperty();
Property bId= b.getIdentifierProperty();
assertNotNull(aId);
assertNotNull(bId);
- assertEquals("id", aId.getName());
- assertEquals("id", bId.getName());
+ assertEquals("id", aId.getName()); //$NON-NLS-1$
+ assertEquals("id", bId.getName()); //$NON-NLS-1$
}
public void testProperty(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
- Property prop = a.getProperty("prop");
+ Property prop = a.getProperty("prop"); //$NON-NLS-1$
Value value = prop.getValue();
assertNotNull(value);
- assertTrue("Expected to get ManyToOne-type mapping", value.getClass()== ManyToOne.class);
+ assertTrue("Expected to get ManyToOne-type mapping", value.getClass()== ManyToOne.class); //$NON-NLS-1$
ManyToOne mto = (ManyToOne)value;
- assertEquals("pack.B", mto.getTypeName());
+ assertEquals("pack.B", mto.getTypeName()); //$NON-NLS-1$
}
public void testArray(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property bs = a.getProperty("bs");
+ Property bs = a.getProperty("bs"); //$NON-NLS-1$
Value value = bs.getValue();
assertNotNull(value);
- assertTrue("Expected to get Array-type mapping", value.getClass()==Array.class);
+ assertTrue("Expected to get Array-type mapping", value.getClass()==Array.class); //$NON-NLS-1$
Array ar = (Array)value;
- assertEquals("pack.B", ar.getElementClassName());
- assertTrue("Expected to get one-to-many array's element type",
+ assertEquals("pack.B", ar.getElementClassName()); //$NON-NLS-1$
+ assertTrue("Expected to get one-to-many array's element type", //$NON-NLS-1$
ar.getElement().getClass() == OneToMany.class);
- Property testIntArray = b.getProperty("testIntArray");
+ Property testIntArray = b.getProperty("testIntArray"); //$NON-NLS-1$
assertNotNull(testIntArray);
value = testIntArray.getValue();
assertNotNull(value);
- assertTrue("Expected to get PrimitiveArray-type mapping",
+ assertTrue("Expected to get PrimitiveArray-type mapping", //$NON-NLS-1$
value.getClass()==PrimitiveArray.class);
PrimitiveArray pAr = (PrimitiveArray) value;
assertNotNull(pAr.getElement());
- assertTrue("Expected to get int-type primitive array", pAr.getElement().getType().getClass()==IntegerType.class);
+ assertTrue("Expected to get int-type primitive array", pAr.getElement().getType().getClass()==IntegerType.class); //$NON-NLS-1$
}
public void testList(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property listProp = a.getProperty("list");
+ Property listProp = a.getProperty("list"); //$NON-NLS-1$
Value value = listProp.getValue();
assertNotNull(value);
- assertTrue("Expected to get List-type mapping",
+ assertTrue("Expected to get List-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.List.class);
org.hibernate.mapping.List list = (org.hibernate.mapping.List)value;
assertTrue(list.getElement() instanceof OneToMany);
@@ -171,15 +169,15 @@
}
public void testSet(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property setProp = a.getProperty("set");
+ Property setProp = a.getProperty("set"); //$NON-NLS-1$
Value value = setProp.getValue();
assertNotNull(value);
- assertTrue("Expected to get Set-type mapping",
+ assertTrue("Expected to get Set-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.Set.class);
org.hibernate.mapping.Set set = (org.hibernate.mapping.Set)value;
assertTrue(set.getElement() instanceof OneToMany);
@@ -188,29 +186,27 @@
}
public void testMap(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property mapValue = a.getProperty("mapValue");
+ Property mapValue = a.getProperty("mapValue"); //$NON-NLS-1$
Value value = mapValue.getValue();
assertNotNull(value);
- assertTrue("Expected to get Map-type mapping",
+ assertTrue("Expected to get Map-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.Map.class);
org.hibernate.mapping.Map map = (org.hibernate.mapping.Map)value;
assertTrue(map.getElement() instanceof OneToMany);
assertTrue(map.getCollectionTable().equals(b.getTable()));
assertNotNull(map.getKey());
- assertEquals("string", map.getKey().getType().getName());
+ assertEquals("string", map.getKey().getType().getName()); //$NON-NLS-1$
}
protected void createTestProject() throws JavaModelException,
CoreException, IOException {
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
+ project = new TestProject(PROJECT_NAME);
File resourceFolder = getResourceItem(RESOURCE_PATH);
if (!resourceFolder.exists()) {
String out = NLS.bind(
@@ -218,8 +214,7 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(
- project, javaProject);
+ IPackageFragmentRoot sourceFolder = project.createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder
.getResource());
File resourceFolderLib = getResourceItem(TESTRESOURCE_PATH);
@@ -229,9 +224,8 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- List<IPath> libs = commonUtil.copyLibs2(project, javaProject,
- resourceFolderLib.getAbsolutePath());
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ List<IPath> libs = project.copyLibs2(resourceFolderLib.getAbsolutePath());
+ project.generateClassPath(libs, sourceFolder);
}
protected File getResourceItem(String strResPath) throws IOException {
@@ -246,15 +240,9 @@
}
protected void tearDown() throws Exception {
- try {
- project.delete(true, true, null);
- project = null;
- javaProject = null;
- } catch (CoreException e) {
- fail(e.getMessage());
- }
- assertNull(project);
- assertNull(javaProject);
+ assertNotNull(project);
+ project.deleteIProject();
+ project = null;
}
}
15 years, 9 months