diff --git a/pom.xml b/pom.xml index 217f25c..f99032f 100644 --- a/pom.xml +++ b/pom.xml @@ -101,11 +101,36 @@ + + org.spockframework + spock-core + 1.3-groovy-2.5 + test + + + org.codehaus.groovy + groovy-all + 2.4.7 + test + Cryptosky DB Gateway + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.5 + + + + compile + testCompile + + + + org.eclipse.jetty jetty-maven-plugin diff --git a/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java b/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java index d1c6d22..a375e24 100644 --- a/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java +++ b/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java @@ -1,7 +1,9 @@ package cryptosky.me.graphql.pricing.models.entities; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.Table; diff --git a/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java b/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java index 70a6477..05afcb3 100644 --- a/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java +++ b/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java @@ -36,9 +36,9 @@ public class CryptoPriceModel { @Column(name = "volume") private float volume; - private transient String formattedDate; - - public String getFormattedDate() { - return getTimestamp().toString(); - } +// private transient String formattedDate; +// +// public String getFormattedDate() { +// return getTimestamp().toString(); +// } } \ No newline at end of file diff --git a/src/test/java/cryptosky/me/dbgateway/DbGatewayApplicationTests.java b/src/test/java/cryptosky/me/dbgateway/DbGatewayApplicationTests.java deleted file mode 100644 index f8b2b62..0000000 --- a/src/test/java/cryptosky/me/dbgateway/DbGatewayApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package cryptosky.me.dbgateway; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DbGatewayApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/src/test/java/integration/pricing/models/repositories/BtcPriceRepositoryTest.groovy b/src/test/java/integration/pricing/models/repositories/BtcPriceRepositoryTest.groovy new file mode 100644 index 0000000..e22e654 --- /dev/null +++ b/src/test/java/integration/pricing/models/repositories/BtcPriceRepositoryTest.groovy @@ -0,0 +1,44 @@ +package integration.pricing.models.repositories + +import cryptosky.me.graphql.pricing.models.entities.BtcPriceModel +import cryptosky.me.graphql.pricing.models.repositories.BtcPriceRepository +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest +import org.springframework.boot.test.context.SpringBootTest +import spock.lang.Specification + +@SpringBootTest +@DataJpaTest +class BtcPriceRepositoryTest extends Specification { + + @Autowired + BtcPriceRepository btcPriceRepository + + BtcPriceModel btcPriceModel + + def setup() { + btcPriceModel = new BtcPriceModel("", "", 23F, 23.2F, 22.91F, 23.01F, 245F) + } + + def "Data should be able to be saved to the repository if it required class variables"() { + + when: "Load BTC price entity" + +// btcPriceModel.setTimestamp("2020-02-03T15:00:00+00:00") +// btcPriceModel.setType("BTC-GBP") +// btcPriceModel.setAverage_price(23F) +// btcPriceModel.setHigh_price(23.12F) +// btcPriceModel.setLow_price(22.87F) +// btcPriceModel.setClose_price(23.1F) +// btcPriceModel.setVolume(345F) + + println(btcPriceModel) + + def entity = btcPriceRepository.save(btcPriceModel) + def result = btcPriceRepository.findOne(entity.getTimestamp()) + + then: "A single entry to exist in the repository" + btcPriceRepository.count() == 1L + entity.getTimestamp() == result.get().timestamp + } +} diff --git a/src/test/java/unit/groovy/pricing/BtcPriceServiceTest.groovy b/src/test/java/unit/groovy/pricing/BtcPriceServiceTest.groovy new file mode 100644 index 0000000..a5fde2b --- /dev/null +++ b/src/test/java/unit/groovy/pricing/BtcPriceServiceTest.groovy @@ -0,0 +1,29 @@ +package unit.groovy.pricing + +import spock.lang.Specification + +class BtcPriceServiceTest extends Specification { + void setup() { + } + + void cleanup() { + } + + def "CreateBtc"() { + } + + def "GetAllPrices"() { + } + + def "GetPricesBetweenCounts"() { + } + + def "GetLatest"() { + } + + def "GetPriceForCreatedDate"() { + } + + def "GetPriceBetweenDates"() { + } +}