Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z_stack
Activiti
提交
104dc002
A
Activiti
项目概览
z_stack
/
Activiti
10 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Activiti
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
104dc002
编写于
10月 19, 2018
作者:
E
Elias Ricken de Medeiros
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Import processes from application zip file
上级
9fa8deee
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
637 addition
and
0 deletion
+637
-0
activiti-core-common-dependencies/pom.xml
activiti-core-common-dependencies/pom.xml
+5
-0
activiti-spring-application/pom.xml
activiti-spring-application/pom.xml
+53
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationContent.java
...ain/java/org/activiti/application/ApplicationContent.java
+39
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationDiscovery.java
...n/java/org/activiti/application/ApplicationDiscovery.java
+49
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationEntry.java
.../main/java/org/activiti/application/ApplicationEntry.java
+39
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationEntryDiscovery.java
...a/org/activiti/application/ApplicationEntryDiscovery.java
+28
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationLoader.java
...main/java/org/activiti/application/ApplicationLoader.java
+51
-0
activiti-spring-application/src/main/java/org/activiti/application/ApplicationReader.java
...main/java/org/activiti/application/ApplicationReader.java
+68
-0
activiti-spring-application/src/main/java/org/activiti/application/FileContent.java
...n/src/main/java/org/activiti/application/FileContent.java
+39
-0
activiti-spring-application/src/main/java/org/activiti/application/conf/ApplicationAutoConfiguration.java
...tiviti/application/conf/ApplicationAutoConfiguration.java
+49
-0
activiti-spring-application/src/main/java/org/activiti/application/deployer/ApplicationDeployer.java
...rg/activiti/application/deployer/ApplicationDeployer.java
+45
-0
activiti-spring-application/src/main/java/org/activiti/application/deployer/ApplicationEntryDeployer.java
...tiviti/application/deployer/ApplicationEntryDeployer.java
+25
-0
activiti-spring-application/src/main/resources/META-INF/spring.factories
...-application/src/main/resources/META-INF/spring.factories
+4
-0
activiti-spring-application/src/test/java/org/activiti/application/ApplicationLoaderTest.java
.../java/org/activiti/application/ApplicationLoaderTest.java
+67
-0
activiti-spring-application/src/test/java/org/activiti/application/deployer/ApplicationDeployerTest.java
...ctiviti/application/deployer/ApplicationDeployerTest.java
+69
-0
pom.xml
pom.xml
+7
-0
未找到文件。
activiti-core-common-dependencies/pom.xml
浏览文件 @
104dc002
...
...
@@ -33,6 +33,11 @@
<artifactId>
activiti-connector-model
</artifactId>
<version>
${activiti-core-common.version}
</version>
</dependency>
<dependency>
<groupId>
org.activiti.core.common
</groupId>
<artifactId>
activiti-spring-application
</artifactId>
<version>
${activiti-core-common.version}
</version>
</dependency>
<dependency>
<groupId>
org.activiti.core.common
</groupId>
<artifactId>
activiti-spring-connector
</artifactId>
...
...
activiti-spring-application/pom.xml
0 → 100644
浏览文件 @
104dc002
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2018 Alfresco, Inc. and/or its affiliates.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.activiti.core.common
</groupId>
<artifactId>
activiti-core-common-parent
</artifactId>
<version>
7.0.0-SNAPSHOT
</version>
</parent>
<artifactId>
activiti-spring-application
</artifactId>
<name>
Activiti Core Common :: Application
</name>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context
</artifactId>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
activiti-spring-application/src/main/java/org/activiti/application/ApplicationContent.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
ApplicationContent
{
private
Map
<
String
,
List
<
FileContent
>>
entries
=
new
HashMap
<>();
public
void
add
(
ApplicationEntry
entry
)
{
List
<
FileContent
>
fileContents
=
entries
.
computeIfAbsent
(
entry
.
getType
(),
k
->
new
ArrayList
<>());
fileContents
.
add
(
entry
.
getFileContent
());
}
public
List
<
FileContent
>
getFileContents
(
String
entryType
)
{
return
entries
.
getOrDefault
(
entryType
,
Collections
.
emptyList
());
}
}
activiti-spring-application/src/main/java/org/activiti/application/ApplicationDiscovery.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
public
class
ApplicationDiscovery
{
private
static
final
String
APPLICATIONS_LOCATION
=
"classpath:/applications/"
;
private
ResourcePatternResolver
resourceLoader
;
public
ApplicationDiscovery
(
ResourcePatternResolver
resourceLoader
)
{
this
.
resourceLoader
=
resourceLoader
;
}
public
List
<
Resource
>
discoverApplications
()
{
List
<
Resource
>
resources
=
new
ArrayList
<>();
Resource
resource
=
resourceLoader
.
getResource
(
APPLICATIONS_LOCATION
);
if
(
resource
.
exists
())
{
try
{
resources
=
Arrays
.
asList
(
resourceLoader
.
getResources
(
APPLICATIONS_LOCATION
+
"**.zip"
));
}
catch
(
IOException
e
)
{
//fixme
e
.
printStackTrace
();
}
}
return
resources
;
}
}
activiti-spring-application/src/main/java/org/activiti/application/ApplicationEntry.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
public
class
ApplicationEntry
{
private
String
type
;
private
FileContent
fileContent
;
public
ApplicationEntry
(
String
type
,
FileContent
fileContent
)
{
this
.
type
=
type
;
this
.
fileContent
=
fileContent
;
}
public
String
getType
()
{
return
type
;
}
public
FileContent
getFileContent
()
{
return
fileContent
;
}
}
activiti-spring-application/src/main/java/org/activiti/application/ApplicationEntryDiscovery.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.util.function.Predicate
;
import
java.util.zip.ZipEntry
;
public
interface
ApplicationEntryDiscovery
{
Predicate
<
ZipEntry
>
filter
(
ZipEntry
entry
);
String
getEntryType
();
}
activiti-spring-application/src/main/java/org/activiti/application/ApplicationLoader.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.core.io.Resource
;
public
class
ApplicationLoader
{
private
ApplicationDiscovery
applicationDiscovery
;
private
ApplicationReader
applicationReader
;
public
ApplicationLoader
(
ApplicationDiscovery
applicationDiscovery
,
ApplicationReader
applicationReader
)
{
this
.
applicationDiscovery
=
applicationDiscovery
;
this
.
applicationReader
=
applicationReader
;
}
public
List
<
ApplicationContent
>
loadApplications
(){
List
<
ApplicationContent
>
applications
=
new
ArrayList
<>();
List
<
Resource
>
applicationResources
=
applicationDiscovery
.
discoverApplications
();
for
(
Resource
applicationResource
:
applicationResources
)
{
try
(
InputStream
inputStream
=
applicationResource
.
getInputStream
())
{
applications
.
add
(
applicationReader
.
read
(
inputStream
));
}
catch
(
IOException
e
)
{
//fixme
e
.
printStackTrace
();
}
}
return
applications
;
}
}
activiti-spring-application/src/main/java/org/activiti/application/ApplicationReader.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
org.apache.commons.io.IOUtils
;
public
class
ApplicationReader
{
private
List
<
ApplicationEntryDiscovery
>
applicationEntryDiscoveries
;
public
ApplicationReader
(
List
<
ApplicationEntryDiscovery
>
applicationEntryDiscoveries
)
{
this
.
applicationEntryDiscoveries
=
applicationEntryDiscoveries
;
}
public
ApplicationContent
read
(
InputStream
inputStream
)
{
ApplicationContent
application
=
new
ApplicationContent
();
try
(
ZipInputStream
zipInputStream
=
new
ZipInputStream
(
inputStream
))
{
ZipEntry
zipEntry
;
while
((
zipEntry
=
zipInputStream
.
getNextEntry
())
!=
null
)
{
ZipEntry
currentEntry
=
zipEntry
;
applicationEntryDiscoveries
.
stream
()
.
filter
(
applicationEntryDiscovery
->
applicationEntryDiscovery
.
filter
(
currentEntry
).
test
(
currentEntry
))
.
findFirst
()
.
ifPresent
(
applicationEntryDiscovery
->
application
.
add
(
new
ApplicationEntry
(
applicationEntryDiscovery
.
getEntryType
(),
new
FileContent
(
currentEntry
.
getName
(),
readBytes
(
zipInputStream
)))));
}
}
catch
(
IOException
e
)
{
//fixme
e
.
printStackTrace
();
}
return
application
;
}
private
byte
[]
readBytes
(
ZipInputStream
zipInputStream
)
{
try
{
return
IOUtils
.
toByteArray
(
zipInputStream
);
}
catch
(
IOException
e
)
{
//fixme
e
.
printStackTrace
();
}
return
null
;
}
}
activiti-spring-application/src/main/java/org/activiti/application/FileContent.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
public
class
FileContent
{
private
String
name
;
private
byte
[]
content
;
public
FileContent
(
String
name
,
byte
[]
content
)
{
this
.
name
=
name
;
this
.
content
=
content
;
}
public
String
getName
()
{
return
name
;
}
public
byte
[]
getContent
()
{
return
content
;
}
}
activiti-spring-application/src/main/java/org/activiti/application/conf/ApplicationAutoConfiguration.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application.conf
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Optional
;
import
org.activiti.application.ApplicationDiscovery
;
import
org.activiti.application.ApplicationEntryDiscovery
;
import
org.activiti.application.ApplicationLoader
;
import
org.activiti.application.ApplicationReader
;
import
org.activiti.application.deployer.ApplicationDeployer
;
import
org.activiti.application.deployer.ApplicationEntryDeployer
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
@Configuration
public
class
ApplicationAutoConfiguration
{
@Bean
public
InitializingBean
deployApplications
(
ResourcePatternResolver
resourceLoader
,
@Autowired
(
required
=
false
)
List
<
ApplicationEntryDiscovery
>
applicationEntryDiscoveries
,
@Autowired
(
required
=
false
)
List
<
ApplicationEntryDeployer
>
applicationEntryDeployers
)
{
return
()
->
new
ApplicationDeployer
(
new
ApplicationLoader
(
new
ApplicationDiscovery
(
resourceLoader
),
new
ApplicationReader
(
Optional
.
ofNullable
(
applicationEntryDiscoveries
)
.
orElse
(
Collections
.
emptyList
()))),
Optional
.
ofNullable
(
applicationEntryDeployers
)
.
orElse
(
Collections
.
emptyList
())).
deploy
();
}
}
activiti-spring-application/src/main/java/org/activiti/application/deployer/ApplicationDeployer.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application.deployer
;
import
java.util.List
;
import
org.activiti.application.ApplicationContent
;
import
org.activiti.application.ApplicationLoader
;
public
class
ApplicationDeployer
{
private
ApplicationLoader
applicationLoader
;
private
List
<
ApplicationEntryDeployer
>
deployers
;
public
ApplicationDeployer
(
ApplicationLoader
applicationLoader
,
List
<
ApplicationEntryDeployer
>
deployers
)
{
this
.
applicationLoader
=
applicationLoader
;
this
.
deployers
=
deployers
;
}
public
void
deploy
()
{
List
<
ApplicationContent
>
applications
=
applicationLoader
.
loadApplications
();
for
(
ApplicationContent
application
:
applications
)
{
for
(
ApplicationEntryDeployer
deployer
:
deployers
)
{
deployer
.
deployEntries
(
application
);
}
}
}
}
activiti-spring-application/src/main/java/org/activiti/application/deployer/ApplicationEntryDeployer.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application.deployer
;
import
org.activiti.application.ApplicationContent
;
public
interface
ApplicationEntryDeployer
{
void
deployEntries
(
ApplicationContent
application
);
}
activiti-spring-application/src/main/resources/META-INF/spring.factories
0 → 100644
浏览文件 @
104dc002
# Activiti auto-configurations
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.activiti.application.conf.ApplicationAutoConfiguration
\ No newline at end of file
activiti-spring-application/src/test/java/org/activiti/application/ApplicationLoaderTest.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application
;
import
java.io.InputStream
;
import
java.util.Collections
;
import
java.util.List
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.mockito.InjectMocks
;
import
org.mockito.Mock
;
import
org.springframework.core.io.Resource
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
MockitoAnnotations
.
initMocks
;
public
class
ApplicationLoaderTest
{
@InjectMocks
private
ApplicationLoader
loader
;
@Mock
private
ApplicationDiscovery
applicationDiscovery
;
@Mock
private
ApplicationReader
applicationReader
;
@Before
public
void
setUp
()
{
initMocks
(
this
);
}
@Test
public
void
shouldLoadApplications
()
throws
Exception
{
//given
Resource
applicationResource
=
mock
(
Resource
.
class
);
given
(
applicationResource
.
getInputStream
()).
willReturn
(
mock
(
InputStream
.
class
));
given
(
applicationDiscovery
.
discoverApplications
()).
willReturn
(
Collections
.
singletonList
(
applicationResource
));
ApplicationContent
applicationContent
=
new
ApplicationContent
();
given
(
applicationReader
.
read
(
applicationResource
.
getInputStream
())).
willReturn
(
applicationContent
);
//when
List
<
ApplicationContent
>
applicationContents
=
loader
.
loadApplications
();
//then
assertThat
(
applicationContents
).
containsExactly
(
applicationContent
);
}
}
\ No newline at end of file
activiti-spring-application/src/test/java/org/activiti/application/deployer/ApplicationDeployerTest.java
0 → 100644
浏览文件 @
104dc002
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.application.deployer
;
import
java.util.Arrays
;
import
org.activiti.application.ApplicationContent
;
import
org.activiti.application.ApplicationLoader
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.mockito.Mock
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
MockitoAnnotations
.
initMocks
;
public
class
ApplicationDeployerTest
{
private
ApplicationDeployer
deployer
;
@Mock
private
ApplicationLoader
applicationLoader
;
@Mock
private
ApplicationEntryDeployer
firstDeployer
;
@Mock
private
ApplicationEntryDeployer
secondDeployer
;
@Before
public
void
setUp
()
{
initMocks
(
this
);
deployer
=
new
ApplicationDeployer
(
applicationLoader
,
Arrays
.
asList
(
firstDeployer
,
secondDeployer
));
}
@Test
public
void
shouldDelegateDeployToEntryDeployers
()
{
//given
ApplicationContent
firstApp
=
mock
(
ApplicationContent
.
class
);
ApplicationContent
secondApp
=
mock
(
ApplicationContent
.
class
);
given
(
applicationLoader
.
loadApplications
()).
willReturn
(
Arrays
.
asList
(
firstApp
,
secondApp
));
//when
deployer
.
deploy
();
//then
verify
(
firstDeployer
).
deployEntries
(
firstApp
);
verify
(
firstDeployer
).
deployEntries
(
secondApp
);
verify
(
secondDeployer
).
deployEntries
(
firstApp
);
verify
(
secondDeployer
).
deployEntries
(
secondApp
);
}
}
\ No newline at end of file
pom.xml
浏览文件 @
104dc002
...
...
@@ -19,6 +19,7 @@
<activiti-build.version>
7.0.39
</activiti-build.version>
<activiti-api.version>
7.0.34
</activiti-api.version>
<activiti-core-common.version>
${project.version}
</activiti-core-common.version>
<commons-io.version>
2.6
</commons-io.version>
</properties>
<dependencyManagement>
<dependencies>
...
...
@@ -36,6 +37,11 @@
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
${commons-io.version}
</version>
</dependency>
<!-- Activiti Modules for managed dependencies -->
<!-- This duplicates activiti-core-common-dependencies module but we can't import that module here as this is its parent-->
<dependency>
...
...
@@ -73,6 +79,7 @@
<module>
activiti-spring-connector
</module>
<module>
activiti-connector-model
</module>
<module>
activiti-core-common-dependencies
</module>
<module>
activiti-spring-application
</module>
</modules>
<repositories>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录