-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from EphyraSoftware/feature/18-text-reports
Project reporting to text
- Loading branch information
Showing
22 changed files
with
422 additions
and
13 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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
...s-service/src/intTest/kotlin/org/ephyra/acropolis/service/ImportExportRoundTripIntTest.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 org.ephyra.acropolis.service | ||
|
||
import org.ephyra.acropolis.external.YamlHelper | ||
import org.ephyra.acropolis.service.api.IExportService | ||
import org.ephyra.acropolis.service.api.IImportService | ||
import org.ephyra.acropolis.service.api.ImportType | ||
import org.ephyra.acropolis.service.config.ServiceConfiguration | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.DisplayName | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
|
||
/** | ||
* Test that the import and export services represent a symmetric operation | ||
*/ | ||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(classes = [IntegrationTestConfiguration::class, ServiceConfiguration::class]) | ||
class ImportExportRoundTripIntTest { | ||
@Autowired | ||
private lateinit var importService: IImportService | ||
|
||
@Autowired | ||
private lateinit var exportService: IExportService | ||
|
||
/** | ||
* Test that YAML can be symmetrically imported and exported | ||
*/ | ||
@Test | ||
@DisplayName("Test that YAML can be symmetrically imported and exported") | ||
fun importExportRTT() { | ||
val data = String(javaClass.getResourceAsStream("/round-trip-test-project.yml").readAllBytes()) | ||
importService.importProject(data, ImportType.YAML) | ||
|
||
val yamlHelper = YamlHelper() | ||
val originalProject = yamlHelper.loadFromString(data) | ||
?: throw IllegalStateException("Failed to deserialize project") | ||
|
||
val exportedData = exportService.export(originalProject.name, ImportType.YAML) | ||
|
||
// Have to serialize the data which was loaded from file again to make sure the result will match. | ||
val expected = yamlHelper.serialize(originalProject) | ||
|
||
assertEquals(expected, exportedData) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
acropolis-service/src/intTest/resources/round-trip-test-project.yml
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,30 @@ | ||
version: '1.0' | ||
name: 'round trip project' | ||
software: | ||
applications: | ||
- name: 'Application One' | ||
description: 'Description for Application One' | ||
talks_to: | ||
- 'system.System Three - ReverseProxy' | ||
- name: 'Application Two' | ||
description: 'Description for Application Two' | ||
talks_to: | ||
- 'application.Application One' | ||
systems: | ||
- name: 'System One' | ||
description: 'Description for System One' | ||
- name: 'System Two - Queue' | ||
description: 'Description for System Two - Queue' | ||
specialization: Queue | ||
talks_to: | ||
- 'system.System One' | ||
- name: 'System Three - ReverseProxy' | ||
description: 'Description for System Three - ReverseProxy' | ||
specialization: ReverseProxy | ||
talks_to: | ||
- 'system.System Two - Queue' | ||
- name: 'System Four - LoadBalancer' | ||
description: 'Description for System Four - LoadBalancer' | ||
specialization: LoadBalancer | ||
talks_to: | ||
- 'system.System Two - Queue' |
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
15 changes: 15 additions & 0 deletions
15
acropolis-service/src/main/kotlin/org/ephyra/acropolis/service/api/IExportService.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,15 @@ | ||
package org.ephyra.acropolis.service.api | ||
|
||
/** | ||
* Service interface for exporting project data | ||
*/ | ||
interface IExportService { | ||
/** | ||
* Export a project identified by name to a specified data format. | ||
* | ||
* @param projectName The name of the project to export | ||
* @param exportType The type of data format to output | ||
* @return The data representing the exported project in the specified data format | ||
*/ | ||
fun export(projectName: String, exportType: ImportType): String? | ||
} |
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.