Skip to content

Commit 3662060

Browse files
committed
Finished one-to-many tests for currently implemented features
1 parent d99d7cf commit 3662060

File tree

1 file changed

+115
-10
lines changed
  • bee.persistent.test/src/test/kotlin/com/beeproduced/bee/persistent/test/base

1 file changed

+115
-10
lines changed

bee.persistent.test/src/test/kotlin/com/beeproduced/bee/persistent/test/base/OneToManyTest.kt

+115-10
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,121 @@ class OneToManyTest(
256256
}
257257
}
258258

259+
@Test
260+
@Ignore("Not implemented yet")
261+
fun exists() {
262+
// TODO: Implement exists for BeeBlazeRepository
263+
}
264+
265+
@Test
266+
@Ignore("Not implemented yet")
267+
fun `exists with composite key`() {
268+
// TODO: Implement exists for BeeBlazeRepository
269+
}
270+
271+
@Test
272+
@Ignore("Not implemented yet")
273+
fun `exists with multiple ids`() {
274+
// TODO: Implement exists for BeeBlazeRepository
275+
}
276+
277+
@Test
278+
@Ignore("Not implemented yet")
279+
fun `exists with multiple composite keys`() {
280+
// TODO: Implement exists for BeeBlazeRepository
281+
}
282+
283+
@Test
284+
fun `update field`() {
285+
var collectionId1: Long = -1
286+
var workId1 = WorkId()
287+
288+
transaction.executeWithoutResult {
289+
val collection1 = collectionRepo.persist(WorkCollection())
290+
collectionId1 = collection1.id
291+
val work1 = workRepo.persist(Work(WorkId(++workIdCount, collectionId1), "Hey!"))
292+
workId1 = work1.id
293+
}
294+
295+
transaction.executeWithoutResult {
296+
val work = workRepo.select {
297+
where(WorkDSL.id.eq(workId1))
298+
}.firstOrNull()
299+
assertNotNull(work)
300+
val workUpdate = work.copy(txt = "Update!")
301+
workRepo.update(workUpdate)
302+
}
303+
304+
transaction.executeWithoutResult {
305+
val workUpdate = workRepo.select {
306+
where(WorkDSL.id.eq(workId1))
307+
}.firstOrNull()
308+
309+
assertNotNull(workUpdate)
310+
assertEquals("Update!", workUpdate.txt)
311+
}
312+
}
313+
314+
@Test
315+
@Ignore("Not implemented yet")
316+
fun `delete all`() {
317+
// TODO: Implement delete for BeeBlazeRepository
318+
}
319+
320+
@Test
321+
@Ignore("Not implemented yet")
322+
fun `delete without where clause`() {
323+
// TODO: Implement delete for BeeBlazeRepository
324+
}
325+
326+
@Test
327+
@Ignore("Not implemented yet")
328+
fun `delete by id`() {
329+
// TODO: Implement delete for BeeBlazeRepository
330+
}
331+
332+
@Test
333+
@Ignore("Not implemented yet")
334+
fun `delete by id with composite key`() {
335+
// TODO: Implement delete for BeeBlazeRepository
336+
}
337+
338+
@Test
339+
@Ignore("Not implemented yet")
340+
fun `delete by ids`() {
341+
// TODO: Implement delete for BeeBlazeRepository
342+
}
343+
344+
@Test
345+
@Ignore("Not implemented yet")
346+
fun `delete by ids with composite key`() {
347+
// TODO: Implement delete for BeeBlazeRepository
348+
}
349+
350+
@Test
351+
@Ignore("Not implemented yet")
352+
fun `delete by ids with some not existing`() {
353+
// TODO: Implement delete for BeeBlazeRepository
354+
}
355+
356+
@Test
357+
fun rollback() {
358+
var collectionId1: Long = -1
359+
var collectionId2: Long = -1
360+
361+
transaction.executeWithoutResult { tx ->
362+
val collection1 = collectionRepo.persist(WorkCollection())
363+
collectionId1 = collection1.id
364+
val collection2 = collectionRepo.persist(WorkCollection())
365+
collectionId2 = collection2.id
366+
tx.setRollbackOnly()
367+
}
368+
369+
transaction.executeWithoutResult {
370+
val collections = collectionRepo.select()
371+
assertEquals(0, collections.count())
372+
}
373+
}
259374

260375
private fun assertWorkCollection(
261376
workCollection: WorkCollection,
@@ -272,17 +387,7 @@ class OneToManyTest(
272387
assertNotNull(works)
273388
assertEquals(workIds.count(), works.count())
274389
for (work in works) {
275-
// assertTrue { workIds.contains(work.id) }
276390
assertWork(work, collectionId, workIds, depth - 1)
277-
278-
// val newDepth = depth - 1
279-
// val newWorkCollection = work.workCollection
280-
// if (newDepth != 0) {
281-
// assertNotNull(newWorkCollection)
282-
// assertWorkCollection(newWorkCollection, collectionId, workIds, newDepth)
283-
// } else {
284-
// assertNull(newWorkCollection)
285-
// }
286391
}
287392
}
288393

0 commit comments

Comments
 (0)