|
8 | 8 |
|
9 | 9 | public class ClassInfoTest {
|
10 | 10 |
|
| 11 | + @Test |
| 12 | + public void getBeanInfo() throws Exception { |
| 13 | + final WithDeploymentAnnotation withDeploymentAnnotation = new WithDeploymentAnnotation(); |
| 14 | + |
| 15 | + final ClassInfo beanInfo = beanInfo(withDeploymentAnnotation); |
| 16 | + |
| 17 | + assertThat(beanInfo.getBean()).isEqualTo(withDeploymentAnnotation); |
| 18 | + assertThat(beanInfo.getBeanName()).isEqualTo("withDeploymentAnnotation"); |
| 19 | + assertThat(beanInfo.getTargetClass()).isEqualTo(WithDeploymentAnnotation.class); |
| 20 | + } |
| 21 | + |
| 22 | + @Test |
| 23 | + public void hasZeebeeDeploymentAnnotation() throws Exception { |
| 24 | + assertThat(beanInfo(new WithDeploymentAnnotation()).hasClassAnnotation(Deployment.class)) |
| 25 | + .isTrue(); |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + public void hasNoZeebeeDeploymentAnnotation() throws Exception { |
| 30 | + assertThat(beanInfo(new WithoutDeploymentAnnotation()).hasClassAnnotation(Deployment.class)) |
| 31 | + .isFalse(); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void hasZeebeWorkerMethod() throws Exception { |
| 36 | + assertThat(beanInfo(new WithZeebeWorker()).hasMethodAnnotation(JobWorker.class)).isTrue(); |
| 37 | + } |
| 38 | + |
| 39 | + @Test |
| 40 | + public void hasNotZeebeWorkerMethod() throws Exception { |
| 41 | + assertThat(beanInfo("normal String").hasMethodAnnotation(JobWorker.class)).isFalse(); |
| 42 | + } |
| 43 | + |
| 44 | + private ClassInfo beanInfo(final Object bean) { |
| 45 | + return ClassInfo.builder() |
| 46 | + .bean(bean) |
| 47 | + .beanName(Introspector.decapitalize(bean.getClass().getSimpleName())) |
| 48 | + .build(); |
| 49 | + } |
| 50 | + |
11 | 51 | @Deployment(resources = "classpath*:/1.bpmn")
|
12 | 52 | public static class WithDeploymentAnnotation {}
|
13 | 53 |
|
@@ -45,57 +85,22 @@ public void handle(@Variable String var1, @Variable int var2) {}
|
45 | 85 | }
|
46 | 86 |
|
47 | 87 | public static class WithZeebeWorkerVariablesComplexType {
|
| 88 | + @JobWorker(type = "bar", timeout = 100L, fetchVariables = "var2", autoComplete = false) |
| 89 | + public void handle(@Variable String var1, @Variable ComplexTypeDTO var2) {} |
| 90 | + |
48 | 91 | public static class ComplexTypeDTO {
|
49 | 92 | private String var1;
|
50 | 93 | private String var2;
|
51 | 94 | }
|
52 |
| - |
53 |
| - @JobWorker(type = "bar", timeout = 100L, fetchVariables = "var2", autoComplete = false) |
54 |
| - public void handle(@Variable String var1, @Variable ComplexTypeDTO var2) {} |
55 | 95 | }
|
56 | 96 |
|
57 | 97 | public static class NoPropertiesSet {
|
58 | 98 | @JobWorker
|
59 | 99 | public void handle() {}
|
60 | 100 | }
|
61 | 101 |
|
62 |
| - @Test |
63 |
| - public void getBeanInfo() throws Exception { |
64 |
| - final WithDeploymentAnnotation withDeploymentAnnotation = new WithDeploymentAnnotation(); |
65 |
| - |
66 |
| - final ClassInfo beanInfo = beanInfo(withDeploymentAnnotation); |
67 |
| - |
68 |
| - assertThat(beanInfo.getBean()).isEqualTo(withDeploymentAnnotation); |
69 |
| - assertThat(beanInfo.getBeanName()).isEqualTo("withDeploymentAnnotation"); |
70 |
| - assertThat(beanInfo.getTargetClass()).isEqualTo(WithDeploymentAnnotation.class); |
71 |
| - } |
72 |
| - |
73 |
| - @Test |
74 |
| - public void hasZeebeeDeploymentAnnotation() throws Exception { |
75 |
| - assertThat(beanInfo(new WithDeploymentAnnotation()).hasClassAnnotation(Deployment.class)) |
76 |
| - .isTrue(); |
77 |
| - } |
78 |
| - |
79 |
| - @Test |
80 |
| - public void hasNoZeebeeDeploymentAnnotation() throws Exception { |
81 |
| - assertThat(beanInfo(new WithoutDeploymentAnnotation()).hasClassAnnotation(Deployment.class)) |
82 |
| - .isFalse(); |
83 |
| - } |
84 |
| - |
85 |
| - @Test |
86 |
| - public void hasZeebeWorkerMethod() throws Exception { |
87 |
| - assertThat(beanInfo(new WithZeebeWorker()).hasMethodAnnotation(JobWorker.class)).isTrue(); |
88 |
| - } |
89 |
| - |
90 |
| - @Test |
91 |
| - public void hasNotZeebeWorkerMethod() throws Exception { |
92 |
| - assertThat(beanInfo("normal String").hasMethodAnnotation(JobWorker.class)).isFalse(); |
93 |
| - } |
94 |
| - |
95 |
| - private ClassInfo beanInfo(final Object bean) { |
96 |
| - return ClassInfo.builder() |
97 |
| - .bean(bean) |
98 |
| - .beanName(Introspector.decapitalize(bean.getClass().getSimpleName())) |
99 |
| - .build(); |
| 102 | + public static class TenantBound { |
| 103 | + @JobWorker(tenantIds = "tenant-1") |
| 104 | + public void handle() {} |
100 | 105 | }
|
101 | 106 | }
|
0 commit comments