Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Update tests to make them platform agnostic #474

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public FrameworkInitialisation createFrameworkInit(Properties bootstrapProps) th
assertThat(mockFramework.getCredentialsStore()).isEqualTo(mockCredentialsStore);
assertThat(mockFramework.getResultArchiveStore()).isEqualTo(mockRASStoreService);

assertThat(frameworkInitUnderTest.getBootstrapConfigurationPropertyStore().getPath()).isEqualTo("/myuser/home/cps.properties");
assertThat(frameworkInitUnderTest.getDynamicStatusStoreUri().getPath()).isEqualTo("/myuser/home/dss.properties");
assertThat(frameworkInitUnderTest.getBootstrapConfigurationPropertyStore().getPath()).contains("/myuser/home/cps.properties");
assertThat(frameworkInitUnderTest.getDynamicStatusStoreUri().getPath()).contains("/myuser/home/dss.properties");

List<URI> rasUriList = frameworkInitUnderTest.getResultArchiveStoreUris();

assertThat(rasUriList).hasSize(1);
assertThat(rasUriList.get(0).getPath()).isEqualTo("/myuser/home/ras");
assertThat(frameworkInitUnderTest.getCredentialsStoreUri().getPath()).isEqualTo("/myuser/home/credentials.properties");
assertThat(rasUriList.get(0).getPath()).contains("/myuser/home/ras");
assertThat(frameworkInitUnderTest.getCredentialsStoreUri().getPath()).contains("/myuser/home/credentials.properties");

//assertThat(bootstrapProperties).isEmpty();
//assertThat(overrideProperties).isEmpty();
Expand Down Expand Up @@ -318,10 +318,17 @@ public void testLocateDynamicStatusStoreDefaultsGALASA_HOME() throws Exception {

// Then...
assertThat(uri).isNotNull();
assertThat(uri.getPath()).isEqualTo("/myuser/home/dss.properties" );
assertThat(uri.getPath()).contains("/myuser/home/dss.properties" );

// The empty file system should now have a blank file also.
Path expectedPath = Path.of("/myuser/home/dss.properties");
String os = System.getProperty("os.name");
Path expectedPath;
if(os.contains("Windows")) {
expectedPath = Path.of("C:/myuser/home/dss.properties");
}
else {
expectedPath = Path.of("/myuser/home/dss.properties");
}
assertThat(fs.exists(expectedPath)).isTrue();
}

Expand Down Expand Up @@ -386,10 +393,17 @@ public void testLocateCredentialsStoreNoticesGALASA_HOME() throws Exception {

// Then...
assertThat(uri).isNotNull();
assertThat(uri.getPath()).isEqualTo("/myuser/home/credentials.properties" );
assertThat(uri.getPath()).contains("/myuser/home/credentials.properties" );

// The empty file system should now have a blank file also.
Path expectedPath = Path.of("/myuser","home","credentials.properties");
String os = System.getProperty("os.name");
Path expectedPath;
if(os.contains("Windows")) {
expectedPath = Path.of("C:/myuser","home","credentials.properties");
}
else {
expectedPath = Path.of("/myuser","home","credentials.properties");
}
assertThat(fs.exists(expectedPath)).isTrue();
}

Expand Down Expand Up @@ -450,7 +464,14 @@ public void testCreatingRASUriListDefaultsToGalasaHome() throws Exception {

// When...
List<URI> uriList = frameworkInit.createUriResultArchiveStores(new Properties(),mockCPS);
assertThat(uriList).contains(URI.create("file:///myuser/home/ras"));

String os = System.getProperty("os.name");
if(os.contains("Windows")) {
assertThat(uriList).contains(URI.create("file:///C:/myuser/home/ras"));
}
else{
assertThat(uriList).contains(URI.create("file:///myuser/home/ras"));
}
}

}