Skip to content

Commit eff53b3

Browse files
committed
release ArchUnit 0.15.0
1 parent 58ddddb commit eff53b3

File tree

15 files changed

+90
-15
lines changed

15 files changed

+90
-15
lines changed

example-junit4/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dependencies {
2-
testImplementation 'com.tngtech.archunit:archunit-junit4:0.14.1'
2+
testImplementation 'com.tngtech.archunit:archunit-junit4:0.15.0'
33
}

example-junit4/src/main/java/com/tngtech/archunit/example/layers/persistence/second/dao/jpa/OtherJpa.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.tngtech.archunit.example.layers.persistence.second.dao.OtherDao;
1010
import com.tngtech.archunit.example.layers.persistence.second.dao.domain.OtherPersistentObject;
1111
import com.tngtech.archunit.example.layers.security.Secured;
12+
import com.tngtech.archunit.example.layers.service.ProxiedConnection;
1213

1314
public class OtherJpa implements OtherDao {
1415
@PersistenceContext
@@ -22,6 +23,9 @@ public OtherPersistentObject findById(long id) {
2223
@Override
2324
public void testConnection() throws SQLException {
2425
Connection conn = entityManager.unwrap(Connection.class);
26+
if (conn instanceof ProxiedConnection) {
27+
((ProxiedConnection) conn).refresh();
28+
}
2529
conn.prepareStatement("SELECT 1 FROM DUAL");
2630
}
2731

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.tngtech.archunit.example.layers.service;
2+
3+
public interface ProxiedConnection {
4+
void refresh();
5+
}

example-junit4/src/main/java/com/tngtech/archunit/example/layers/service/ServiceHelper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package com.tngtech.archunit.example.layers.service;
22

3+
import java.util.Map;
4+
import java.util.Set;
5+
6+
import com.tngtech.archunit.example.layers.controller.SomeUtility;
7+
import com.tngtech.archunit.example.layers.controller.one.SomeEnum;
38
import com.tngtech.archunit.example.layers.security.Secured;
49

510
/**
611
* Well modelled code always has lots of 'helpers' ;-)
712
*/
8-
public class ServiceHelper {
13+
@SuppressWarnings("unused")
14+
public class ServiceHelper<
15+
TYPE_PARAMETER_VIOLATING_LAYER_RULE extends SomeUtility,
16+
ANOTHER_TYPE_PARAMETER_VIOLATING_LAYER_RULE extends Map<?, Set<? super SomeEnum>>> {
17+
918
public Object insecure = new Object();
1019
@Secured
1120
public Object properlySecured = new Object();

example-junit4/src/main/java/com/tngtech/archunit/example/layers/service/ServiceViolatingLayerRules.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.tngtech.archunit.example.layers.controller.two.UseCaseTwoController;
1010
import com.tngtech.archunit.example.layers.security.Secured;
1111

12+
@SuppressWarnings("unused")
1213
@MyService
1314
@ComplexServiceAnnotation(
1415
controllerAnnotation = @ComplexControllerAnnotation(simpleControllerAnnotation = @SimpleControllerAnnotation),
@@ -17,9 +18,6 @@
1718
serviceType = ServiceType.STANDARD
1819
)
1920
public class ServiceViolatingLayerRules {
20-
public static final String illegalAccessToController = "illegalAccessToController";
21-
public static final String doSomething = "doSomething";
22-
public static final String dependentMethod = "dependentMethod";
2321

2422
void illegalAccessToController() {
2523
System.out.println(UseCaseOneTwoController.someString);
@@ -34,7 +32,16 @@ public SomeGuiController dependentMethod(UseCaseTwoController otherController) {
3432
return null;
3533
}
3634

35+
public SomeGuiController[][] dependentOnComponentTypeMethod(UseCaseTwoController[] otherController) {
36+
return null;
37+
}
38+
3739
@Secured
3840
public void properlySecured() {
3941
}
42+
43+
public static final String illegalAccessToController = "illegalAccessToController";
44+
public static final String doSomething = "doSomething";
45+
public static final String dependentMethod = "dependentMethod";
46+
public static final String dependentOnComponentTypeMethod = "dependentOnComponentTypeMethod";
4047
}

example-junit5/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dependencies {
2-
testImplementation 'com.tngtech.archunit:archunit-junit5:0.14.1'
2+
testImplementation 'com.tngtech.archunit:archunit-junit5:0.15.0'
33
}
44

55
test {

example-junit5/src/main/java/com/tngtech/archunit/example/layers/persistence/second/dao/jpa/OtherJpa.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.tngtech.archunit.example.layers.persistence.second.dao.OtherDao;
1010
import com.tngtech.archunit.example.layers.persistence.second.dao.domain.OtherPersistentObject;
1111
import com.tngtech.archunit.example.layers.security.Secured;
12+
import com.tngtech.archunit.example.layers.service.ProxiedConnection;
1213

1314
public class OtherJpa implements OtherDao {
1415
@PersistenceContext
@@ -22,6 +23,9 @@ public OtherPersistentObject findById(long id) {
2223
@Override
2324
public void testConnection() throws SQLException {
2425
Connection conn = entityManager.unwrap(Connection.class);
26+
if (conn instanceof ProxiedConnection) {
27+
((ProxiedConnection) conn).refresh();
28+
}
2529
conn.prepareStatement("SELECT 1 FROM DUAL");
2630
}
2731

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.tngtech.archunit.example.layers.service;
2+
3+
public interface ProxiedConnection {
4+
void refresh();
5+
}

example-junit5/src/main/java/com/tngtech/archunit/example/layers/service/ServiceHelper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package com.tngtech.archunit.example.layers.service;
22

3+
import java.util.Map;
4+
import java.util.Set;
5+
6+
import com.tngtech.archunit.example.layers.controller.SomeUtility;
7+
import com.tngtech.archunit.example.layers.controller.one.SomeEnum;
38
import com.tngtech.archunit.example.layers.security.Secured;
49

510
/**
611
* Well modelled code always has lots of 'helpers' ;-)
712
*/
8-
public class ServiceHelper {
13+
@SuppressWarnings("unused")
14+
public class ServiceHelper<
15+
TYPE_PARAMETER_VIOLATING_LAYER_RULE extends SomeUtility,
16+
ANOTHER_TYPE_PARAMETER_VIOLATING_LAYER_RULE extends Map<?, Set<? super SomeEnum>>> {
17+
918
public Object insecure = new Object();
1019
@Secured
1120
public Object properlySecured = new Object();

example-junit5/src/main/java/com/tngtech/archunit/example/layers/service/ServiceViolatingLayerRules.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.tngtech.archunit.example.layers.controller.two.UseCaseTwoController;
1010
import com.tngtech.archunit.example.layers.security.Secured;
1111

12+
@SuppressWarnings("unused")
1213
@MyService
1314
@ComplexServiceAnnotation(
1415
controllerAnnotation = @ComplexControllerAnnotation(simpleControllerAnnotation = @SimpleControllerAnnotation),
@@ -17,9 +18,6 @@
1718
serviceType = ServiceType.STANDARD
1819
)
1920
public class ServiceViolatingLayerRules {
20-
public static final String illegalAccessToController = "illegalAccessToController";
21-
public static final String doSomething = "doSomething";
22-
public static final String dependentMethod = "dependentMethod";
2321

2422
void illegalAccessToController() {
2523
System.out.println(UseCaseOneTwoController.someString);
@@ -34,7 +32,16 @@ public SomeGuiController dependentMethod(UseCaseTwoController otherController) {
3432
return null;
3533
}
3634

35+
public SomeGuiController[][] dependentOnComponentTypeMethod(UseCaseTwoController[] otherController) {
36+
return null;
37+
}
38+
3739
@Secured
3840
public void properlySecured() {
3941
}
42+
43+
public static final String illegalAccessToController = "illegalAccessToController";
44+
public static final String doSomething = "doSomething";
45+
public static final String dependentMethod = "dependentMethod";
46+
public static final String dependentOnComponentTypeMethod = "dependentOnComponentTypeMethod";
4047
}

0 commit comments

Comments
 (0)