From 5dfd3c7704843683aa3f02f9e94462cc89c65768 Mon Sep 17 00:00:00 2001 From: Andras Slemmer Date: Wed, 24 Aug 2016 15:23:34 +0100 Subject: [PATCH] contracts: Remove superfluous pacakge names --- .../r3corda/contracts/testing/Generators.kt | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/testing/Generators.kt b/contracts/src/main/kotlin/com/r3corda/contracts/testing/Generators.kt index 50ee1c0406..92fbb0dc82 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/testing/Generators.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/testing/Generators.kt @@ -3,6 +3,8 @@ package com.r3corda.contracts.testing import com.pholser.junit.quickcheck.generator.GenerationStatus import com.pholser.junit.quickcheck.generator.Generator import com.pholser.junit.quickcheck.generator.java.util.ArrayListGenerator +import com.pholser.junit.quickcheck.random.SourceOfRandomness +import com.r3corda.contracts.asset.Cash import com.r3corda.core.contracts.* import com.r3corda.core.crypto.DigitalSignature import com.r3corda.core.crypto.SecureHash @@ -10,42 +12,42 @@ import com.r3corda.core.testing.* import java.util.* class ContractStateGenerator : Generator(ContractState::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): ContractState { - return com.r3corda.contracts.asset.Cash.State( + override fun generate(random: SourceOfRandomness, status: GenerationStatus): ContractState { + return Cash.State( amount = AmountGenerator(IssuedGenerator(CurrencyGenerator())).generate(random, status), owner = PublicKeyGenerator().generate(random, status) ) } } -class MoveGenerator : Generator(com.r3corda.contracts.asset.Cash.Commands.Move::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): com.r3corda.contracts.asset.Cash.Commands.Move { +class MoveGenerator : Generator(Cash.Commands.Move::class.java) { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): Cash.Commands.Move { // TODO generate null as well - return com.r3corda.contracts.asset.Cash.Commands.Move(SecureHashGenerator().generate(random, status)) + return Cash.Commands.Move(SecureHashGenerator().generate(random, status)) } } -class IssueGenerator : Generator(com.r3corda.contracts.asset.Cash.Commands.Issue::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): com.r3corda.contracts.asset.Cash.Commands.Issue { - return com.r3corda.contracts.asset.Cash.Commands.Issue(random.nextLong()) +class IssueGenerator : Generator(Cash.Commands.Issue::class.java) { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): Cash.Commands.Issue { + return Cash.Commands.Issue(random.nextLong()) } } -class ExitGenerator : Generator(com.r3corda.contracts.asset.Cash.Commands.Exit::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): com.r3corda.contracts.asset.Cash.Commands.Exit { - return com.r3corda.contracts.asset.Cash.Commands.Exit(AmountGenerator(IssuedGenerator(CurrencyGenerator())).generate(random, status)) +class ExitGenerator : Generator(Cash.Commands.Exit::class.java) { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): Cash.Commands.Exit { + return Cash.Commands.Exit(AmountGenerator(IssuedGenerator(CurrencyGenerator())).generate(random, status)) } } class CommandDataGenerator : Generator(CommandData::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): CommandData { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): CommandData { val generators = listOf(MoveGenerator(), IssueGenerator(), ExitGenerator()) return generators[random.nextInt(0, generators.size - 1)].generate(random, status) } } class CommandGenerator : Generator(Command::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): Command { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): Command { val signersGenerator = ArrayListGenerator() signersGenerator.addComponentGenerators(listOf(PublicKeyGenerator())) return Command(CommandDataGenerator().generate(random, status), PublicKeyGenerator().generate(random, status)) @@ -53,7 +55,7 @@ class CommandGenerator : Generator(Command::class.java) { } class WiredTransactionGenerator: Generator(WireTransaction::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): WireTransaction { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): WireTransaction { val inputsGenerator = ArrayListGenerator() inputsGenerator.addComponentGenerators(listOf(StateRefGenerator())) val attachmentsGenerator = ArrayListGenerator() @@ -77,7 +79,7 @@ class WiredTransactionGenerator: Generator(WireTransaction::cla } class SignedTransactionGenerator: Generator(SignedTransaction::class.java) { - override fun generate(random: com.pholser.junit.quickcheck.random.SourceOfRandomness, status: GenerationStatus): SignedTransaction { + override fun generate(random: SourceOfRandomness, status: GenerationStatus): SignedTransaction { val wireTransaction = WiredTransactionGenerator().generate(random, status) return SignedTransaction( txBits = wireTransaction.serialized,