-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't leave empty files in the temp directory if decoding fails
+ some refactoring
- Loading branch information
1 parent
615e8d7
commit 0bdb8f7
Showing
10 changed files
with
86 additions
and
30 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
53 changes: 53 additions & 0 deletions
53
src/test/java/ru/r2cloud/satellite/decoder/Ax100DecoderTest.java
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,53 @@ | ||
package ru.r2cloud.satellite.decoder; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
import ru.r2cloud.TestConfiguration; | ||
import ru.r2cloud.TestUtil; | ||
import ru.r2cloud.model.Observation; | ||
import ru.r2cloud.model.Satellite; | ||
import ru.r2cloud.model.Transmitter; | ||
import ru.r2cloud.predict.PredictOreKit; | ||
import ru.r2cloud.satellite.SatelliteDao; | ||
|
||
public class Ax100DecoderTest { | ||
|
||
@Rule | ||
public TemporaryFolder tempFolder = new TemporaryFolder(); | ||
|
||
private SatelliteDao dao; | ||
private Decoders decoders; | ||
|
||
@Test | ||
public void testNoExtraFilesAfterFailure() throws Exception { | ||
Satellite satellite = dao.findById("44030"); | ||
Transmitter transmitter = satellite.getById("44030-0"); | ||
Decoder decoder = decoders.findByTransmitter(transmitter); | ||
File wav = TestUtil.setupClasspathResource(tempFolder, "data/delphini1.raw.gz"); | ||
Observation req = TestUtil.loadObservation("data/delphini1.raw.gz.json"); | ||
transmitter.setBandwidth(transmitter.getBandwidth() * 100); // GfskDecoder will fail here | ||
decoder.decode(wav, req, transmitter); | ||
File bin = new File(tempFolder.getRoot(), req.getId() + ".bin"); | ||
assertFalse(bin.exists()); | ||
} | ||
|
||
@Before | ||
public void start() throws Exception { | ||
TestConfiguration config = new TestConfiguration(tempFolder); | ||
config.setProperty("server.tmp.directory", tempFolder.getRoot().getAbsolutePath()); | ||
config.setProperty("r2cloud.newLaunches", false); | ||
config.setProperty("satellites.meta.location", "./src/test/resources/satellites-test.json"); | ||
config.update(); | ||
PredictOreKit predict = new PredictOreKit(config); | ||
dao = new SatelliteDao(config); | ||
decoders = new Decoders(predict, config, 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
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