Big refactoring #77

Merged
flecomte merged 166 commits from refactoring-component-and-immutable into master 2021-03-24 19:06:07 +01:00
40 changed files with 160 additions and 66 deletions
Showing only changes of commit 459397f8e7 - Show all commits

30
.idea/runConfigurations/All_Tests.xml generated Normal file
View File

@@ -0,0 +1,30 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All Tests" type="JUnit" factoryName="JUnit" show_console_on_std_err="true">
<output_file path="$PROJECT_DIR$/var/log/test/out.log" is_save="true" />
<useClassPathOnly />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="corretto-11" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="pattern" />
<option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" />
<option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs>
<env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" />
</envs>
<dir value="$PROJECT_DIR$" />
<patterns>
<pattern testClass="unit..*" />
<pattern testClass="functional..*" />
<pattern testClass="CucumberTest" />
</patterns>
<tag value="!functional" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@article&quot; -Dstrict" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@article&quot; -Dstrict" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@auth&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@auth&quot;" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@citizen&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@citizen&quot;" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@comment&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@comment&quot;" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@constitution&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@constitution&quot;" />

View File

@@ -1,10 +1,10 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Cucumber Tests" type="JUnit" factoryName="JUnit"> <configuration default="false" name="Cucumber Tests" type="JUnit" factoryName="JUnit">
<output_file path="$PROJECT_DIR$/var/log/test/cucumber.out.log" /> <output_file path="$PROJECT_DIR$/var/log/test/cucumber.out.log" is_save="true" />
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" /> <option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot; not @online&quot; -Djdk.attach.allowAttachSelf=true" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot; not @online&quot; -Djdk.attach.allowAttachSelf=true" />

View File

@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Cucumber with tag @now" type="JUnit" factoryName="JUnit" show_console_on_std_err="true">
<output_file path="$PROJECT_DIR$/var/log/test/out.log" is_save="true" />
<module name="dcproject.test" />
<useClassPathOnly />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@now&quot; -Djdk.attach.allowAttachSelf=true" />
<option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs>
<env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" />
</envs>
<dir value="$PROJECT_DIR$" />
<tag value="!online" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@follow&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@follow&quot;" />

View File

@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Functional Tests" type="JUnit" factoryName="JUnit" show_console_on_std_err="true">
<output_file path="$PROJECT_DIR$/var/log/test/out.log" is_save="true" />
<useClassPathOnly />
<option name="PACKAGE_NAME" value="fr.dcproject" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="tags" />
<option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" />
<option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs>
<env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" />
</envs>
<dir value="$PROJECT_DIR$" />
<tag value="functional" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@error&quot; -Dstrict" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@error&quot; -Dstrict" />

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@opinion&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@opinion&quot;" />

View File

@@ -5,7 +5,7 @@
<option name="PACKAGE_NAME" value="fr.dcproject" /> <option name="PACKAGE_NAME" value="fr.dcproject" />
<option name="MAIN_CLASS_NAME" value="" /> <option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" /> <option name="TEST_OBJECT" value="tags" />
<option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" /> <option name="VM_PARAMETERS" value="-ea -Djdk.attach.allowAttachSelf=true" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE"> <option name="TEST_SEARCH_SCOPE">
@@ -15,6 +15,7 @@
<env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" /> <env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" />
</envs> </envs>
<dir value="$PROJECT_DIR$" /> <dir value="$PROJECT_DIR$" />
<tag value="!functional" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>

View File

@@ -4,7 +4,7 @@
<module name="dcproject.test" /> <module name="dcproject.test" />
<useClassPathOnly /> <useClassPathOnly />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@vote&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@vote&quot;" />

View File

@@ -10,7 +10,7 @@
</pattern> </pattern>
</extension> </extension>
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" /> <option name="MAIN_CLASS_NAME" value="CucumberTest" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@workgroup&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@workgroup&quot;" />

View File

