Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed compiler_swagger, added simple logging conf for tests, added co…
…mpiler service, added compiler tests
- Loading branch information
Showing
14 changed files
with
2,149 additions
and
740 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.slf4j.simpleLogger.defaultLogLevel=info | ||
org.slf4j.simpleLogger.log.com.kryptokrauts=debug |
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
67 changes: 67 additions & 0 deletions
67
src/integrationTest/java/com/kryptokrauts/aeternity/generated/api/CompilerServiceTest.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,67 @@ | ||
package com.kryptokrauts.aeternity.generated.api; | ||
|
||
import com.kryptokrauts.aeternity.sdk.service.ServiceConfiguration; | ||
import com.kryptokrauts.aeternity.sdk.service.compiler.CompilerService; | ||
import com.kryptokrauts.aeternity.sdk.service.compiler.CompilerServiceFactory; | ||
import com.kryptokrauts.sophia.compiler.generated.model.ByteCode; | ||
import com.kryptokrauts.sophia.compiler.generated.model.Calldata; | ||
import io.reactivex.Single; | ||
import io.vertx.core.Vertx; | ||
import io.vertx.ext.unit.Async; | ||
import io.vertx.ext.unit.TestContext; | ||
import javax.naming.ConfigurationException; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
|
||
public class CompilerServiceTest extends BaseTest { | ||
|
||
protected CompilerService sophiaCompilerService; | ||
|
||
@Before | ||
public void initCompilerService() throws ConfigurationException { | ||
if (sophiaCompilerService == null) { | ||
Vertx vertx = rule.vertx(); | ||
sophiaCompilerService = | ||
new CompilerServiceFactory() | ||
.getService( | ||
ServiceConfiguration.configure() | ||
.contractBaseUrl(getCompilerBaseUrl()) | ||
.vertx(vertx) | ||
.compile()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testCompileContract(TestContext context) { | ||
Async async = context.async(); | ||
Single<ByteCode> byteCode = | ||
this.sophiaCompilerService.compile(TestConstants.testContractSourceCode, null, null); | ||
byteCode.subscribe( | ||
bc -> { | ||
Assertions.assertEquals(bc.getBytecode(), TestConstants.testContractByteCode); | ||
async.complete(); | ||
}, | ||
throwable -> { | ||
throwable.printStackTrace(); | ||
context.fail(); | ||
}); | ||
} | ||
|
||
@Test | ||
public void testEncodeCalldata(TestContext context) { | ||
Async async = context.async(); | ||
Single<Calldata> callData = | ||
this.sophiaCompilerService.encodeCalldata( | ||
TestConstants.testContractSourceCode, "init", null); | ||
callData.subscribe( | ||
cd -> { | ||
Assertions.assertEquals(cd.getCalldata(), TestConstants.testContractCallData); | ||
async.complete(); | ||
}, | ||
throwable -> { | ||
throwable.printStackTrace(); | ||
context.fail(); | ||
}); | ||
} | ||
} |
Oops, something went wrong.