-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
013b0e7
commit b7ae64b
Showing
6 changed files
with
235 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 146 additions & 1 deletion
147
src/test/java/de/tum/cit/ase/ares/integration/ArchitectureSecurityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,156 @@ | ||
package de.tum.cit.ase.ares.integration; | ||
|
||
import de.tum.cit.ase.ares.integration.testuser.ArchitectureSecurityUser; | ||
import de.tum.cit.ase.ares.testutilities.TestTest; | ||
import de.tum.cit.ase.ares.testutilities.UserBased; | ||
import de.tum.cit.ase.ares.testutilities.UserTestResults; | ||
import org.junit.platform.testkit.engine.Events; | ||
|
||
import static de.tum.cit.ase.ares.testutilities.CustomConditions.testFailedWith; | ||
|
||
@UserBased(ArchitectureSecurityUser.class) | ||
public class ArchitectureSecurityTest { | ||
// TODO Sarp: Implement tests | ||
|
||
@UserTestResults | ||
private static Events tests; | ||
|
||
// <editor-fold desc="File System Rules"> | ||
@TestTest | ||
void testArchUnitFileAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitFileAccess", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaFileAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaFileAccess", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Network Rules"> | ||
@TestTest | ||
void testArchUnitNetworkAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitNetworkAccess", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaNetworkAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaNetworkAccess", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Command Execution Rules"> | ||
@TestTest | ||
void testArchUnitCommandExecution() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitCommandExecution", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaCommandExecution() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaCommandExecution", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Thread Creation Rules"> | ||
@TestTest | ||
void testArchUnitThreadCreation() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitThreadCreation", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaThreadCreation() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWaLaThreadCreation", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Package Import Rules"> | ||
@TestTest | ||
void testArchUnitPackageImport() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitPackageImport", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaPackageImport() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaPackageImport", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="JVMTermination Rules"> | ||
@TestTest | ||
void testArchUnitJVMTermination() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitJVMTermination", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaJVMTermination() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaJVMTermination", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Reflection Rules"> | ||
@TestTest | ||
void testArchUnitReflection() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitReflection", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaReflection() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaReflection", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Serialization Rules"> | ||
@TestTest | ||
void testArchUnitSerialization() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitSerialization", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaSerialization() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaSerialization", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Classloading Rules"> | ||
@TestTest | ||
void testArchUnitClassloading() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitClassloading", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaClassloading() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaClassloading", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
|
||
// <editor-fold desc="Third Party Package Access Rules"> | ||
@TestTest | ||
void testArchUnitThirdPartyPackageAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testArchUnitThirdPartyPackageAccess", SecurityException.class)); | ||
} | ||
|
||
@TestTest | ||
void testWalaThirdPartyPackageAccess() { | ||
tests.assertThatEvents().haveExactly(1, | ||
testFailedWith("testWalaThirdPartyPackageAccess", SecurityException.class)); | ||
} | ||
// </editor-fold> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...es/integration/testuser/subject/architectureTests/packageImport/PackageImportPenguin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.tum.cit.ase.ares.integration.testuser.subject.architectureTests.packageImport; | ||
|
||
import ch.qos.logback.core.FileAppender; | ||
|
||
import java.io.IOException; | ||
|
||
public class PackageImportPenguin { | ||
|
||
void accessPathThroughThirdPartyPackage() throws IOException { | ||
FileAppender fileAppender = new FileAppender(); | ||
fileAppender.openFile("path/to/file"); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ct/architectureTests/student/Student.java → ...dPartyAccess/ThirdPartyAccessPenguin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...tegration/testuser/subject/architectureTests/thread_manipulation/ThreadAccessPenguin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
package de.tum.cit.ase.ares.integration.testuser.subject.architectureTests.thread_manipulation; | ||
|
||
public class ThreadAccessPenguin { | ||
|
||
void createThread() { | ||
Thread thread = new Thread(); | ||
thread.start(); | ||
} | ||
} |