Skip to content

Commit 7ab39b4

Browse files
authored
add stop biz state (#1026)
* add stop biz state * update ark version * fix test
1 parent 9c3de26 commit 7ab39b4

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</modules>
1515

1616
<properties>
17-
<sofa.ark.version>2.2.15</sofa.ark.version>
18-
<sofa.ark.version.old>2.2.14</sofa.ark.version.old>
17+
<sofa.ark.version>2.2.16-SNAPSHOT</sofa.ark.version>
18+
<sofa.ark.version.old>2.2.15</sofa.ark.version.old>
1919
<project.encoding>UTF-8</project.encoding>
2020
<java.version>1.8</java.version>
2121
<license.maven.plugin>3.0</license.maven.plugin>

sofa-ark-parent/core-impl/container/src/main/java/com/alipay/sofa/ark/container/model/BizModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public void stop() {
421421
BizManagerService bizManagerService = ArkServiceContainerHolder.getContainer()
422422
.getService(BizManagerService.class);
423423
bizManagerService.unRegisterBiz(bizName, bizVersion);
424-
setBizState(BizState.UNRESOLVED, StateChangeReason.STOPPED);
424+
setBizState(BizState.STOPPED, StateChangeReason.STOPPED);
425425
eventAdminService.sendEvent(new BeforeBizRecycleEvent(this));
426426
urls = null;
427427
denyImportPackages = null;

sofa-ark-parent/core-impl/container/src/test/java/com/alipay/sofa/ark/container/model/BizModelTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void testStopFailedWithClean() {
145145
bizModel.stop();
146146
} catch (RuntimeException e) {
147147
}
148-
assertEquals(BizState.UNRESOLVED, bizModel.getBizState());
148+
assertEquals(BizState.STOPPED, bizModel.getBizState());
149149
}
150150

151151
bizModel.setBizState(BizState.ACTIVATED);
@@ -186,7 +186,7 @@ public void testStopSucceedWithClean() {
186186
mockedStatic.when(ArkServiceContainerHolder::getContainer).thenReturn(arkServiceContainer);
187187
bizModel.stop();
188188

189-
assertEquals(BizState.UNRESOLVED, bizModel.getBizState());
189+
assertEquals(BizState.STOPPED, bizModel.getBizState());
190190
}
191191

192192
bizModel.setBizState(BizState.ACTIVATED);
@@ -201,7 +201,7 @@ public void testStopSucceedWithClean() {
201201
mockedStatic.when(ArkServiceContainerHolder::getContainer).thenReturn(arkServiceContainer);
202202
bizModel.stop();
203203

204-
assertEquals(BizState.UNRESOLVED, bizModel.getBizState());
204+
assertEquals(BizState.STOPPED, bizModel.getBizState());
205205
} finally {
206206
ArkConfigs.putStringValue(AUTO_UNINSTALL_WHEN_FAILED_ENABLE, "true");
207207
}

sofa-ark-parent/core/spi/src/main/java/com/alipay/sofa/ark/spi/model/BizState.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
*/
2525
public enum BizState {
2626
/**
27-
* init but not start install yet
28-
* or
29-
* uninstalled
27+
* not init or not start install yet
3028
*/
3129
UNRESOLVED("unresolved"),
3230
/**
@@ -45,9 +43,14 @@ public enum BizState {
4543
DEACTIVATED("deactivated"),
4644

4745
/**
48-
* install failed.
46+
* install or uninstall failed.
4947
*/
50-
BROKEN("broken");
48+
BROKEN("broken"),
49+
50+
/**
51+
* uninstall succeed
52+
*/
53+
STOPPED("stopped");
5154

5255
private String state;
5356

@@ -73,6 +76,8 @@ public static BizState of(String state) {
7376
return ACTIVATED;
7477
} else if (DEACTIVATED.name().equalsIgnoreCase(state)) {
7578
return DEACTIVATED;
79+
} else if (STOPPED.name().equalsIgnoreCase(state)) {
80+
return STOPPED;
7681
} else {
7782
return BROKEN;
7883
}

0 commit comments

Comments
 (0)