-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished ServerEntitySynchronizerTests
- Loading branch information
1 parent
2573859
commit f8fef68
Showing
8 changed files
with
611 additions
and
54 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
server/src/main/kotlin/com/darkrockstudios/apps/hammer/utilities/EntityHasherExt.kt
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,48 @@ | ||
package com.darkrockstudios.apps.hammer.utilities | ||
|
||
import com.darkrockstudios.apps.hammer.base.http.ApiProjectEntity | ||
import com.darkrockstudios.apps.hammer.base.http.synchronizer.EntityHasher | ||
|
||
fun EntityHasher.hashEntity(entity: ApiProjectEntity): String { | ||
return when (entity) { | ||
is ApiProjectEntity.SceneEntity -> hashScene( | ||
id = entity.id, | ||
name = entity.name, | ||
order = entity.order, | ||
path = entity.path, | ||
type = entity.sceneType, | ||
content = entity.content, | ||
outline = entity.outline, | ||
notes = entity.notes, | ||
) | ||
|
||
is ApiProjectEntity.SceneDraftEntity -> hashSceneDraft( | ||
id = entity.id, | ||
created = entity.created, | ||
name = entity.name, | ||
content = entity.content, | ||
) | ||
|
||
is ApiProjectEntity.NoteEntity -> hashNote( | ||
id = entity.id, | ||
created = entity.created, | ||
content = entity.content, | ||
) | ||
|
||
is ApiProjectEntity.TimelineEventEntity -> hashTimelineEvent( | ||
id = entity.id, | ||
order = entity.order, | ||
content = entity.content, | ||
date = entity.date, | ||
) | ||
|
||
is ApiProjectEntity.EncyclopediaEntryEntity -> hashEncyclopediaEntry( | ||
id = entity.id, | ||
name = entity.name, | ||
entryType = entity.entryType, | ||
text = entity.text, | ||
tags = entity.tags, | ||
image = entity.image, | ||
) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...krockstudios/apps/hammer/project/synchronizers/ServerEncyclopediaEntrySynchronizerTest.kt
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,45 @@ | ||
package com.darkrockstudios.apps.hammer.project.synchronizers | ||
|
||
import com.darkrockstudios.apps.hammer.base.http.ApiProjectEntity | ||
import org.junit.Before | ||
import kotlin.reflect.KClass | ||
|
||
class ServerEncyclopediaEntrySynchronizerTest : | ||
ServerEntitySynchronizerTest<ApiProjectEntity.EncyclopediaEntryEntity, ServerEncyclopediaSynchronizer>() { | ||
|
||
override val entityType: ApiProjectEntity.Type = ApiProjectEntity.Type.ENCYCLOPEDIA_ENTRY | ||
override val entityClazz: KClass<ApiProjectEntity.EncyclopediaEntryEntity> = | ||
ApiProjectEntity.EncyclopediaEntryEntity::class | ||
override val pathStub: String = "encyclopedia_entry" | ||
|
||
@Before | ||
override fun setup() { | ||
super.setup() | ||
} | ||
|
||
override fun createSynchronizer(): ServerEncyclopediaSynchronizer { | ||
return ServerEncyclopediaSynchronizer(datasource) | ||
} | ||
|
||
override fun createNewEntity(): ApiProjectEntity.EncyclopediaEntryEntity { | ||
return ApiProjectEntity.EncyclopediaEntryEntity( | ||
id = 1, | ||
name = "Test Name", | ||
entryType = "Test Type", | ||
text = "Test Text", | ||
tags = setOf("Test Tag"), | ||
image = null, | ||
) | ||
} | ||
|
||
override fun createExistingEntity(): ApiProjectEntity.EncyclopediaEntryEntity { | ||
return ApiProjectEntity.EncyclopediaEntryEntity( | ||
id = 1, | ||
name = "Test Name Different", | ||
entryType = "Test Type", | ||
text = "Test Text", | ||
tags = setOf(), | ||
image = null, | ||
) | ||
} | ||
} |
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
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
Oops, something went wrong.