Skip to content

Commit

Permalink
Removed start and end time and created specific time variables for di…
Browse files Browse the repository at this point in the history
…fferent package types
  • Loading branch information
QuincyCantu committed Aug 23, 2024
2 parents 1be3165 + 7df2350 commit de14f2b
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage;

public class AudioPackageTest extends PackageTest<AudioPackage> {

@Override
protected AudioPackage createObject() {
return AudioPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.audio.CPODPackage;

public class CPODPackageTest extends PackageTest<CPODPackage> {

@Override
protected CPODPackage createObject() {
return CPODPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.detections.DetectionsPackage;

public class DetectionsPackageTest extends PackageTest<DetectionsPackage> {

@Override
protected DetectionsPackage createObject() {
return DetectionsPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.ObjectWithUniqueFieldTest;
import edu.colorado.cires.pace.data.object.dataset.base.Package;

public abstract class PackageTest<P extends Package> extends ObjectWithUniqueFieldTest<P> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.soundClips.SoundClipsPackage;

public class SoundClipsPackageTest extends PackageTest<SoundClipsPackage> {

@Override
protected SoundClipsPackage createObject() {
return SoundClipsPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.soundLevelMetrics.SoundLevelMetricsPackage;

public class SoundLevelMetricsPackageTest extends PackageTest<SoundLevelMetricsPackage> {

@Override
protected SoundLevelMetricsPackage createObject() {
return SoundLevelMetricsPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.colorado.cires.pace.data.object;

import edu.colorado.cires.pace.data.object.dataset.soundPropagationModels.SoundPropagationModelsPackage;

public class SoundPropagationModelsTest extends PackageTest<SoundPropagationModelsPackage> {

@Override
protected SoundPropagationModelsPackage createObject() {
return SoundPropagationModelsPackage.builder().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,14 @@ void testResolvePackageIdEmptyProjects() {
"%s_%s", aPackage.getSiteOrCruiseName(), aPackage.getDeploymentId()
), aPackage.getPackageId());
}

@Test
void testResolvePackageIdDataCollectionNameSpecified() {
Package aPackage = AudioPackage.builder()
.dataCollectionName("dataCollectionName")
.build();

assertEquals("dataCollectionName", aPackage.getPackageId());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage;
import edu.colorado.cires.pace.data.object.dataset.audio.CPODPackage;
import edu.colorado.cires.pace.data.object.dataset.audio.metadata.Channel;
import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.LocationDetail;
import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.translator.LocationDetailTranslator;
import edu.colorado.cires.pace.data.object.dataset.base.metadata.translator.DataQualityEntry;
import edu.colorado.cires.pace.data.object.dataset.detections.DetectionsPackage;
import edu.colorado.cires.pace.data.object.dataset.audio.metadata.DutyCycle;
Expand Down Expand Up @@ -2215,4 +2217,56 @@ void covertInvalidPackageType() {
Exception exception = assertThrows(TranslationException.class, () -> converter.convert(packageTranslator, Collections.emptyMap(), 1, new RuntimeException()));
assertEquals("Translation not supported for PackageTranslator", exception.getMessage());
}

@Test
void testUnspecifiedLocationDetail() throws TranslationException {

Package aPackage = converter.convert(
AudioPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());

aPackage = converter.convert(
CPODPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());

aPackage = converter.convert(
DetectionsPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());

aPackage = converter.convert(
SoundClipsPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());

aPackage = converter.convert(
SoundLevelMetricsPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());

aPackage = converter.convert(
SoundPropagationModelsPackageTranslator.builder().locationDetailTranslator(null).build(),
Collections.emptyMap(),
0,
new RuntimeException()
);
assertNull(aPackage.getLocationDetail());
}
}

0 comments on commit de14f2b

Please sign in to comment.