diff options
| author | Kostya <mail@sartin.in> | 2026-08-13 16:24:24 +0000 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-08-13 16:24:24 +0000 |
| commit | ae8486da5c542d6af9a2e0f9f7cc39729a055eee (patch) | |
| tree | 2b8294ca875290bfbb6d4c32bfffa7d7373e7374 /engine | |
| parent | 40fa8c52d2afc87c76b2d38566e9920120b2da3c (diff) | |
| download | guess-market-ae8486da5c542d6af9a2e0f9f7cc39729a055eee.tar.gz guess-market-ae8486da5c542d6af9a2e0f9f7cc39729a055eee.tar.xz guess-market-ae8486da5c542d6af9a2e0f9f7cc39729a055eee.zip | |
Add service module with stubbed LocalGuessMarketContext
GuessMarketContext gained a richer surface (loadEvents/listEvents/
buyShares/closeEvent/account/save-restoreState) backed by new
EventDetailDTO, MarketStateDTO, OptionStateDTO and PurchaseReceiptDTO.
The old engine-module provider implemented the previous shape and is
removed; market.guess.service.LocalGuessMarketContext replaces it as a
stub, each method throwing UnsupportedOperationException pending a
real implementation.
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/src/main/java/market/guess/engine/provider/LocalGuessMarketContext.java | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/engine/src/main/java/market/guess/engine/provider/LocalGuessMarketContext.java b/engine/src/main/java/market/guess/engine/provider/LocalGuessMarketContext.java deleted file mode 100644 index 000e2a7..0000000 --- a/engine/src/main/java/market/guess/engine/provider/LocalGuessMarketContext.java +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | package market.guess.engine.provider; | ||
| 2 | |||
| 3 | import jakarta.xml.bind.JAXBContext; | ||
| 4 | import jakarta.xml.bind.Marshaller; | ||
| 5 | import java.io.File; | ||
| 6 | import java.util.List; | ||
| 7 | import market.guess.api.EventSummaryDTO; | ||
| 8 | import market.guess.api.GuessMarketContext; | ||
| 9 | import market.guess.api.LoadResultDTO; | ||
| 10 | import market.guess.api.ProblemDTO; | ||
| 11 | import market.guess.engine.model.GuessMarket; | ||
| 12 | |||
| 13 | public class LocalGuessMarketContext implements GuessMarketContext { | ||
| 14 | private GuessMarket context; | ||
| 15 | |||
| 16 | @Override | ||
| 17 | public LoadResultDTO LoadAsync() { | ||
| 18 | var file = new File("test-data/ex-1/multiple.xml"); | ||
| 19 | try { | ||
| 20 | var ctx = JAXBContext.newInstance(GuessMarket.class); | ||
| 21 | var unmarshaller = ctx.createUnmarshaller(); | ||
| 22 | |||
| 23 | context = (GuessMarket) unmarshaller.unmarshal(file); | ||
| 24 | return LoadResultDTO.success(file.getPath(), context.getGMEvents().getGMEvent().size()); | ||
| 25 | } catch (Exception e) { | ||
| 26 | e.printStackTrace(); | ||
| 27 | return LoadResultDTO.failure( | ||
| 28 | file.getPath(), List.of(new ProblemDTO("LOAD_FAILED", e.getMessage(), file.getPath()))); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public void SaveChangesAsync() { | ||
| 34 | try { | ||
| 35 | |||
| 36 | var ctx = JAXBContext.newInstance(GuessMarket.class); | ||
| 37 | var marshaller = ctx.createMarshaller(); | ||
| 38 | marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); | ||
| 39 | |||
| 40 | var file = new File("test-data/ex-1/output.xml"); | ||
| 41 | marshaller.marshal(context, file); | ||
| 42 | } catch (Exception ex) { | ||
| 43 | ex.printStackTrace(); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | public List<EventSummaryDTO> GetAllEventsAsync() { | ||
| 49 | throw new UnsupportedOperationException("Unimplemented method 'GetEventInfoByIdAsync'"); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public void GetEventInfoByIdAsync() { | ||
| 54 | // TODO Auto-generated method stub | ||
| 55 | throw new UnsupportedOperationException("Unimplemented method 'GetEventInfoByIdAsync'"); | ||
| 56 | } | ||
| 57 | |||
| 58 | @Override | ||
| 59 | public void CreateEventAsync() { | ||
| 60 | // TODO Auto-generated method stub | ||
| 61 | throw new UnsupportedOperationException("Unimplemented method 'CreateEventAsync'"); | ||
| 62 | } | ||
| 63 | |||
| 64 | @Override | ||
| 65 | public void UpdateEventAsync() { | ||
| 66 | // TODO Auto-generated method stub | ||
| 67 | throw new UnsupportedOperationException("Unimplemented method 'UpdateEventAsync'"); | ||
| 68 | } | ||
| 69 | } | ||