|
42 | 42 | import com.ibm.microclimate.core.internal.connection.MicroclimateConnection; |
43 | 43 | import com.ibm.microclimate.core.internal.connection.MicroclimateConnectionManager; |
44 | 44 | import com.ibm.microclimate.core.internal.console.MicroclimateConsoleFactory; |
| 45 | +import com.ibm.microclimate.core.internal.console.ProjectLogInfo; |
45 | 46 | import com.ibm.microclimate.core.internal.console.ProjectTemplateInfo; |
| 47 | +import com.ibm.microclimate.core.internal.console.SocketConsole; |
46 | 48 | import com.ibm.microclimate.core.internal.constants.AppState; |
47 | 49 | import com.ibm.microclimate.core.internal.constants.MCConstants; |
48 | 50 | import com.ibm.microclimate.core.internal.constants.ProjectType; |
@@ -157,35 +159,49 @@ protected void switchMode(StartMode mode) throws Exception { |
157 | 159 | } |
158 | 160 |
|
159 | 161 | protected void showConsoles() throws Exception { |
160 | | - MicroclimateApplication app = connection.getAppByName(projectName); |
161 | | - if (!app.projectType.isType(ProjectType.TYPE_NODEJS)) { |
162 | | - IConsole buildConsole = MicroclimateConsoleFactory.createBuildConsole(app); |
163 | | - ((MCEclipseApplication)app).setAppConsole(buildConsole); |
| 162 | + MCEclipseApplication app = (MCEclipseApplication) connection.getAppByName(projectName); |
| 163 | + if (connection.checkVersion(1905, "2019_M5_E")) { |
| 164 | + for (ProjectLogInfo logInfo : app.getLogInfos()) { |
| 165 | + if (app.getConsole(logInfo) == null) { |
| 166 | + SocketConsole console = MicroclimateConsoleFactory.createLogFileConsole(app, logInfo); |
| 167 | + app.addConsole(console); |
| 168 | + } |
| 169 | + } |
| 170 | + } else { |
| 171 | + if (!app.projectType.isType(ProjectType.TYPE_NODEJS)) { |
| 172 | + IConsole buildConsole = MicroclimateConsoleFactory.createBuildConsole(app); |
| 173 | + ((MCEclipseApplication)app).setAppConsole(buildConsole); |
| 174 | + } |
| 175 | + IConsole appConsole = MicroclimateConsoleFactory.createApplicationConsole(app); |
| 176 | + ((MCEclipseApplication)app).setAppConsole(appConsole); |
164 | 177 | } |
165 | | - IConsole appConsole = MicroclimateConsoleFactory.createApplicationConsole(app); |
166 | | - ((MCEclipseApplication)app).setAppConsole(appConsole); |
167 | | - // Wait for application log to have content - it is only updated every 20s |
168 | | - TestUtil.wait(new Condition() { |
169 | | - @Override |
170 | | - public boolean test() { |
171 | | - return ((TextConsole)appConsole).getDocument().getLength() > 0; |
172 | | - } |
173 | | - }, 20, 1); |
174 | 178 | } |
175 | 179 |
|
176 | 180 | protected void checkConsoles() throws Exception { |
177 | 181 | MicroclimateApplication app = connection.getAppByName(projectName); |
178 | 182 | Set<String> expectedConsoles = new HashSet<String>(); |
179 | 183 | Set<String> foundConsoles = new HashSet<String>(); |
180 | | - if (!app.projectType.isType(ProjectType.TYPE_NODEJS)) { |
181 | | - expectedConsoles.add("Build Log"); |
| 184 | + if (connection.checkVersion(1905, "2019_M5_E")) { |
| 185 | + for (ProjectLogInfo logInfo : app.getLogInfos()) { |
| 186 | + expectedConsoles.add(logInfo.logName); |
| 187 | + } |
| 188 | + } else { |
| 189 | + if (!app.projectType.isType(ProjectType.TYPE_NODEJS)) { |
| 190 | + expectedConsoles.add("Build Log"); |
| 191 | + } |
| 192 | + expectedConsoles.add("Application Log"); |
182 | 193 | } |
183 | | - expectedConsoles.add("Application Log"); |
184 | 194 | IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); |
185 | 195 | for (IConsole console : manager.getConsoles()) { |
186 | 196 | if (console.getName().contains(projectName)) { |
187 | 197 | TestUtil.print("Found console: " + console.getName()); |
188 | 198 | assertTrue("The " + console.getName() + " console should be a TextConsole", console instanceof TextConsole); |
| 199 | + TestUtil.wait(new Condition() { |
| 200 | + @Override |
| 201 | + public boolean test() { |
| 202 | + return ((TextConsole)console).getDocument().getLength() > 0; |
| 203 | + } |
| 204 | + }, 20, 1); |
189 | 205 | assertTrue("The " + console.getName() + " console should not be empty", ((TextConsole)console).getDocument().getLength() > 0); |
190 | 206 | for (String name : expectedConsoles) { |
191 | 207 | if (console.getName().contains(name)) { |
|
0 commit comments