EmpowerOperations / volition

The Volition Optimization API
https://empowerops.com
6 stars 1 forks source link

add unit test with gradle and update teamcity to run unit test #19

Closed VinnieH closed 5 years ago

VinnieH commented 5 years ago

as title suggested, this is a spike to let us write unit test and run it with our CI I did running into a bit problem with gradle file structure but it was solved by using some auto create empty folder.

I add some test as a good starting point for the system test/unit test that we want to write.

I also need add check on Branch protection rules, I think I need to kick that to @Groostav

VinnieH commented 5 years ago

Couple note on the refactoring work I was doing: since onError() works the same way as onError() and both should be the very last call we don't need to put the onComplete() into the finally block but at the end of try block. ps. This doesn't affect whether finally block is needed in case we need to clean up other resources.

With this, we can also have nice looking logging:

[2019-04-22T13:29:12.276] API INBOUND > empowerops.volition.api.Optimizer/startOptimization [empty message]
Apr 22, 2019 1:29:12 PM io.grpc.internal.SerializingExecutor run
SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@184ee7
io.grpc.StatusRuntimeException: PERMISSION_DENIED
    at com.empowerops.volition.ref_oasis.OptimizerEndpoint.checkThenRun(OptimizerEndPoint.kt:134)
    at com.empowerops.volition.ref_oasis.OptimizerEndpoint.access$checkThenRun(OptimizerEndPoint.kt:8)