Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
f7af64aa
Commit
f7af64aa
authored
Sep 16, 2015
by
Aurelien Pupier
Browse files
Merge pull request #282 from bonitasoft/fix/BS-14070_tomcat_startup_after_switch_repo
BS-14070 Fix running state of engine
parents
f5638635
9f4db1a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.designer/src/org/bonitasoft/studio/designer/core/resources/RepositoryNotifier.java
View file @
f7af64aa
...
...
@@ -39,8 +39,10 @@ public class RepositoryNotifier {
}
public
void
postDelete
(
final
IRepositoryFileStore
fileStore
)
throws
ResourceNotFoundException
{
fileStore
.
getParentStore
().
refresh
();
repository
.
handleFileStoreEvent
(
new
FileStoreChangeEvent
(
EventType
.
POST_DELETE
,
fileStore
));
if
(
fileStore
!=
null
)
{
fileStore
.
getParentStore
().
refresh
();
repository
.
handleFileStoreEvent
(
new
FileStoreChangeEvent
(
EventType
.
POST_DELETE
,
fileStore
));
}
}
public
void
postClose
(
final
IRepositoryFileStore
fileStore
)
throws
ResourceNotFoundException
{
...
...
@@ -57,8 +59,10 @@ public class RepositoryNotifier {
}
public
void
postSave
(
final
IRepositoryFileStore
fileStore
)
{
fileStore
.
getParentStore
().
refresh
();
repository
.
handleFileStoreEvent
(
new
FileStoreChangeEvent
(
EventType
.
POST_SAVE
,
fileStore
));
if
(
fileStore
!=
null
)
{
fileStore
.
getParentStore
().
refresh
();
repository
.
handleFileStoreEvent
(
new
FileStoreChangeEvent
(
EventType
.
POST_SAVE
,
fileStore
));
}
}
private
void
checkExists
(
final
IRepositoryFileStore
fileStore
)
throws
ResourceNotFoundException
{
...
...
bundles/plugins/org.bonitasoft.studio.designer/src/org/bonitasoft/studio/designer/core/resources/WorkspaceServerResource.java
View file @
f7af64aa
...
...
@@ -89,7 +89,8 @@ public class WorkspaceServerResource extends ServerResource {
@Post
(
"text/plain"
)
public
void
dispatch
(
final
String
filePath
)
throws
ResourceNotFoundException
,
LockedResourceException
{
repositoryNotifier
.
dispatch
(
WorkspaceAPIEvent
.
valueOf
(
action
),
toFileStore
(
filePath
));
final
IRepositoryFileStore
fileStore
=
toFileStore
(
filePath
);
repositoryNotifier
.
dispatch
(
WorkspaceAPIEvent
.
valueOf
(
action
),
fileStore
);
}
@Get
...
...
bundles/plugins/org.bonitasoft.studio.engine/src-test/java/org/bonitasoft/studio/engine/BOSEngineManagerTest.java
0 → 100644
View file @
f7af64aa
/**
* Copyright (C) 2015 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.bonitasoft.studio.engine
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
doReturn
;
import
static
org
.
mockito
.
Mockito
.
doThrow
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
org.eclipse.core.runtime.NullProgressMonitor
;
import
org.junit.Test
;
public
class
BOSEngineManagerTest
{
@Test
public
void
should_not_flag_engine_running_state_to_true_if_post_start_fails
()
throws
Exception
{
final
BOSEngineManager
engineManager
=
spy
(
new
BOSEngineManager
(
new
NullProgressMonitor
()));
doReturn
(
false
).
when
(
engineManager
).
tomcatServerIsRunning
();
doThrow
(
Exception
.
class
).
when
(
engineManager
).
getLoginAPI
();
final
boolean
isRunning
=
engineManager
.
postEngineStart
();
assertThat
(
isRunning
).
isFalse
();
}
}
bundles/plugins/org.bonitasoft.studio.engine/src/org/bonitasoft/studio/engine/BOSEngineManager.java
View file @
f7af64aa
/**
* Copyright (C) 2012 Bonita
S
oft S.A.
* Bonita
S
oft, 3
1
rue Gustave Eiffel - 38000 Grenoble
* Copyright (C) 2012
-2015
Bonita
s
oft S.A.
* Bonita
s
oft, 3
2
rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
...
...
@@ -133,13 +133,12 @@ public class BOSEngineManager {
monitor
.
beginTask
(
Messages
.
initializingProcessEngine
,
IProgressMonitor
.
UNKNOWN
);
initBonitaHome
();
BOSWebServerManager
.
getInstance
().
startServer
(
monitor
);
postEngineStart
();
isRunning
=
true
;
isRunning
=
postEngineStart
();
monitor
.
done
();
}
}
protected
void
postEngineStart
()
{
protected
boolean
postEngineStart
()
{
//RESUME ENGINE IF PAUSED AT STARTUP
try
{
final
APISession
apiSession
=
getLoginAPI
().
login
(
BONITA_TECHNICAL_USER
,
BONITA_TECHNICAL_USER_PASSWORD
);
...
...
@@ -147,15 +146,24 @@ public class BOSEngineManager {
if
(
tenantManagementAPI
.
isPaused
())
{
tenantManagementAPI
.
resume
();
}
executePostStartupContributions
();
}
catch
(
final
Exception
e
)
{
BonitaStudioLog
.
error
(
e
);
return
handlePostEngineStartException
(
e
);
}
return
true
;
}
try
{
executePostStartupContributions
();
}
catch
(
final
Exception
e
)
{
private
boolean
handlePostEngineStartException
(
final
Exception
e
)
{
if
(
tomcatServerIsRunning
())
{
BonitaStudioLog
.
error
(
e
);
}
else
{
BonitaStudioLog
.
warning
(
"Tomcat server has been shutdown before first start ended."
,
EnginePlugin
.
PLUGIN_ID
);
}
return
false
;
}
protected
boolean
tomcatServerIsRunning
()
{
return
BOSWebServerManager
.
getInstance
().
serverIsStarted
();
}
public
synchronized
void
stop
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment