Source Code Cross Referenced for BugZillaTracker.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » bugzilla » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » salomeTMF_plug.bugzilla 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020:         *
021:         * Contact: 	mikael.marche@rd.francetelecom.com
022:         * 			faycal.sougrati@francetelecom.com
023:         */
024:
025:        package salomeTMF_plug.bugzilla;
026:
027:        import java.sql.PreparedStatement;
028:        import java.sql.ResultSet;
029:        import java.util.Observable;
030:        import java.util.Properties;
031:        import java.util.StringTokenizer;
032:        import java.util.Vector;
033:
034:        import javax.swing.JOptionPane;
035:
036:        import org.objectweb.salome_tmf.api.ApiConstants;
037:        import org.objectweb.salome_tmf.api.Util;
038:        import org.objectweb.salome_tmf.api.sql.IDataBase;
039:        import org.objectweb.salome_tmf.data.Attachment;
040:        import org.objectweb.salome_tmf.data.Environment;
041:        import org.objectweb.salome_tmf.data.Execution;
042:        import org.objectweb.salome_tmf.data.ExecutionResult;
043:        import org.objectweb.salome_tmf.data.Project;
044:        import org.objectweb.salome_tmf.data.SalomeEvent;
045:        import org.objectweb.salome_tmf.data.Test;
046:        import org.objectweb.salome_tmf.data.UrlAttachment;
047:        import org.objectweb.salome_tmf.data.User;
048:        import org.objectweb.salome_tmf.ihm.main.AttachmentView;
049:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
050:
051:        import salomeTMF_plug.bugzilla.languages.Language;
052:
053:        public abstract class BugZillaTracker {
054:            //JApplet applet = null;
055:            String bugzilla_host = "";
056:            User currentUser = null;
057:            Project currentProject = null;
058:
059:            boolean isCurrentUserExists = false;
060:            protected IDataBase iDB = null;
061:            protected Properties sql_prop = null;
062:            int bugUsrID = -1;
063:
064:            String BUGZILLA_STMT_FILE;
065:            String BUGZILLA_SUB_MENU;
066:
067:            final String BLOCKER_STR = "blocker";
068:            final String MAJOR_STR = "major";
069:            final String CRITICAL_STR = "critical";
070:            final String CORRECTED_STR = "CLOSED";
071:
072:            BugZillaTracker(IDataBase _iDB, String _bugzilla_host) {
073:                iDB = _iDB;
074:                //applet = _applet;
075:                bugzilla_host = _bugzilla_host;
076:            }
077:
078:            abstract void init(User pUser, Project pProject) throws Exception;
079:
080:            String getBugTrackerName() {
081:                return BUGZILLA_SUB_MENU;
082:            }
083:
084:            abstract String getBugTrackerAttachDesc();
085:
086:            boolean isUserExistsInBugDB() {
087:                return isCurrentUserExists;
088:            }
089:
090:            /**
091:             * Validates changes in Bugzilla database
092:             */
093:            void validateChange() {
094:                try {
095:                    java.net.URL url_validate = new java.net.URL(bugzilla_host
096:                            + "/validate.cgi");
097:                    java.io.BufferedReader in = new java.io.BufferedReader(
098:                            new java.io.InputStreamReader(url_validate
099:                                    .openStream()));
100:                    String line;
101:
102:                    String rep = "";
103:                    while ((line = in.readLine()) != null) {
104:                        rep = rep + line + "\n";
105:                    }
106:                    in.close();
107:                } catch (Exception e) {
108:                    Util.log("[BugzillaPlugin] BUGZILLA VALIDATION ERROR  : "
109:                            + e);
110:                }
111:            }
112:
113:            void update(Observable o, Object arg) {
114:                try {
115:                    if (arg instanceof  SalomeEvent) {
116:                        SalomeEvent pSalomeEvent = (SalomeEvent) arg;
117:                        int code = pSalomeEvent.getCode();
118:                        if (code == ApiConstants.INSERT_ENVIRONMENT) {
119:                            Environment env = (Environment) pSalomeEvent
120:                                    .getArg();
121:                            Util
122:                                    .log("[BugzillaPlugin] dispach event INSERT_ENVIRONMENT env = "
123:                                            + env.getNameFromModel());
124:                            if (isExistEnv(currentProject.getNameFromModel(),
125:                                    env.getNameFromModel())) {
126:                                addEnvironment(env);
127:                            }
128:                        } else if (code == ApiConstants.UPDATE_ENVIRONMENT) {
129:                            String oldName = (String) pSalomeEvent
130:                                    .getOldValue();
131:                            String newName = (String) pSalomeEvent
132:                                    .getNewValue();
133:                            Util
134:                                    .log("[BugzillaPlugin] dispach event UPDATE_ENVIRONMENT old env = "
135:                                            + oldName
136:                                            + " - new env = "
137:                                            + newName);
138:                            updateEnvironment(oldName, newName, "[SALOME_ENV]");
139:                        } else if (code == ApiConstants.DELETE_ENVIRONMENT) {
140:                            Environment env = (Environment) pSalomeEvent
141:                                    .getArg();
142:                            Util
143:                                    .log("[BugzillaPlugin] dispach event DELETE_ENVIRONMENT env = "
144:                                            + env.getNameFromModel());
145:                            deleteEnvironment(env.getNameFromModel());
146:                        }
147:                    }
148:
149:                } catch (Exception e) {
150:                    e.printStackTrace();
151:                }
152:            }
153:
154:            /*****************************************************************************************************/
155:
156:            abstract void addUser(User user) throws Exception;
157:
158:            void afterAddProject(Project project) {
159:                validateChange();
160:
161:                JOptionPane.showMessageDialog(SalomeTMFContext.getInstance()
162:                        .getSalomeFrame(), Language.getInstance().getText(
163:                        "Le_projet_\"")
164:                        + currentProject.getNameFromModel()
165:                        + Language.getInstance().getText(
166:                                "\"_a_été_créé_dans_Bugzilla_avec_succès\n"),
167:                        Language.getInstance().getText("Information..."),
168:                        JOptionPane.INFORMATION_MESSAGE);
169:            }
170:
171:            abstract void addProject(Project project) throws Exception;
172:
173:            abstract void addEnvironment(Environment environment)
174:                    throws Exception;
175:
176:            abstract void updateEnvironment(String old_component,
177:                    String new_component, String description) throws Exception;
178:
179:            abstract void deleteEnvironment(String environment)
180:                    throws Exception;
181:
182:            abstract Attachment addBug(String long_desc, String assigned_to,
183:                    String url_attach, String bug_severity, String short_desc,
184:                    String bug_OS, String bug_priority, String bug_platform,
185:                    Execution pExec, ExecutionResult pExecRes, Test ptest)
186:                    throws Exception;
187:
188:            abstract String getBugID(Attachment pAttachment);
189:
190:            void showBug(Attachment attach) {
191:                AttachmentView.viewAttachement(attach);
192:            }
193:
194:            abstract boolean isExistEnv(String projectName, String envName)
195:                    throws Exception;
196:
197:            abstract void showEnvironmentBugs(Environment env);
198:
199:            abstract int getEnvironmentNbBugs(Environment env, int severity,
200:                    boolean onlyCorretedBugs);
201:
202:            /*****************************************************************************************************/
203:
204:            abstract Vector getBugOSList();
205:
206:            abstract Vector getBugPriorityList();
207:
208:            abstract Vector getBugPlateformList();
209:
210:            abstract Vector getBugSeverityList();
211:
212:            Vector getBugTrackerAllUsers() {
213:                Vector res = null;
214:                try {
215:                    ResultSet stmtRes;
216:                    PreparedStatement prep = iDB.prepareStatement(sql_prop
217:                            .getProperty("SelectAllLogin"));
218:                    stmtRes = prep.executeQuery();
219:                    res = new Vector();
220:                    while (stmtRes.next()) {
221:                        res.add(stmtRes.getString("login_name"));
222:                    }
223:                } catch (Exception E) {
224:                    E.printStackTrace();
225:                }
226:                return res;
227:            }
228:
229:            /*****************************************************************************************************/
230:
231:            Vector getEnumField(String enum_string) {
232:                Vector list = new Vector();
233:                Util.log("[BugZillaTracker -> getEnumField()]Enum String = "
234:                        + enum_string);
235:
236:                enum_string = enum_string.replaceFirst("enum\\(", "");
237:                enum_string = enum_string.replaceFirst("\\)", "");
238:
239:                StringTokenizer enum_fields = new StringTokenizer(enum_string,
240:                        ",", false);
241:
242:                for (; enum_fields.hasMoreTokens();) {
243:                    String enum_field = enum_fields.nextToken().trim();
244:                    enum_field = enum_field.replaceAll("'", "");
245:                    list.add(enum_field);
246:                }
247:
248:                return list;
249:            }
250:
251:            protected void finalize() throws Throwable {
252:                System.out.println("[BugZillaTracker -> Close DB");
253:                iDB.close();
254:                super .finalize();
255:            }
256:
257:            boolean isEditableOS() {
258:                return false;
259:            }
260:
261:            public boolean isEditablePlateForme() {
262:                return false;
263:            }
264:
265:            void closeDB() throws Exception {
266:                iDB.close();
267:            }
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.