Skip to content

Commit

Permalink
Working on splitting BeePersistentTestA & BeePersistentTestB into…
Browse files Browse the repository at this point in the history
… multiple test classes

Added `SelectionATest`.
  • Loading branch information
kurbaniec committed Jan 15, 2024
1 parent cdb4d64 commit 4b74025
Show file tree
Hide file tree
Showing 9 changed files with 354 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import java.util.*
@Table(name = "songs")
data class Song(
@Id
// @GeneratedValue // TODO: persist
val id: UUID,
@GeneratedValue
val id: UUID = UUID.randomUUID(),
val name: String,
@Column(name = "interpret_id")
val interpretId: UUID,
Expand All @@ -46,8 +46,8 @@ interface SongRepository : BeeBlazeRepository<Song, UUID>
@Table(name = "persons")
data class Person(
@Id
// @GeneratedValue // TODO: persist
val id: UUID,
@GeneratedValue
val id: UUID = UUID.randomUUID(),
val firstname: String,
val lastname: String,
@OneToMany(fetch = FetchType.LAZY, mappedBy = "person")
Expand All @@ -58,24 +58,34 @@ data class Person(
val address: Address? = null
)

@BeeRepository
interface PersonRepository : BeeBlazeRepository<Person, UUID>

@Entity
@Table(name = "addresses")
data class Address(
@Id
val id: UUID,
@GeneratedValue
val id: UUID = UUID.randomUUID(),
val street: String
)

@BeeRepository
interface AddressRepository : BeeBlazeRepository<Address, UUID>

@Entity
@Table(name = "companies")
data class Company(
@Id
// @GeneratedValue // TODO: persist
val id: UUID,
@GeneratedValue
val id: UUID = UUID.randomUUID(),
@OneToMany(fetch = FetchType.LAZY, mappedBy = "company")
val employees: Set<CompanyPerson>?
)

@BeeRepository
interface CompanyRepository : BeeBlazeRepository<Company, UUID>

@Embeddable
data class CompanyPersonId(
@Column(name = "company_id")
Expand All @@ -97,6 +107,9 @@ data class CompanyPerson(
val person: Person?,
)

@BeeRepository
interface CompanyPersonRepository : BeeBlazeRepository<CompanyPerson, CompanyPersonId>

data class FooBar(
val foo: String,
val bar: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BeePersistentTestA(
) {
private val transaction = TransactionTemplate(transactionManager)

@Test
/* @Test
fun `empty selection`() {
addSong()
transaction.executeWithoutResult {
Expand All @@ -67,9 +67,9 @@ class BeePersistentTestA(
assertNull(song.interpret)
assertNull(song.producer)
}
}
} */

@Test
/* @Test
fun `full selection`() {
addSong()
transaction.executeWithoutResult {
Expand Down Expand Up @@ -172,8 +172,8 @@ class BeePersistentTestA(
}
}

@Test
*/
/* @Test
fun `partial selection 1`() {
addSong()
transaction.executeWithoutResult {
Expand Down Expand Up @@ -223,8 +223,8 @@ class BeePersistentTestA(
assertNull(song.producer)
}
}

@Test
*/
/* @Test
fun `partial selection 2`() {
addSong()
transaction.executeWithoutResult {
Expand Down Expand Up @@ -276,8 +276,8 @@ class BeePersistentTestA(
assertNotNull(pEPCP)
}
}

@Test
*/
/* @Test
fun `partial selection 3`() {
addSong()
transaction.executeWithoutResult {
Expand Down Expand Up @@ -319,7 +319,7 @@ class BeePersistentTestA(
assertTrue { producer.employees.isNullOrEmpty() }
}
}

*/
@Test
fun `test value class and converter`() {
transaction.executeWithoutResult {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.beeproduced.bee.persistent.test.base

import com.beeproduced.bee.persistent.blaze.selection.BeeSelection
import com.beeproduced.bee.persistent.test.config.BaseTestConfig
import com.beeproduced.datasource.test.dsl.BarDSL
import com.beeproduced.datasource.test.dsl.FooDSL
import com.beeproduced.datasource.test.manytomany.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.beeproduced.bee.persistent.test.base

import com.beeproduced.bee.persistent.blaze.selection.BeeSelection
import com.beeproduced.bee.persistent.test.config.BaseTestConfig
import com.beeproduced.datasource.test.dsl.WorkCollectionDSL
import com.beeproduced.datasource.test.dsl.WorkDSL
import com.beeproduced.datasource.test.onetomany.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.beeproduced.bee.persistent.test.base

import com.beeproduced.bee.persistent.blaze.selection.BeeSelection
import com.beeproduced.bee.persistent.test.config.BaseTestConfig
import com.beeproduced.datasource.test.dsl.RootDSL
import com.beeproduced.datasource.test.onetoone.Branch
import com.beeproduced.datasource.test.onetoone.BranchRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.beeproduced.bee.persistent.test.config

import com.netflix.graphql.dgs.autoconfig.DgsAutoConfiguration
import com.netflix.graphql.dgs.subscriptions.websockets.DgsWebSocketAutoConfig
import com.netflix.graphql.dgs.webmvc.autoconfigure.DgsWebMvcAutoConfiguration
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.EnableConfigurationProperties

/**
*
*
* @author Kacper Urbaniec
* @version 2024-01-14
*/
@SpringBootApplication(
scanBasePackages = ["com.beeproduced.datasource.a"],
exclude = [
DgsAutoConfiguration::class,
DgsWebMvcAutoConfiguration::class,
DgsWebSocketAutoConfig::class,
]
)
@EnableConfigurationProperties
class ATestConfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.bee.persistent.test.base
package com.beeproduced.bee.persistent.test.config

import com.netflix.graphql.dgs.autoconfig.DgsAutoConfiguration
import com.netflix.graphql.dgs.subscriptions.websockets.DgsWebSocketAutoConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.beeproduced.bee.persistent.test.persist

import com.beeproduced.bee.persistent.test.base.BaseTestConfig
import com.beeproduced.bee.persistent.test.config.BaseTestConfig
import com.beeproduced.bee.persistent.test.beePersist
import com.beeproduced.datasource.test.persist.*
import jakarta.persistence.EntityManager
Expand Down
Loading

0 comments on commit 4b74025

Please sign in to comment.