@@ -68,6 +68,7 @@ val sourcesJar by tasks.creating(Jar::class) {
tasks.test { tasks.test {
useJUnit() useJUnit()
useJUnitPlatform() useJUnitPlatform()
systemProperty("junit.jupiter.execution.parallel.enabled", true)
// maxHeapSize = "1G" // maxHeapSize = "1G"
} }

View File

@@ -1,4 +1,3 @@
import feature.KtorServerContext
import fr.dcproject.Config import fr.dcproject.Config
import fr.dcproject.Env.CUCUMBER import fr.dcproject.Env.CUCUMBER
import fr.dcproject.module import fr.dcproject.module
@@ -10,23 +9,20 @@ import io.cucumber.java8.En
import io.cucumber.java8.Scenario import io.cucumber.java8.Scenario
import io.cucumber.junit.Cucumber import io.cucumber.junit.Cucumber
import io.cucumber.junit.CucumberOptions import io.cucumber.junit.CucumberOptions
import io.ktor.locations.KtorExperimentalLocationsAPI import io.ktor.server.testing.*
import io.ktor.server.testing.withTestApplication
import io.ktor.util.KtorExperimentalAPI
import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.koin.test.KoinTest import org.koin.test.KoinTest
import org.koin.test.get import org.koin.test.get
import org.slf4j.Logger import org.slf4j.Logger
import steps.KtorServerContext
var unitialized: Boolean = false var unitialized: Boolean = false
@InternalCoroutinesApi @InternalCoroutinesApi
@KtorExperimentalAPI
@KtorExperimentalLocationsAPI
@RunWith(Cucumber::class) @RunWith(Cucumber::class)
@CucumberOptions(plugin = ["pretty"], strict = true) @CucumberOptions(plugin = ["pretty"], strict = true)
class RunCucumberTest : En, KoinTest { class CucumberTest : En, KoinTest {
private val logger: Logger? by LoggerDelegate() private val logger: Logger? by LoggerDelegate()
@InternalCoroutinesApi @InternalCoroutinesApi

View File

@@ -1,12 +1,14 @@
package functional
import com.sendgrid.helpers.mail.Mail import com.sendgrid.helpers.mail.Mail
import com.sendgrid.helpers.mail.objects.Content import com.sendgrid.helpers.mail.objects.Content
import com.sendgrid.helpers.mail.objects.Email import com.sendgrid.helpers.mail.objects.Email
import fr.dcproject.Env import fr.dcproject.Env
import fr.dcproject.messages.Mailer import fr.dcproject.messages.Mailer
import fr.dcproject.module import fr.dcproject.module
import io.ktor.locations.KtorExperimentalLocationsAPI import io.ktor.locations.*
import io.ktor.server.testing.withTestApplication import io.ktor.server.testing.*
import io.ktor.util.KtorExperimentalAPI import io.ktor.util.*
import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi
import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@@ -21,7 +23,7 @@ import org.koin.test.get
class MailerTest : KoinTest, AutoCloseKoinTest() { class MailerTest : KoinTest, AutoCloseKoinTest() {
@InternalCoroutinesApi @InternalCoroutinesApi
@Test @Test
@Tag("online") @Tag("online, functional")
fun `can be send an email`() { fun `can be send an email`() {
withTestApplication({ module(Env.TEST) }) { withTestApplication({ module(Env.TEST) }) {
get<Mailer>().sendEmail { get<Mailer>().sendEmail {

View File

@@ -1,5 +1,6 @@
package fr.dcproject.utils package functional
import fr.dcproject.utils.readResource
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import kotlin.test.assertEquals import kotlin.test.assertEquals

View File

@@ -1,3 +1,5 @@
package functional
import fr.dcproject.Env import fr.dcproject.Env
import fr.dcproject.component.article.ArticleRefVersioning import fr.dcproject.component.article.ArticleRefVersioning
import fr.dcproject.component.article.ArticleViewManager import fr.dcproject.component.article.ArticleViewManager
@@ -7,6 +9,7 @@ import io.ktor.locations.*
import io.ktor.server.testing.* import io.ktor.server.testing.*
import io.ktor.util.* import io.ktor.util.*
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
@@ -16,6 +19,7 @@ import java.util.*
@KtorExperimentalLocationsAPI @KtorExperimentalLocationsAPI
@KtorExperimentalAPI @KtorExperimentalAPI
@TestInstance(PER_CLASS) @TestInstance(PER_CLASS)
@Tag("functional")
class ViewTest { class ViewTest {
@Test @Test
fun `test View Article`() { fun `test View Article`() {

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.article.ArticleForUpdate import fr.dcproject.component.article.ArticleForUpdate
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.citizen.Citizen import fr.dcproject.component.citizen.Citizen
import fr.dcproject.component.citizen.CitizenI import fr.dcproject.component.citizen.CitizenI

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.article.ArticleRef import fr.dcproject.component.article.ArticleRef
import fr.dcproject.component.citizen.Citizen import fr.dcproject.component.citizen.Citizen

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.article.ArticleRef import fr.dcproject.component.article.ArticleRef
import fr.dcproject.component.citizen.CitizenRepository import fr.dcproject.component.citizen.CitizenRepository

View File

@@ -1,4 +1,4 @@
package feature package steps
import com.auth0.jwt.JWT import com.auth0.jwt.JWT
import fr.dcproject.JwtConfig import fr.dcproject.JwtConfig

View File

@@ -1,10 +1,7 @@
package feature package steps
import io.ktor.application.Application import io.ktor.application.*
import io.ktor.server.testing.TestApplicationCall import io.ktor.server.testing.*
import io.ktor.server.testing.TestApplicationEngine
import io.ktor.server.testing.TestApplicationRequest
import io.ktor.server.testing.createTestEnvironment
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlin.test.fail import kotlin.test.fail

View File

@@ -1,4 +1,4 @@
package feature package steps
import com.jayway.jsonpath.JsonPath import com.jayway.jsonpath.JsonPath
import io.cucumber.datatable.DataTable import io.cucumber.datatable.DataTable

View File

@@ -1,4 +1,4 @@
package feature package steps
import io.cucumber.datatable.DataTable import io.cucumber.datatable.DataTable
import io.cucumber.java8.En import io.cucumber.java8.En

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.article.ArticleRef import fr.dcproject.component.article.ArticleRef
import fr.dcproject.component.article.ArticleRepository import fr.dcproject.component.article.ArticleRepository

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.article.ArticleRepository import fr.dcproject.component.article.ArticleRepository
import fr.dcproject.component.citizen.CitizenRepository import fr.dcproject.component.citizen.CitizenRepository

View File

@@ -1,4 +1,4 @@
package feature package steps
import fr.dcproject.component.citizen.Citizen import fr.dcproject.component.citizen.Citizen
import fr.dcproject.component.citizen.CitizenI import fr.dcproject.component.citizen.CitizenI

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
import fr.dcproject.component.article.ArticleVoter import fr.dcproject.component.article.ArticleVoter
@@ -17,12 +17,15 @@ import org.joda.time.DateTime
import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
import fr.dcproject.component.article.ArticleRepository as ArticleRepo import fr.dcproject.component.article.ArticleRepository as ArticleRepo
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
class ArticleVoterTest { internal class ArticleVoterTest {
private val tesla = CitizenCart( private val tesla = CitizenCart(
id = UUID.fromString("e6efc288-4283-4729-a268-6debb18de1a0"), id = UUID.fromString("e6efc288-4283-4729-a268-6debb18de1a0"),
user = User( user = User(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.citizen.CitizenBasic import fr.dcproject.component.citizen.CitizenBasic
import fr.dcproject.component.citizen.CitizenI import fr.dcproject.component.citizen.CitizenI
@@ -7,18 +7,19 @@ import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.voter.Vote.DENIED import fr.dcproject.voter.Vote.DENIED
import fr.dcproject.voter.Vote.GRANTED import fr.dcproject.voter.Vote.GRANTED
import io.ktor.locations.*
import io.mockk.mockkStatic import io.mockk.mockkStatic
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.joda.time.DateTime import org.joda.time.DateTime
import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
class CitizenVoterTest { internal class CitizenVoterTest {
private val tesla = CitizenBasic( private val tesla = CitizenBasic(
user = User( user = User(
username = "nicolas-tesla", username = "nicolas-tesla",

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
import fr.dcproject.component.article.ArticleRef import fr.dcproject.component.article.ArticleRef
@@ -13,7 +13,6 @@ import fr.dcproject.entity.UserI
import fr.dcproject.voter.Vote.DENIED import fr.dcproject.voter.Vote.DENIED
import fr.dcproject.voter.Vote.GRANTED import fr.dcproject.voter.Vote.GRANTED
import fr.postgresjson.connexion.Paginated import fr.postgresjson.connexion.Paginated
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
@@ -22,11 +21,13 @@ import org.joda.time.DateTime
import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
import fr.dcproject.component.article.ArticleRepository as ArticleRepo import fr.dcproject.component.article.ArticleRepository as ArticleRepo
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class CommentVoterTest { internal class CommentVoterTest {
private val tesla = Citizen( private val tesla = Citizen(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.citizenOrNull import fr.dcproject.citizenOrNull
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
@@ -9,13 +9,13 @@ import fr.dcproject.component.citizen.CitizenI
import fr.dcproject.entity.Follow import fr.dcproject.entity.Follow
import fr.dcproject.entity.User import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.security.voter.FollowVoter
import fr.dcproject.voter.NoSubjectDefinedException import fr.dcproject.voter.NoSubjectDefinedException
import fr.ktorVoter.ActionI import fr.ktorVoter.ActionI
import fr.ktorVoter.Vote import fr.ktorVoter.Vote
import fr.ktorVoter.can import fr.ktorVoter.can
import fr.ktorVoter.canAll import fr.ktorVoter.canAll
import io.ktor.application.* import io.ktor.application.*
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
@@ -25,10 +25,12 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class FollowVoterTest { internal class FollowVoterTest {
private val tesla = CitizenBasic( private val tesla = CitizenBasic(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
import fr.dcproject.component.citizen.CitizenBasic import fr.dcproject.component.citizen.CitizenBasic
@@ -7,13 +7,13 @@ import fr.dcproject.component.citizen.CitizenI
import fr.dcproject.entity.OpinionChoice import fr.dcproject.entity.OpinionChoice
import fr.dcproject.entity.User import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.security.voter.OpinionChoiceVoter
import fr.dcproject.user import fr.dcproject.user
import fr.ktorVoter.ActionI import fr.ktorVoter.ActionI
import fr.ktorVoter.Vote import fr.ktorVoter.Vote
import fr.ktorVoter.can import fr.ktorVoter.can
import fr.ktorVoter.canAll import fr.ktorVoter.canAll
import io.ktor.application.* import io.ktor.application.*
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
@@ -22,10 +22,12 @@ import org.joda.time.DateTime
import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class OpinionChoiceVoterTest { internal class OpinionChoiceVoterTest {
private val tesla = CitizenBasic( private val tesla = CitizenBasic(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
import fr.dcproject.component.citizen.CitizenBasic import fr.dcproject.component.citizen.CitizenBasic
@@ -8,11 +8,11 @@ import fr.dcproject.entity.Opinion
import fr.dcproject.entity.OpinionChoice import fr.dcproject.entity.OpinionChoice
import fr.dcproject.entity.User import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.security.voter.OpinionVoter
import fr.dcproject.user import fr.dcproject.user
import fr.dcproject.voter.NoSubjectDefinedException import fr.dcproject.voter.NoSubjectDefinedException
import fr.ktorVoter.* import fr.ktorVoter.*
import io.ktor.application.* import io.ktor.application.*
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
@@ -22,10 +22,12 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class OpinionVoterTest { internal class OpinionVoterTest {
private val tesla = CitizenBasic( private val tesla = CitizenBasic(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.citizenOrNull import fr.dcproject.citizenOrNull
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
@@ -10,13 +10,13 @@ import fr.dcproject.component.citizen.CitizenI
import fr.dcproject.entity.User import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.entity.VoteForUpdate import fr.dcproject.entity.VoteForUpdate
import fr.dcproject.security.voter.VoteVoter
import fr.dcproject.voter.NoSubjectDefinedException import fr.dcproject.voter.NoSubjectDefinedException
import fr.ktorVoter.ActionI import fr.ktorVoter.ActionI
import fr.ktorVoter.Vote import fr.ktorVoter.Vote
import fr.ktorVoter.can import fr.ktorVoter.can
import fr.ktorVoter.canAll import fr.ktorVoter.canAll
import io.ktor.application.* import io.ktor.application.*
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
@@ -26,11 +26,13 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
import fr.dcproject.entity.Vote as VoteEntity import fr.dcproject.entity.Vote as VoteEntity
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class VoteVoterTest { internal class VoteVoterTest {
private val tesla = Citizen( private val tesla = Citizen(

View File

@@ -1,4 +1,4 @@
package fr.dcproject.security.voter package unit.voter
import fr.dcproject.component.article.ArticleForView import fr.dcproject.component.article.ArticleForView
import fr.dcproject.component.citizen.CitizenBasic import fr.dcproject.component.citizen.CitizenBasic
@@ -8,6 +8,7 @@ import fr.dcproject.entity.User
import fr.dcproject.entity.UserI import fr.dcproject.entity.UserI
import fr.dcproject.entity.WorkgroupRef import fr.dcproject.entity.WorkgroupRef
import fr.dcproject.entity.WorkgroupWithMembersI import fr.dcproject.entity.WorkgroupWithMembersI
import fr.dcproject.security.voter.WorkgroupVoter
import fr.dcproject.user import fr.dcproject.user
import fr.dcproject.voter.NoSubjectDefinedException import fr.dcproject.voter.NoSubjectDefinedException
import fr.ktorVoter.ActionI import fr.ktorVoter.ActionI
@@ -15,18 +16,19 @@ import fr.ktorVoter.Vote
import fr.ktorVoter.VoterException import fr.ktorVoter.VoterException
import fr.ktorVoter.can import fr.ktorVoter.can
import io.ktor.application.* import io.ktor.application.*
import io.ktor.locations.*
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.mockkStatic import io.mockk.mockkStatic
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.joda.time.DateTime import org.joda.time.DateTime
import org.junit.jupiter.api.* import org.junit.jupiter.api.*
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import java.util.* import java.util.*
import fr.dcproject.entity.Workgroup as WorkgroupEntity import fr.dcproject.entity.Workgroup as WorkgroupEntity
@KtorExperimentalLocationsAPI
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(CONCURRENT)
@Tag("voter") @Tag("voter")
internal class WorkgroupVoterTest { internal class WorkgroupVoterTest {
private val tesla = CitizenBasic( private val tesla = CitizenBasic(