Refactoring splitting Room and Session
This commit is contained in:
parent
12b7224510
commit
965636544e
22
.gitignore
vendored
22
.gitignore
vendored
@ -42,9 +42,6 @@ local.properties
|
||||
# CDT- autotools
|
||||
.autotools
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
@ -57,9 +54,6 @@ local.properties
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
@ -71,15 +65,7 @@ local.properties
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
### Eclipse Patch ###
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Annotation Processing
|
||||
.apt_generated
|
||||
|
||||
.sts4-cache/
|
||||
|
||||
@ -172,7 +158,7 @@ $RECYCLE.BIN/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
/build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
@ -185,17 +171,11 @@ build/
|
||||
.#*
|
||||
*#
|
||||
*~
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
bin
|
||||
build
|
||||
target
|
||||
dependency-reduced-pom.xml
|
||||
*.sublime-*
|
||||
/scratch
|
||||
.gradle
|
||||
README.html
|
||||
*.iml
|
||||
.idea
|
||||
.exercism
|
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -7,7 +7,7 @@
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="app" />
|
||||
<module name="social_altruism" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="19" />
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,170 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
|
||||
<title>Test results - Class dev.freireservices.social_altruism.chat.PotQuickStartTest</title>
|
||||
<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../js/report.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>Class dev.freireservices.social_altruism.chat.PotQuickStartTest</h1>
|
||||
<div class="breadcrumbs">
|
||||
<a href="../index.html">all</a> >
|
||||
<a href="../packages/dev.freireservices.social_altruism.chat.html">dev.freireservices.social_altruism.chat</a> > ChatQuickStartTest</div>
|
||||
<div id="summary">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="summaryGroup">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="infoBox" id="tests">
|
||||
<div class="counter">1</div>
|
||||
<p>tests</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="failures">
|
||||
<div class="counter">1</div>
|
||||
<p>failures</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="ignored">
|
||||
<div class="counter">0</div>
|
||||
<p>ignored</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="duration">
|
||||
<div class="counter">10.961s</div>
|
||||
<p>duration</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox failures" id="successRate">
|
||||
<div class="percent">0%</div>
|
||||
<p>successful</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul class="tabLinks">
|
||||
<li>
|
||||
<a href="#tab0">Failed tests</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab1">Tests</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab2">Standard output</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="tab0" class="tab">
|
||||
<h2>Failed tests</h2>
|
||||
<div class="test">
|
||||
<a name="testGreeterActorSendingOfGreeting"></a>
|
||||
<h3 class="failures">testGreeterActorSendingOfGreeting</h3>
|
||||
<span class="code">
|
||||
<pre>java.lang.AssertionError: Timeout (10 seconds) during expectMessageClass waiting for class dev.freireservices.social_altruism.chat.potroom.PotRoom$PotReturned
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.assertFail(TestProbeImpl.scala:399)
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.expectMessageClass_internal(TestProbeImpl.scala:239)
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.expectMessageClass(TestProbeImpl.scala:227)
|
||||
at dev.freireservices.social_altruism.chat.PotQuickStartTest.testGreeterActorSendingOfGreeting(ChatQuickStartTest.java:35)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
|
||||
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
|
||||
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
|
||||
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
|
||||
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
|
||||
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
|
||||
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
|
||||
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
|
||||
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
|
||||
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
|
||||
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
|
||||
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
|
||||
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
|
||||
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
|
||||
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
|
||||
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:57)
|
||||
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:39)
|
||||
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
|
||||
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
|
||||
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
|
||||
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
|
||||
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
|
||||
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
|
||||
at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
|
||||
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
|
||||
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
|
||||
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
|
||||
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
|
||||
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
|
||||
</pre>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab1" class="tab">
|
||||
<h2>Tests</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test</th>
|
||||
<th>Duration</th>
|
||||
<th>Result</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td class="failures">testGreeterActorSendingOfGreeting</td>
|
||||
<td class="failures">10.961s</td>
|
||||
<td class="failures">failed</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab2" class="tab">
|
||||
<h2>Standard output</h2>
|
||||
<span class="code">
|
||||
<pre>[2023-12-23 11:22:37,346] [INFO] [akka.event.slf4j.Slf4jLogger] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [] - Slf4jLogger started
|
||||
[2023-12-23 11:22:37,495] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteUno turn pot: 10.0
|
||||
[2023-12-23 11:22:37,497] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Waiting for more participants.
|
||||
[2023-12-23 11:22:37,498] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteDos turn pot: 1.0
|
||||
[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - All participants joined; beginning turn: 11.0
|
||||
[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Starting pot: 11.0
|
||||
[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-5] [akka://ChatQuickStartTest/user/participanteUno] - Pot returned: 11.0
|
||||
[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/participanteDos] - Pot returned: 11.0
|
||||
</pre>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>
|
||||
<div>
|
||||
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
|
||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||
</label>
|
||||
</div>Generated by
|
||||
<a href="http://www.gradle.org">Gradle 7.6</a> at 23 dic 2023, 11:22:47</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,179 +0,0 @@
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: sans-serif;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
body, a, a:visited {
|
||||
color: #303030;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
padding-top: 30px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
#content h1 {
|
||||
font-size: 160%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
margin-top: 100px;
|
||||
font-size: 80%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#footer, #footer a {
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
#line-wrapping-toggle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#label-for-line-wrapping-toggle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
ul.tabLinks {
|
||||
padding-left: 0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
overflow: auto;
|
||||
min-width: 800px;
|
||||
width: auto !important;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
ul.tabLinks li {
|
||||
float: left;
|
||||
height: 100%;
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 0;
|
||||
-moz-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
margin-right: 25px;
|
||||
border: solid 1px #d4d4d4;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
ul.tabLinks li:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
ul.tabLinks li.selected {
|
||||
background-color: #c5f0f5;
|
||||
border-color: #c5f0f5;
|
||||
}
|
||||
|
||||
ul.tabLinks a {
|
||||
font-size: 120%;
|
||||
display: block;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.tabLinks li h2 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.tab {
|
||||
}
|
||||
|
||||
div.selected {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.deselected {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.tab table {
|
||||
min-width: 350px;
|
||||
width: auto !important;
|
||||
width: 350px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
div.tab th, div.tab table {
|
||||
border-bottom: solid #d0d0d0 1px;
|
||||
}
|
||||
|
||||
div.tab th {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
padding-left: 6em;
|
||||
}
|
||||
|
||||
div.tab th:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
div.tab td {
|
||||
white-space: nowrap;
|
||||
padding-left: 6em;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
div.tab td:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
div.tab td.numeric, div.tab th.numeric {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
span.code {
|
||||
display: inline-block;
|
||||
margin-top: 0em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
span.code pre {
|
||||
font-size: 11pt;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
margin: 0;
|
||||
background-color: #f7f7f7;
|
||||
border: solid 1px #d0d0d0;
|
||||
min-width: 700px;
|
||||
width: auto !important;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
span.wrapped pre {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
label.hidden {
|
||||
display: none;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
|
||||
#summary {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
#summary table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
#summary td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.breadcrumbs, .breadcrumbs a {
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
.infoBox {
|
||||
width: 110px;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.infoBox p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.counter, .percent {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
#duration {
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
#successRate, .summaryGroup {
|
||||
border: solid 2px #d0d0d0;
|
||||
-moz-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#successRate {
|
||||
width: 140px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
|
||||
#successRate .percent {
|
||||
font-size: 180%;
|
||||
}
|
||||
|
||||
.success, .success a {
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
div.success, #successRate.success {
|
||||
background-color: #bbd9bb;
|
||||
border-color: #008000;
|
||||
}
|
||||
|
||||
.failures, .failures a {
|
||||
color: #b60808;
|
||||
}
|
||||
|
||||
.skipped, .skipped a {
|
||||
color: #c09853;
|
||||
}
|
||||
|
||||
div.failures, #successRate.failures {
|
||||
background-color: #ecdada;
|
||||
border-color: #b60808;
|
||||
}
|
||||
|
||||
ul.linkList {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
ul.linkList li {
|
||||
list-style: none;
|
||||
margin-bottom: 5px;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
|
||||
<title>Test results - Test Summary</title>
|
||||
<link href="css/base-style.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="js/report.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>Test Summary</h1>
|
||||
<div id="summary">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="summaryGroup">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="infoBox" id="tests">
|
||||
<div class="counter">1</div>
|
||||
<p>tests</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="failures">
|
||||
<div class="counter">1</div>
|
||||
<p>failures</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="ignored">
|
||||
<div class="counter">0</div>
|
||||
<p>ignored</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="duration">
|
||||
<div class="counter">10.961s</div>
|
||||
<p>duration</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox failures" id="successRate">
|
||||
<div class="percent">0%</div>
|
||||
<p>successful</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul class="tabLinks">
|
||||
<li>
|
||||
<a href="#tab0">Failed tests</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab1">Packages</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab2">Classes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="tab0" class="tab">
|
||||
<h2>Failed tests</h2>
|
||||
<ul class="linkList">
|
||||
<li>
|
||||
<a href="classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html">ChatQuickStartTest</a>.
|
||||
<a href="classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html#testGreeterActorSendingOfGreeting">testGreeterActorSendingOfGreeting</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="tab1" class="tab">
|
||||
<h2>Packages</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Package</th>
|
||||
<th>Tests</th>
|
||||
<th>Failures</th>
|
||||
<th>Ignored</th>
|
||||
<th>Duration</th>
|
||||
<th>Success rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="failures">
|
||||
<a href="packages/dev.freireservices.social_altruism.chat.html">dev.freireservices.social_altruism.chat</a>
|
||||
</td>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td>0</td>
|
||||
<td>10.961s</td>
|
||||
<td class="failures">0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab2" class="tab">
|
||||
<h2>Classes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<th>Tests</th>
|
||||
<th>Failures</th>
|
||||
<th>Ignored</th>
|
||||
<th>Duration</th>
|
||||
<th>Success rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="failures">
|
||||
<a href="classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html">dev.freireservices.social_altruism.chat.PotQuickStartTest</a>
|
||||
</td>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td>0</td>
|
||||
<td>10.961s</td>
|
||||
<td class="failures">0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>
|
||||
<div>
|
||||
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
|
||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||
</label>
|
||||
</div>Generated by
|
||||
<a href="http://www.gradle.org">Gradle 7.6</a> at 23 dic 2023, 11:22:47</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,194 +0,0 @@
|
||||
(function (window, document) {
|
||||
"use strict";
|
||||
|
||||
var tabs = {};
|
||||
|
||||
function changeElementClass(element, classValue) {
|
||||
if (element.getAttribute("className")) {
|
||||
element.setAttribute("className", classValue);
|
||||
} else {
|
||||
element.setAttribute("class", classValue);
|
||||
}
|
||||
}
|
||||
|
||||
function getClassAttribute(element) {
|
||||
if (element.getAttribute("className")) {
|
||||
return element.getAttribute("className");
|
||||
} else {
|
||||
return element.getAttribute("class");
|
||||
}
|
||||
}
|
||||
|
||||
function addClass(element, classValue) {
|
||||
changeElementClass(element, getClassAttribute(element) + " " + classValue);
|
||||
}
|
||||
|
||||
function removeClass(element, classValue) {
|
||||
changeElementClass(element, getClassAttribute(element).replace(classValue, ""));
|
||||
}
|
||||
|
||||
function initTabs() {
|
||||
var container = document.getElementById("tabs");
|
||||
|
||||
tabs.tabs = findTabs(container);
|
||||
tabs.titles = findTitles(tabs.tabs);
|
||||
tabs.headers = findHeaders(container);
|
||||
tabs.select = select;
|
||||
tabs.deselectAll = deselectAll;
|
||||
tabs.select(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getCheckBox() {
|
||||
return document.getElementById("line-wrapping-toggle");
|
||||
}
|
||||
|
||||
function getLabelForCheckBox() {
|
||||
return document.getElementById("label-for-line-wrapping-toggle");
|
||||
}
|
||||
|
||||
function findCodeBlocks() {
|
||||
var spans = document.getElementById("tabs").getElementsByTagName("span");
|
||||
var codeBlocks = [];
|
||||
for (var i = 0; i < spans.length; ++i) {
|
||||
if (spans[i].className.indexOf("code") >= 0) {
|
||||
codeBlocks.push(spans[i]);
|
||||
}
|
||||
}
|
||||
return codeBlocks;
|
||||
}
|
||||
|
||||
function forAllCodeBlocks(operation) {
|
||||
var codeBlocks = findCodeBlocks();
|
||||
|
||||
for (var i = 0; i < codeBlocks.length; ++i) {
|
||||
operation(codeBlocks[i], "wrapped");
|
||||
}
|
||||
}
|
||||
|
||||
function toggleLineWrapping() {
|
||||
var checkBox = getCheckBox();
|
||||
|
||||
if (checkBox.checked) {
|
||||
forAllCodeBlocks(addClass);
|
||||
} else {
|
||||
forAllCodeBlocks(removeClass);
|
||||
}
|
||||
}
|
||||
|
||||
function initControls() {
|
||||
if (findCodeBlocks().length > 0) {
|
||||
var checkBox = getCheckBox();
|
||||
var label = getLabelForCheckBox();
|
||||
|
||||
checkBox.onclick = toggleLineWrapping;
|
||||
checkBox.checked = false;
|
||||
|
||||
removeClass(label, "hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function switchTab() {
|
||||
var id = this.id.substr(1);
|
||||
|
||||
for (var i = 0; i < tabs.tabs.length; i++) {
|
||||
if (tabs.tabs[i].id === id) {
|
||||
tabs.select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function select(i) {
|
||||
this.deselectAll();
|
||||
|
||||
changeElementClass(this.tabs[i], "tab selected");
|
||||
changeElementClass(this.headers[i], "selected");
|
||||
|
||||
while (this.headers[i].firstChild) {
|
||||
this.headers[i].removeChild(this.headers[i].firstChild);
|
||||
}
|
||||
|
||||
var h2 = document.createElement("H2");
|
||||
|
||||
h2.appendChild(document.createTextNode(this.titles[i]));
|
||||
this.headers[i].appendChild(h2);
|
||||
}
|
||||
|
||||
function deselectAll() {
|
||||
for (var i = 0; i < this.tabs.length; i++) {
|
||||
changeElementClass(this.tabs[i], "tab deselected");
|
||||
changeElementClass(this.headers[i], "deselected");
|
||||
|
||||
while (this.headers[i].firstChild) {
|
||||
this.headers[i].removeChild(this.headers[i].firstChild);
|
||||
}
|
||||
|
||||
var a = document.createElement("A");
|
||||
|
||||
a.setAttribute("id", "ltab" + i);
|
||||
a.setAttribute("href", "#tab" + i);
|
||||
a.onclick = switchTab;
|
||||
a.appendChild(document.createTextNode(this.titles[i]));
|
||||
|
||||
this.headers[i].appendChild(a);
|
||||
}
|
||||
}
|
||||
|
||||
function findTabs(container) {
|
||||
return findChildElements(container, "DIV", "tab");
|
||||
}
|
||||
|
||||
function findHeaders(container) {
|
||||
var owner = findChildElements(container, "UL", "tabLinks");
|
||||
return findChildElements(owner[0], "LI", null);
|
||||
}
|
||||
|
||||
function findTitles(tabs) {
|
||||
var titles = [];
|
||||
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
var tab = tabs[i];
|
||||
var header = findChildElements(tab, "H2", null)[0];
|
||||
|
||||
header.parentNode.removeChild(header);
|
||||
|
||||
if (header.innerText) {
|
||||
titles.push(header.innerText);
|
||||
} else {
|
||||
titles.push(header.textContent);
|
||||
}
|
||||
}
|
||||
|
||||
return titles;
|
||||
}
|
||||
|
||||
function findChildElements(container, name, targetClass) {
|
||||
var elements = [];
|
||||
var children = container.childNodes;
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children.item(i);
|
||||
|
||||
if (child.nodeType === 1 && child.nodeName === name) {
|
||||
if (targetClass && child.className.indexOf(targetClass) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
elements.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
// Entry point.
|
||||
|
||||
window.onload = function() {
|
||||
initTabs();
|
||||
initControls();
|
||||
};
|
||||
} (window, window.document));
|
@ -1,115 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
|
||||
<title>Test results - Package dev.freireservices.social_altruism.chat</title>
|
||||
<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../js/report.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>Package dev.freireservices.social_altruism.chat</h1>
|
||||
<div class="breadcrumbs">
|
||||
<a href="../index.html">all</a> > dev.freireservices.social_altruism.chat</div>
|
||||
<div id="summary">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="summaryGroup">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="infoBox" id="tests">
|
||||
<div class="counter">1</div>
|
||||
<p>tests</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="failures">
|
||||
<div class="counter">1</div>
|
||||
<p>failures</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="ignored">
|
||||
<div class="counter">0</div>
|
||||
<p>ignored</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="duration">
|
||||
<div class="counter">10.961s</div>
|
||||
<p>duration</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox failures" id="successRate">
|
||||
<div class="percent">0%</div>
|
||||
<p>successful</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul class="tabLinks">
|
||||
<li>
|
||||
<a href="#tab0">Failed tests</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab1">Classes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="tab0" class="tab">
|
||||
<h2>Failed tests</h2>
|
||||
<ul class="linkList">
|
||||
<li>
|
||||
<a href="../classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html">ChatQuickStartTest</a>.
|
||||
<a href="../classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html#testGreeterActorSendingOfGreeting">testGreeterActorSendingOfGreeting</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="tab1" class="tab">
|
||||
<h2>Classes</h2>
|
||||
<table>
|
||||
<thread>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<th>Tests</th>
|
||||
<th>Failures</th>
|
||||
<th>Ignored</th>
|
||||
<th>Duration</th>
|
||||
<th>Success rate</th>
|
||||
</tr>
|
||||
</thread>
|
||||
<tr>
|
||||
<td class="failures">
|
||||
<a href="../classes/dev.freireservices.social_altruism.chat.PotQuickStartTest.html">ChatQuickStartTest</a>
|
||||
</td>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td>0</td>
|
||||
<td>10.961s</td>
|
||||
<td class="failures">0%</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>
|
||||
<div>
|
||||
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
|
||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||
</label>
|
||||
</div>Generated by
|
||||
<a href="http://www.gradle.org">Gradle 7.6</a> at 23 dic 2023, 11:22:47</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- This is a development logging configuration that logs to standard out, for an example of a production
|
||||
logging config, see the Akka docs: https://doc.akka.io/docs/akka/2.6/typed/logging.html#logback -->
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>[%date{ISO8601}] [%level] [%logger] [%thread] [%X{akkaSource}] - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>1024</queueSize>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="STDOUT" />
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ASYNC"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite name="dev.freireservices.social_altruism.chat.PotQuickStartTest" tests="1" skipped="0" failures="1" errors="0" timestamp="2023-12-23T10:22:36" hostname="MacBook-Pro.local" time="10.961">
|
||||
<properties/>
|
||||
<testcase name="testGreeterActorSendingOfGreeting" classname="dev.freireservices.social_altruism.chat.PotQuickStartTest" time="10.961">
|
||||
<failure message="java.lang.AssertionError: Timeout (10 seconds) during expectMessageClass waiting for class dev.freireservices.social_altruism.chat.potroom.PotRoom$PotReturned" type="java.lang.AssertionError">java.lang.AssertionError:
|
||||
Timeout (10 seconds) during expectMessageClass waiting for class
|
||||
dev.freireservices.social_altruism.chat.potroom.PotRoom$PotReturned
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.assertFail(TestProbeImpl.scala:399)
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.expectMessageClass_internal(TestProbeImpl.scala:239)
|
||||
at akka.actor.testkit.typed.internal.TestProbeImpl.expectMessageClass(TestProbeImpl.scala:227)
|
||||
at
|
||||
dev.freireservices.social_altruism.chat.PotQuickStartTest.testGreeterActorSendingOfGreeting(ChatQuickStartTest.java:35)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
|
||||
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
|
||||
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
|
||||
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
|
||||
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
|
||||
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
|
||||
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
|
||||
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
|
||||
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
|
||||
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
|
||||
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
|
||||
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
|
||||
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
|
||||
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
|
||||
at
|
||||
org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
|
||||
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:57)
|
||||
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:39)
|
||||
at
|
||||
org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
|
||||
at
|
||||
org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
|
||||
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
|
||||
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
|
||||
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
|
||||
at
|
||||
org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
|
||||
at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
|
||||
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
|
||||
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
|
||||
at
|
||||
org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
|
||||
at
|
||||
org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
|
||||
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
|
||||
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
|
||||
</failure>
|
||||
</testcase>
|
||||
<system-out><![CDATA[[2023-12-23 11:22:37,346] [INFO] [akka.event.slf4j.Slf4jLogger] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [] - Slf4jLogger started
|
||||
[2023-12-23 11:22:37,495] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteUno turn pot: 10.0
|
||||
[2023-12-23 11:22:37,497] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Waiting for more participants.
|
||||
[2023-12-23 11:22:37,498] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteDos turn pot: 1.0
|
||||
[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - All participants joined; beginning turn: 11.0
|
||||
[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Starting pot: 11.0
|
||||
[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-5] [akka://ChatQuickStartTest/user/participanteUno] - Pot returned: 11.0
|
||||
[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/participanteDos] - Pot returned: 11.0
|
||||
]]></system-out>
|
||||
<system-err><![CDATA[]]></system-err>
|
||||
</testsuite>
|
@ -1,8 +0,0 @@
|
||||
Ž[2023-12-23 11:22:37,346] [INFO] [akka.event.slf4j.Slf4jLogger] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [] - Slf4jLogger started
|
||||
î[2023-12-23 11:22:37,495] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteUno turn pot: 10.0
|
||||
Û[2023-12-23 11:22:37,497] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Waiting for more participants.
|
||||
í[2023-12-23 11:22:37,498] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Participant joined participanteDos turn pot: 1.0
|
||||
ê[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - All participants joined; beginning turn: 11.0
|
||||
Ï[2023-12-23 11:22:37,500] [INFO] [dev.freireservices.social_altruism.chat.ChatPotProtocol] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/chatRoom] - Starting pot: 11.0
|
||||
Ó[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-5] [akka://ChatQuickStartTest/user/participanteUno] - Pot returned: 11.0
|
||||
Ó[2023-12-23 11:22:37,502] [INFO] [dev.freireservices.social_altruism.chat.Participante] [ChatQuickStartTest-akka.actor.default-dispatcher-3] [akka://ChatQuickStartTest/user/participanteDos] - Pot returned: 11.0
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
17
pom.xml
17
pom.xml
@ -66,6 +66,23 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.8.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy -->
|
||||
<dependency>
|
||||
<groupId>net.bytebuddy</groupId>
|
||||
<artifactId>byte-buddy</artifactId>
|
||||
<version>1.14.11</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
@ -1 +0,0 @@
|
||||
sbt.version=1.9.8
|
605
sbt-dist/bin/sbt
605
sbt-dist/bin/sbt
@ -1,605 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set +e
|
||||
declare -a residual_args
|
||||
declare -a java_args
|
||||
declare -a scalac_args
|
||||
declare -a sbt_commands
|
||||
declare -a sbt_options
|
||||
declare -a print_version
|
||||
declare -a print_sbt_version
|
||||
declare -a print_sbt_script_version
|
||||
declare java_cmd=java
|
||||
declare java_version
|
||||
declare init_sbt_version=_to_be_replaced
|
||||
declare sbt_default_mem=1024
|
||||
declare -r default_sbt_opts=""
|
||||
declare -r default_java_opts="-Dfile.encoding=UTF-8"
|
||||
declare sbt_verbose=
|
||||
declare sbt_debug=
|
||||
|
||||
### ------------------------------- ###
|
||||
### Helper methods for BASH scripts ###
|
||||
### ------------------------------- ###
|
||||
|
||||
# Bash reimplementation of realpath to return the absolute path
|
||||
realpathish () {
|
||||
(
|
||||
TARGET_FILE="$1"
|
||||
FIX_CYGPATH="$2"
|
||||
|
||||
cd "$(dirname "$TARGET_FILE")"
|
||||
TARGET_FILE=$(basename "$TARGET_FILE")
|
||||
|
||||
COUNT=0
|
||||
while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ]
|
||||
do
|
||||
TARGET_FILE=$(readlink "$TARGET_FILE")
|
||||
cd "$(dirname "$TARGET_FILE")"
|
||||
TARGET_FILE=$(basename "$TARGET_FILE")
|
||||
COUNT=$(($COUNT + 1))
|
||||
done
|
||||
|
||||
# make sure we grab the actual windows path, instead of cygwin's path.
|
||||
if [[ "x$FIX_CYGPATH" != "x" ]]; then
|
||||
echo "$(cygwinpath "$(pwd -P)/$TARGET_FILE")"
|
||||
else
|
||||
echo "$(pwd -P)/$TARGET_FILE"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
# Uses uname to detect if we're in the odd cygwin environment.
|
||||
is_cygwin() {
|
||||
local os=$(uname -s)
|
||||
case "$os" in
|
||||
CYGWIN*) return 0 ;;
|
||||
MINGW*) return 0 ;;
|
||||
MSYS*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# TODO - Use nicer bash-isms here.
|
||||
CYGWIN_FLAG=$(if is_cygwin; then echo true; else echo false; fi)
|
||||
|
||||
# This can fix cygwin style /cygdrive paths so we get the
|
||||
# windows style paths.
|
||||
cygwinpath() {
|
||||
local file="$1"
|
||||
if [[ "$CYGWIN_FLAG" == "true" ]]; then #"
|
||||
echo $(cygpath -w $file)
|
||||
else
|
||||
echo $file
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")"
|
||||
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
|
||||
|
||||
echoerr () {
|
||||
echo 1>&2 "$@"
|
||||
}
|
||||
vlog () {
|
||||
[[ $sbt_verbose || $sbt_debug ]] && echoerr "$@"
|
||||
}
|
||||
dlog () {
|
||||
[[ $sbt_debug ]] && echoerr "$@"
|
||||
}
|
||||
|
||||
jar_file () {
|
||||
echo "$(cygwinpath "${sbt_home}/bin/sbt-launch.jar")"
|
||||
}
|
||||
|
||||
acquire_sbt_jar () {
|
||||
sbt_jar="$(jar_file)"
|
||||
|
||||
if [[ ! -f "$sbt_jar" ]]; then
|
||||
echoerr "Could not find launcher jar: $sbt_jar"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
rt_export_file () {
|
||||
echo "${sbt_bin_dir}/java9-rt-export.jar"
|
||||
}
|
||||
|
||||
# execRunner should be called only once to give up control to java
|
||||
execRunner () {
|
||||
# print the arguments one to a line, quoting any containing spaces
|
||||
[[ $sbt_verbose || $sbt_debug ]] && echo "# Executing command line:" && {
|
||||
for arg; do
|
||||
if printf "%s\n" "$arg" | grep -q ' '; then
|
||||
printf "\"%s\"\n" "$arg"
|
||||
else
|
||||
printf "%s\n" "$arg"
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [[ "$CYGWIN_FLAG" == "true" ]]; then
|
||||
# In cygwin we loose the ability to re-hook stty if exec is used
|
||||
# https://github.com/sbt/sbt-launcher-package/issues/53
|
||||
"$@"
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
addJava () {
|
||||
dlog "[addJava] arg = '$1'"
|
||||
java_args=( "${java_args[@]}" "$1" )
|
||||
}
|
||||
addSbt () {
|
||||
dlog "[addSbt] arg = '$1'"
|
||||
sbt_commands=( "${sbt_commands[@]}" "$1" )
|
||||
}
|
||||
addResidual () {
|
||||
dlog "[residual] arg = '$1'"
|
||||
residual_args=( "${residual_args[@]}" "$1" )
|
||||
}
|
||||
addDebugger () {
|
||||
addJava "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$1"
|
||||
}
|
||||
|
||||
addMemory () {
|
||||
dlog "[addMemory] arg = '$1'"
|
||||
# evict memory related options
|
||||
local xs=("${java_args[@]}")
|
||||
java_args=()
|
||||
for i in "${xs[@]}"; do
|
||||
if ! [[ "${i}" == *-Xmx* ]] && ! [[ "${i}" == *-Xms* ]] && ! [[ "${i}" == *-XX:MaxPermSize* ]] && ! [[ "${i}" == *-XX:MaxMetaspaceSize* ]] && ! [[ "${i}" == *-XX:ReservedCodeCacheSize* ]]; then
|
||||
java_args+=("${i}")
|
||||
fi
|
||||
done
|
||||
local ys=("${sbt_options[@]}")
|
||||
sbt_options=()
|
||||
for i in "${ys[@]}"; do
|
||||
if ! [[ "${i}" == *-Xmx* ]] && ! [[ "${i}" == *-Xms* ]] && ! [[ "${i}" == *-XX:MaxPermSize* ]] && ! [[ "${i}" == *-XX:MaxMetaspaceSize* ]] && ! [[ "${i}" == *-XX:ReservedCodeCacheSize* ]]; then
|
||||
sbt_options+=("${i}")
|
||||
fi
|
||||
done
|
||||
# a ham-fisted attempt to move some memory settings in concert
|
||||
local mem=$1
|
||||
local codecache=$(( $mem / 8 ))
|
||||
(( $codecache > 128 )) || codecache=128
|
||||
(( $codecache < 512 )) || codecache=512
|
||||
local class_metadata_size=$(( $codecache * 2 ))
|
||||
if [[ -z $java_version ]]; then
|
||||
java_version=$(jdk_version)
|
||||
fi
|
||||
|
||||
addJava "-Xms${mem}m"
|
||||
addJava "-Xmx${mem}m"
|
||||
addJava "-Xss4M"
|
||||
addJava "-XX:ReservedCodeCacheSize=${codecache}m"
|
||||
(( $java_version >= 8 )) || addJava "-XX:MaxPermSize=${class_metadata_size}m"
|
||||
}
|
||||
|
||||
addDefaultMemory() {
|
||||
# if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} we need to NOT output our settings.
|
||||
# The reason is the Xms/Xmx, if they don't line up, cause errors.
|
||||
if [[ "${java_args[@]}" == *-Xmx* ]] || \
|
||||
[[ "${java_args[@]}" == *-Xms* ]] || \
|
||||
[[ "${java_args[@]}" == *-XX:+UseCGroupMemoryLimitForHeap* ]] || \
|
||||
[[ "${java_args[@]}" == *-XX:MaxRAM* ]] || \
|
||||
[[ "${java_args[@]}" == *-XX:InitialRAMPercentage* ]] || \
|
||||
[[ "${java_args[@]}" == *-XX:MaxRAMPercentage* ]] || \
|
||||
[[ "${java_args[@]}" == *-XX:MinRAMPercentage* ]]; then
|
||||
:
|
||||
elif [[ "${JAVA_TOOL_OPTIONS}" == *-Xmx* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-Xms* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:+UseCGroupMemoryLimitForHeap* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxRAM* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:InitialRAMPercentage* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxRAMPercentage* ]] || \
|
||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MinRAMPercentage* ]] ; then
|
||||
:
|
||||
elif [[ "${sbt_options[@]}" == *-Xmx* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-Xms* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-XX:+UseCGroupMemoryLimitForHeap* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-XX:MaxRAM* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-XX:InitialRAMPercentage* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-XX:MaxRAMPercentage* ]] || \
|
||||
[[ "${sbt_options[@]}" == *-XX:MinRAMPercentage* ]] ; then
|
||||
:
|
||||
else
|
||||
addMemory $sbt_default_mem
|
||||
fi
|
||||
}
|
||||
|
||||
require_arg () {
|
||||
local type="$1"
|
||||
local opt="$2"
|
||||
local arg="$3"
|
||||
if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then
|
||||
echo "$opt requires <$type> argument"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_function_defined() {
|
||||
declare -f "$1" > /dev/null
|
||||
}
|
||||
|
||||
# parses JDK version from the -version output line.
|
||||
# 8 for 1.8.0_nn, 9 for 9-ea etc, and "no_java" for undetected
|
||||
jdk_version() {
|
||||
local result
|
||||
local lines=$("$java_cmd" -Xms32M -Xmx32M -version 2>&1 | tr '\r' '\n')
|
||||
local IFS=$'\n'
|
||||
for line in $lines; do
|
||||
if [[ (-z $result) && ($line = *"version \""*) ]]
|
||||
then
|
||||
local ver=$(echo $line | sed -e 's/.*version "\(.*\)"\(.*\)/\1/; 1q')
|
||||
# on macOS sed doesn't support '?'
|
||||
if [[ $ver = "1."* ]]
|
||||
then
|
||||
result=$(echo $ver | sed -e 's/1\.\([0-9]*\)\(.*\)/\1/; 1q')
|
||||
else
|
||||
result=$(echo $ver | sed -e 's/\([0-9]*\)\(.*\)/\1/; 1q')
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ -z $result ]]
|
||||
then
|
||||
result=no_java
|
||||
fi
|
||||
echo "$result"
|
||||
}
|
||||
|
||||
# Extracts the preloaded directory from either -Dsbt.preloaded or -Dsbt.global.base
|
||||
# properties by looking at:
|
||||
# - _JAVA_OPTIONS environment variable,
|
||||
# - SBT_OPTS environment variable,
|
||||
# - JAVA_OPTS environment variable and
|
||||
# - properties set by command-line options
|
||||
# in that order. The last one will be chosen such that `sbt.preloaded` is
|
||||
# always preferred over `sbt.global.base`.
|
||||
getPreloaded() {
|
||||
local -a _java_options_array
|
||||
local -a sbt_opts_array
|
||||
local -a java_opts_array
|
||||
read -a _java_options_array <<< "$_JAVA_OPTIONS"
|
||||
read -a sbt_opts_array <<< "$SBT_OPTS"
|
||||
read -a java_opts_array <<< "$JAVA_OPTS"
|
||||
|
||||
local args_to_check=(
|
||||
"${_java_options_array[@]}"
|
||||
"${sbt_opts_array[@]}"
|
||||
"${java_opts_array[@]}"
|
||||
"${java_args[@]}")
|
||||
local via_global_base="$HOME/.sbt/preloaded"
|
||||
local via_explicit=""
|
||||
|
||||
for opt in "${args_to_check[@]}"; do
|
||||
if [[ "$opt" == -Dsbt.preloaded=* ]]; then
|
||||
via_explicit="${opt#-Dsbt.preloaded=}"
|
||||
elif [[ "$opt" == -Dsbt.global.base=* ]]; then
|
||||
via_global_base="${opt#-Dsbt.global.base=}/preloaded"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${via_explicit:-${via_global_base}}"
|
||||
}
|
||||
|
||||
syncPreloaded() {
|
||||
local source_preloaded="$sbt_home/lib/local-preloaded/"
|
||||
local target_preloaded="$(getPreloaded)"
|
||||
if [[ "$init_sbt_version" == "" ]]; then
|
||||
# FIXME: better $init_sbt_version detection
|
||||
init_sbt_version="$(ls -1 "$source_preloaded/org/scala-sbt/sbt/")"
|
||||
fi
|
||||
[[ -f "$target_preloaded/org/scala-sbt/sbt/$init_sbt_version/" ]] || {
|
||||
# lib/local-preloaded exists (This is optional)
|
||||
[[ -d "$source_preloaded" ]] && {
|
||||
command -v rsync >/dev/null 2>&1 && {
|
||||
mkdir -p "$target_preloaded"
|
||||
rsync --recursive --links --perms --times --ignore-existing "$source_preloaded" "$target_preloaded" || true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Detect that we have java installed.
|
||||
checkJava() {
|
||||
local required_version="$1"
|
||||
# Now check to see if it's a good enough version
|
||||
local good_enough="$(expr $java_version ">=" $required_version)"
|
||||
if [[ "$java_version" == "" ]]; then
|
||||
echo
|
||||
echo "No Java Development Kit (JDK) installation was detected."
|
||||
echo Please go to http://www.oracle.com/technetwork/java/javase/downloads/ and download.
|
||||
echo
|
||||
exit 1
|
||||
elif [[ "$good_enough" != "1" ]]; then
|
||||
echo
|
||||
echo "The Java Development Kit (JDK) installation you have is not up to date."
|
||||
echo $script_name requires at least version $required_version+, you have
|
||||
echo version $java_version
|
||||
echo
|
||||
echo Please go to http://www.oracle.com/technetwork/java/javase/downloads/ and download
|
||||
echo a valid JDK and install before running $script_name.
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
copyRt() {
|
||||
local at_least_9="$(expr $java_version ">=" 9)"
|
||||
if [[ "$at_least_9" == "1" ]]; then
|
||||
rtexport=$(rt_export_file)
|
||||
# The grep for java9-rt-ext- matches the filename prefix printed in Export.java
|
||||
java9_ext=$("$java_cmd" "${sbt_options[@]}" "${java_args[@]}" \
|
||||
-jar "$rtexport" --rt-ext-dir | grep java9-rt-ext-)
|
||||
java9_rt=$(echo "$java9_ext/rt.jar")
|
||||
vlog "[copyRt] java9_rt = '$java9_rt'"
|
||||
if [[ ! -f "$java9_rt" ]]; then
|
||||
echo copying runtime jar...
|
||||
mkdir -p "$java9_ext"
|
||||
"$java_cmd" \
|
||||
"${sbt_options[@]}" \
|
||||
"${java_args[@]}" \
|
||||
-jar "$rtexport" \
|
||||
"${java9_rt}"
|
||||
fi
|
||||
addJava "-Dscala.ext.dirs=${java9_ext}"
|
||||
fi
|
||||
}
|
||||
|
||||
run() {
|
||||
java_args=($JAVA_OPTS)
|
||||
sbt_options0=(${SBT_OPTS:-$default_sbt_opts})
|
||||
|
||||
# Split SBT_OPTS into options/commands
|
||||
miniscript=$(map_args "${sbt_options0[@]}") && eval "${miniscript/options/sbt_options}" && \
|
||||
eval "${miniscript/commands/sbt_additional_commands}"
|
||||
|
||||
# Combine command line options/commands and commands from SBT_OPTS
|
||||
miniscript=$(map_args "$@") && eval "${miniscript/options/cli_options}" && eval "${miniscript/commands/cli_commands}"
|
||||
args1=( "${cli_options[@]}" "${cli_commands[@]}" "${sbt_additional_commands[@]}" )
|
||||
|
||||
# process the combined args, then reset "$@" to the residuals
|
||||
process_args "${args1[@]}"
|
||||
vlog "[sbt_options] $(declare -p sbt_options)"
|
||||
|
||||
addDefaultMemory
|
||||
set -- "${residual_args[@]}"
|
||||
argumentCount=$#
|
||||
|
||||
# Copy preloaded repo to user's preloaded directory
|
||||
syncPreloaded
|
||||
|
||||
# no jar? download it.
|
||||
[[ -f "$sbt_jar" ]] || acquire_sbt_jar "$sbt_version" || {
|
||||
# still no jar? uh-oh.
|
||||
echo "Download failed. Obtain the sbt-launch.jar manually and place it at $sbt_jar"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# TODO - java check should be configurable...
|
||||
checkJava "6"
|
||||
|
||||
# Java 9 support
|
||||
copyRt
|
||||
|
||||
# If we're in cygwin, we should use the windows config, and terminal hacks
|
||||
if [[ "$CYGWIN_FLAG" == "true" ]]; then #"
|
||||
stty -icanon min 1 -echo > /dev/null 2>&1
|
||||
addJava "-Djline.terminal=jline.UnixTerminal"
|
||||
addJava "-Dsbt.cygwin=true"
|
||||
fi
|
||||
|
||||
if [[ $print_sbt_version ]]; then
|
||||
execRunner "$java_cmd" -jar "$sbt_jar" "sbtVersion" | tail -1 | sed -e 's/\[info\]//g'
|
||||
elif [[ $print_sbt_script_version ]]; then
|
||||
echo "$init_sbt_version"
|
||||
elif [[ $print_version ]]; then
|
||||
execRunner "$java_cmd" -jar "$sbt_jar" "sbtVersion" | tail -1 | sed -e 's/\[info\]/sbt version in this project:/g'
|
||||
echo "sbt script version: $init_sbt_version"
|
||||
else
|
||||
# run sbt
|
||||
execRunner "$java_cmd" \
|
||||
"${java_args[@]}" \
|
||||
"${sbt_options[@]}" \
|
||||
-jar "$sbt_jar" \
|
||||
"${sbt_commands[@]}" \
|
||||
"${residual_args[@]}"
|
||||
fi
|
||||
|
||||
exit_code=$?
|
||||
|
||||
# Clean up the terminal from cygwin hacks.
|
||||
if [[ "$CYGWIN_FLAG" == "true" ]]; then #"
|
||||
stty icanon echo > /dev/null 2>&1
|
||||
fi
|
||||
exit $exit_code
|
||||
}
|
||||
|
||||
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
|
||||
declare -r sbt_opts_file=".sbtopts"
|
||||
declare -r etc_sbt_opts_file="/etc/sbt/sbtopts"
|
||||
# this allows /etc/sbt/sbtopts location to be changed
|
||||
declare -r etc_file="${SBT_ETC_FILE:-$etc_sbt_opts_file}"
|
||||
declare -r dist_sbt_opts_file="${sbt_home}/conf/sbtopts"
|
||||
declare -r win_sbt_opts_file="${sbt_home}/conf/sbtconfig.txt"
|
||||
|
||||
usage() {
|
||||
cat <<EOM
|
||||
Usage: `basename "$0"` [options]
|
||||
|
||||
-h | --help print this message
|
||||
-v | --verbose this runner is chattier
|
||||
-V | --version print sbt version information
|
||||
--numeric-version print the numeric sbt version (sbt sbtVersion)
|
||||
--script-version print the version of sbt script
|
||||
-d | --debug set sbt log level to debug
|
||||
-debug-inc | --debug-inc
|
||||
enable extra debugging for the incremental debugger
|
||||
--no-colors disable ANSI color codes
|
||||
--color=auto|always|true|false|never
|
||||
enable or disable ANSI color codes (sbt 1.3 and above)
|
||||
--supershell=auto|always|true|false|never
|
||||
enable or disable supershell (sbt 1.3 and above)
|
||||
--traces generate Trace Event report on shutdown (sbt 1.3 and above)
|
||||
--timings display task timings report on shutdown
|
||||
--sbt-create start sbt even if current directory contains no sbt project
|
||||
--sbt-dir <path> path to global settings/plugins directory (default: ~/.sbt)
|
||||
--sbt-boot <path> path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
|
||||
--ivy <path> path to local Ivy repository (default: ~/.ivy2)
|
||||
--mem <integer> set memory options (default: $sbt_default_mem)
|
||||
--no-share use all local caches; no sharing
|
||||
--no-global uses global caches, but does not use global ~/.sbt directory.
|
||||
--jvm-debug <port> Turn on JVM debugging, open at the given port.
|
||||
--batch disable interactive mode
|
||||
|
||||
# sbt version (default: from project/build.properties if present, else latest release)
|
||||
--sbt-version <version> use the specified version of sbt
|
||||
--sbt-jar <path> use the specified jar as the sbt launcher
|
||||
|
||||
# java version (default: java from PATH, currently $(java -version 2>&1 | grep version))
|
||||
--java-home <path> alternate JAVA_HOME
|
||||
|
||||
# jvm options and output control
|
||||
JAVA_OPTS environment variable, if unset uses "$default_java_opts"
|
||||
.jvmopts if this file exists in the current directory, its contents
|
||||
are appended to JAVA_OPTS
|
||||
SBT_OPTS environment variable, if unset uses "$default_sbt_opts"
|
||||
.sbtopts if this file exists in the current directory, its contents
|
||||
are prepended to the runner args
|
||||
/etc/sbt/sbtopts if this file exists, it is prepended to the runner args
|
||||
-Dkey=val pass -Dkey=val directly to the java runtime
|
||||
-J-X pass option -X directly to the java runtime
|
||||
(-J is stripped)
|
||||
-S-X add -X to sbt's scalacOptions (-S is stripped)
|
||||
|
||||
In the case of duplicated or conflicting options, the order above
|
||||
shows precedence: JAVA_OPTS lowest, command line options highest.
|
||||
EOM
|
||||
}
|
||||
|
||||
process_my_args () {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-batch|--batch) exec </dev/null && shift ;; #>
|
||||
|
||||
-sbt-create|--sbt-create) sbt_create=true && shift ;;
|
||||
|
||||
new) sbt_new=true && addResidual "$1" && shift ;;
|
||||
|
||||
*) addResidual "$1" && shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Now, ensure sbt version is used.
|
||||
[[ "${sbt_version}XXX" != "XXX" ]] && addJava "-Dsbt.version=$sbt_version"
|
||||
|
||||
# Confirm a user's intent if the current directory does not look like an sbt
|
||||
# top-level directory and neither the -sbt-create option nor the "new"
|
||||
# command was given.
|
||||
[[ -f ./build.sbt || -d ./project || -n "$sbt_create" || -n "$sbt_new" ]] || {
|
||||
echo "[warn] Neither build.sbt nor a 'project' directory in the current directory: $(pwd)"
|
||||
while true; do
|
||||
echo 'c) continue'
|
||||
echo 'q) quit'
|
||||
|
||||
read -p '? ' || exit 1
|
||||
case "$REPLY" in
|
||||
c|C) break ;;
|
||||
q|Q) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
## map over argument array. this is used to process both command line arguments and SBT_OPTS
|
||||
map_args () {
|
||||
local options=()
|
||||
local commands=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-no-colors|--no-colors) options=( "${options[@]}" "-Dsbt.log.noformat=true" ) && shift ;;
|
||||
-timings|--timings) options=( "${options[@]}" "-Dsbt.task.timings=true" "-Dsbt.task.timings.on.shutdown=true" ) && shift ;;
|
||||
-traces|--traces) options=( "${options[@]}" "-Dsbt.traces=true" ) && shift ;;
|
||||
--supershell=*) options=( "${options[@]}" "-Dsbt.supershell=${1:13}" ) && shift ;;
|
||||
-supershell=*) options=( "${options[@]}" "-Dsbt.supershell=${1:12}" ) && shift ;;
|
||||
--color=*) options=( "${options[@]}" "-Dsbt.color=${1:8}" ) && shift ;;
|
||||
-color=*) options=( "${options[@]}" "-Dsbt.color=${1:7}" ) && shift ;;
|
||||
-no-share|--no-share) options=( "${options[@]}" "$noshare_opts" ) && shift ;;
|
||||
-no-global|--no-global) options=( "${options[@]}" "-Dsbt.global.base=$(pwd)/project/.sbtboot" ) && shift ;;
|
||||
-sbt-boot|--sbt-boot) require_arg path "$1" "$2" && options=( "${options[@]}" "-Dsbt.boot.directory=$2" ) && shift 2 ;;
|
||||
-sbt-dir|--sbt-dir) require_arg path "$1" "$2" && options=( "${options[@]}" "-Dsbt.global.base=$2" ) && shift 2 ;;
|
||||
-debug|--debug) commands=( "${commands[@]}" "-debug" ) && shift ;;
|
||||
-debug-inc|--debug-inc) options=( "${options[@]}" "-Dxsbt.inc.debug=true" ) && shift ;;
|
||||
*) options=( "${options[@]}" "$1" ) && shift ;;
|
||||
esac
|
||||
done
|
||||
declare -p options
|
||||
declare -p commands
|
||||
}
|
||||
|
||||
process_args () {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|-help|--help) usage; exit 1 ;;
|
||||
-v|-verbose|--verbose) sbt_verbose=1 && shift ;;
|
||||
-V|-version|--version) print_version=1 && shift ;;
|
||||
--numeric-version) print_sbt_version=1 && shift ;;
|
||||
--script-version) print_sbt_script_version=1 && shift ;;
|
||||
-d|-debug|--debug) sbt_debug=1 && addSbt "-debug" && shift ;;
|
||||
|
||||
-ivy|--ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;;
|
||||
-mem|--mem) require_arg integer "$1" "$2" && addMemory "$2" && shift 2 ;;
|
||||
-jvm-debug|--jvm-debug) require_arg port "$1" "$2" && addDebugger $2 && shift 2 ;;
|
||||
-batch|--batch) exec </dev/null && shift ;;
|
||||
|
||||
-sbt-jar|--sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
|
||||
-sbt-version|--sbt-version) require_arg version "$1" "$2" && sbt_version="$2" && shift 2 ;;
|
||||
-java-home|--java-home) require_arg path "$1" "$2" &&
|
||||
java_cmd="$2/bin/java" &&
|
||||
export JAVA_HOME="$2" &&
|
||||
export JDK_HOME="$2" &&
|
||||
export PATH="$2/bin:$PATH" &&
|
||||
shift 2 ;;
|
||||
|
||||
"-D*"|-D*) addJava "$1" && shift ;;
|
||||
-J*) addJava "${1:2}" && shift ;;
|
||||
*) addResidual "$1" && shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
is_function_defined process_my_args && {
|
||||
myargs=("${residual_args[@]}")
|
||||
residual_args=()
|
||||
process_my_args "${myargs[@]}"
|
||||
}
|
||||
|
||||
java_version="$(jdk_version)"
|
||||
vlog "[process_args] java_version = '$java_version'"
|
||||
}
|
||||
|
||||
loadConfigFile() {
|
||||
# Make sure the last line is read even if it doesn't have a terminating \n
|
||||
cat "$1" | sed $'/^\#/d;s/\r$//' | while read -r line || [[ -n "$line" ]]; do
|
||||
eval echo $line
|
||||
done
|
||||
}
|
||||
|
||||
# Here we pull in the default settings configuration.
|
||||
[[ -f "$dist_sbt_opts_file" ]] && set -- $(loadConfigFile "$dist_sbt_opts_file") "$@"
|
||||
|
||||
# Here we pull in the global settings configuration.
|
||||
[[ -f "$etc_file" ]] && set -- $(loadConfigFile "$etc_file") "$@"
|
||||
|
||||
# Pull in the project-level config file, if it exists.
|
||||
[[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"
|
||||
|
||||
# Pull in the project-level java config, if it exists.
|
||||
[[ -f ".jvmopts" ]] && export JAVA_OPTS="$JAVA_OPTS $(loadConfigFile .jvmopts)"
|
||||
|
||||
# Pull in default JAVA_OPTS
|
||||
[[ -z "${JAVA_OPTS// }" ]] && export JAVA_OPTS="$default_java_opts"
|
||||
|
||||
run "$@"
|
Binary file not shown.
@ -1,902 +0,0 @@
|
||||
@REM SBT launcher script
|
||||
@REM
|
||||
@REM Environment:
|
||||
@REM JAVA_HOME - location of a JDK home dir (mandatory)
|
||||
@REM SBT_OPTS - JVM options (optional)
|
||||
@REM Configuration:
|
||||
@REM sbtconfig.txt found in the SBT_HOME.
|
||||
|
||||
@REM ZOMG! We need delayed expansion to build up CFG_OPTS later
|
||||
@setlocal enabledelayedexpansion
|
||||
|
||||
@echo off
|
||||
set SBT_BIN_DIR=%~dp0
|
||||
if not defined SBT_HOME for %%I in ("!SBT_BIN_DIR!\..") do set "SBT_HOME=%%~fI"
|
||||
|
||||
set SBT_ARGS=
|
||||
set _JAVACMD=
|
||||
set _SBT_OPTS=
|
||||
set _JAVA_OPTS=
|
||||
|
||||
set init_sbt_version=_to_be_replaced
|
||||
set sbt_default_mem=1024
|
||||
set default_sbt_opts=
|
||||
set default_java_opts=-Dfile.encoding=UTF-8
|
||||
set sbt_jar=
|
||||
|
||||
set sbt_args_print_version=
|
||||
set sbt_args_print_sbt_version=
|
||||
set sbt_args_print_sbt_script_version=
|
||||
set sbt_args_verbose=
|
||||
set sbt_args_debug=
|
||||
set sbt_args_debug_inc=
|
||||
set sbt_args_batch=
|
||||
set sbt_args_color=
|
||||
set sbt_args_no_colors=
|
||||
set sbt_args_no_global=
|
||||
set sbt_args_no_share=
|
||||
set sbt_args_sbt_jar=
|
||||
set sbt_args_ivy=
|
||||
set sbt_args_supershell=
|
||||
set sbt_args_timings=
|
||||
set sbt_args_traces=
|
||||
set sbt_args_sbt_create=
|
||||
set sbt_args_sbt_dir=
|
||||
set sbt_args_sbt_version=
|
||||
set sbt_args_mem=
|
||||
|
||||
rem users can set SBT_OPTS via .sbtopts
|
||||
if exist .sbtopts for /F %%A in (.sbtopts) do (
|
||||
set _sbtopts_line=%%A
|
||||
if not "!_sbtopts_line:~0,1!" == "#" (
|
||||
if defined _SBT_OPTS (
|
||||
set _SBT_OPTS=!_SBT_OPTS! %%A
|
||||
) else (
|
||||
set _SBT_OPTS=%%A
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem TODO: remove/deprecate sbtconfig.txt and parse the sbtopts files
|
||||
|
||||
rem FIRST we load the config file of extra options.
|
||||
set SBT_CONFIG=!SBT_HOME!\conf\sbtconfig.txt
|
||||
set SBT_CFG_OPTS=
|
||||
for /F "tokens=* eol=# usebackq delims=" %%i in ("!SBT_CONFIG!") do (
|
||||
set DO_NOT_REUSE_ME=%%i
|
||||
rem ZOMG (Part #2) WE use !! here to delay the expansion of
|
||||
rem SBT_CFG_OPTS, otherwise it remains "" for this loop.
|
||||
set SBT_CFG_OPTS=!SBT_CFG_OPTS! !DO_NOT_REUSE_ME!
|
||||
)
|
||||
|
||||
rem poor man's jenv (which is not available on Windows)
|
||||
if defined JAVA_HOMES (
|
||||
if exist .java-version for /F %%A in (.java-version) do (
|
||||
set JAVA_HOME=%JAVA_HOMES%\%%A
|
||||
set JDK_HOME=%JAVA_HOMES%\%%A
|
||||
)
|
||||
)
|
||||
|
||||
rem must set PATH or wrong javac is used for java projects
|
||||
if defined JAVA_HOME set "PATH=%JAVA_HOME%\bin;%PATH%"
|
||||
|
||||
rem We use the value of the JAVACMD environment variable if defined
|
||||
if defined JAVACMD set "_JAVACMD=%JAVACMD%"
|
||||
|
||||
rem remove quotes
|
||||
if defined _JAVACMD set _JAVACMD=!_JAVACMD:"=!
|
||||
|
||||
if not defined _JAVACMD (
|
||||
if not "%JAVA_HOME%" == "" (
|
||||
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
|
||||
)
|
||||
)
|
||||
|
||||
if not defined _JAVACMD set _JAVACMD=java
|
||||
|
||||
rem users can set JAVA_OPTS via .jvmopts (sbt-extras style)
|
||||
if exist .jvmopts for /F %%A in (.jvmopts) do (
|
||||
set _jvmopts_line=%%A
|
||||
if not "!_jvmopts_line:~0,1!" == "#" (
|
||||
if defined _JAVA_OPTS (
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! %%A
|
||||
) else (
|
||||
set _JAVA_OPTS=%%A
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
|
||||
if not defined _JAVA_OPTS if defined JAVA_OPTS set _JAVA_OPTS=%JAVA_OPTS%
|
||||
if not defined _JAVA_OPTS if defined default_java_opts set _JAVA_OPTS=!default_java_opts!
|
||||
|
||||
rem We use the value of the SBT_OPTS environment variable if defined, rather than the config.
|
||||
if not defined _SBT_OPTS if defined SBT_OPTS set _SBT_OPTS=%SBT_OPTS%
|
||||
if not defined _SBT_OPTS if defined SBT_CFG_OPTS set _SBT_OPTS=!SBT_CFG_OPTS!
|
||||
if not defined _SBT_OPTS if defined default_sbt_opts set _SBT_OPTS=!default_sbt_opts!
|
||||
|
||||
:args_loop
|
||||
shift
|
||||
|
||||
if "%~0" == "" goto args_end
|
||||
set g=%~0
|
||||
|
||||
rem make sure the sbt_args_debug gets set first incase any argument parsing uses :dlog
|
||||
if "%~0" == "-d" set _debug_arg=true
|
||||
if "%~0" == "--debug" set _debug_arg=true
|
||||
|
||||
if defined _debug_arg (
|
||||
set _debug_arg=
|
||||
set sbt_args_debug=1
|
||||
set SBT_ARGS=-debug !SBT_ARGS!
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-h" goto usage
|
||||
if "%~0" == "-help" goto usage
|
||||
if "%~0" == "--help" goto usage
|
||||
|
||||
if "%~0" == "-v" set _verbose_arg=true
|
||||
if "%~0" == "-verbose" set _verbose_arg=true
|
||||
if "%~0" == "--verbose" set _verbose_arg=true
|
||||
|
||||
if defined _verbose_arg (
|
||||
set _verbose_arg=
|
||||
set sbt_args_verbose=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-V" set _version_arg=true
|
||||
if "%~0" == "-version" set _version_arg=true
|
||||
if "%~0" == "--version" set _version_arg=true
|
||||
|
||||
if defined _version_arg (
|
||||
set _version_arg=
|
||||
set sbt_args_print_version=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-batch" set _batch_arg=true
|
||||
if "%~0" == "--batch" set _batch_arg=true
|
||||
|
||||
if defined _batch_arg (
|
||||
set _batch_arg=
|
||||
set sbt_args_batch=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-no-colors" set _no_colors_arg=true
|
||||
if "%~0" == "--no-colors" set _no_colors_arg=true
|
||||
|
||||
if defined _no_colors_arg (
|
||||
set _no_colors_arg=
|
||||
set sbt_args_no_colors=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-no-global" set _no_global_arg=true
|
||||
if "%~0" == "--no-global" set _no_global_arg=true
|
||||
|
||||
if defined _no_global_arg (
|
||||
set _no_global_arg=
|
||||
set sbt_args_no_global=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-traces" set _traces_arg=true
|
||||
if "%~0" == "--traces" set _traces_arg=true
|
||||
|
||||
if defined _traces_arg (
|
||||
set _traces_arg=
|
||||
set sbt_args_traces=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-sbt-create" set _sbt_create_arg=true
|
||||
if "%~0" == "--sbt-create" set _sbt_create_arg=true
|
||||
|
||||
if defined _sbt_create_arg (
|
||||
set _sbt_create_arg=
|
||||
set sbt_args_sbt_create=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-sbt-dir" set _sbt_dir_arg=true
|
||||
if "%~0" == "--sbt-dir" set _sbt_dir_arg=true
|
||||
|
||||
if defined _sbt_dir_arg (
|
||||
set _sbt_dir_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_sbt_dir=%1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "-sbt-boot" set _sbt_boot_arg=true
|
||||
if "%~0" == "--sbt-boot" set _sbt_boot_arg=true
|
||||
|
||||
if defined _sbt_boot_arg (
|
||||
set _sbt_boot_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_sbt_boot=%1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "-sbt-jar" set _sbt_jar=true
|
||||
if "%~0" == "--sbt-jar" set _sbt_jar=true
|
||||
|
||||
if defined _sbt_jar (
|
||||
set _sbt_jar=
|
||||
if not "%~1" == "" (
|
||||
if exist "%~1" (
|
||||
set sbt_args_sbt_jar=%1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo %~1 does not exist
|
||||
goto error
|
||||
)
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "-ivy" set _sbt_ivy_arg=true
|
||||
if "%~0" == "--ivy" set _sbt_ivy_arg=true
|
||||
|
||||
if defined _sbt_ivy_arg (
|
||||
set _sbt_ivy_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_ivy=%1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "-debug-inc" set _debug_inc_arg=true
|
||||
if "%~0" == "--debug-inc" set _debug_inc_arg=true
|
||||
|
||||
if defined _debug_inc_arg (
|
||||
set _debug_inc_arg=
|
||||
set sbt_args_debug_inc=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "--sbt-version" set _sbt_version_arg=true
|
||||
if "%~0" == "-sbt-version" set _sbt_version_arg=true
|
||||
|
||||
if defined _sbt_version_arg (
|
||||
set _sbt_version_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_sbt_version=%~1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "--mem" set _sbt_mem_arg=true
|
||||
if "%~0" == "-mem" set _sbt_mem_arg=true
|
||||
|
||||
if defined _sbt_mem_arg (
|
||||
set _sbt_mem_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_mem=%~1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "--supershell" set _supershell_arg=true
|
||||
if "%~0" == "-supershell" set _supershell_arg=true
|
||||
|
||||
if defined _supershell_arg (
|
||||
set _supershell_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_supershell=%~1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "--color" set _color_arg=true
|
||||
if "%~0" == "-color" set _color_arg=true
|
||||
|
||||
if defined _color_arg (
|
||||
set _color_arg=
|
||||
if not "%~1" == "" (
|
||||
set sbt_args_color=%~1
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo "%~0" is missing a value
|
||||
goto error
|
||||
)
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "--no-share" set _no_share_arg=true
|
||||
if "%~0" == "-no-share" set _no_share_arg=true
|
||||
|
||||
if defined _no_share_arg (
|
||||
set _no_share_arg=
|
||||
set sbt_args_no_share=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "--timings" set _timings_arg=true
|
||||
if "%~0" == "-timings" set _timings_arg=true
|
||||
|
||||
if defined _timings_arg (
|
||||
set _timings_arg=
|
||||
set sbt_args_timings=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "--script-version" (
|
||||
set sbt_args_print_sbt_script_version=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "--numeric-version" (
|
||||
set sbt_args_print_sbt_version=1
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if "%~0" == "-jvm-debug" set _jvm_debug_arg=true
|
||||
if "%~0" == "--jvm-debug" set _jvm_debug_arg=true
|
||||
|
||||
if defined _jvm_debug_arg (
|
||||
set _jvm_debug_arg=
|
||||
if not "%~1" == "" (
|
||||
set /a JVM_DEBUG_PORT=%~1 2>nul >nul
|
||||
if !JVM_DEBUG_PORT! EQU 0 (
|
||||
rem next argument wasn't a port, set a default and process next arg
|
||||
set /A JVM_DEBUG_PORT=5005
|
||||
goto args_loop
|
||||
) else (
|
||||
shift
|
||||
goto args_loop
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "-java-home" set _java_home_arg=true
|
||||
if "%~0" == "--java-home" set _java_home_arg=true
|
||||
|
||||
if defined _java_home_arg (
|
||||
set _java_home_arg=
|
||||
if not "%~1" == "" (
|
||||
if exist "%~1\bin\java.exe" (
|
||||
set "_JAVACMD=%~1\bin\java.exe"
|
||||
set "JAVA_HOME=%~1"
|
||||
set "JDK_HOME=%~1"
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo Directory "%~1" for JAVA_HOME is not valid
|
||||
goto error
|
||||
)
|
||||
) else (
|
||||
echo Second argument for --java-home missing
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
if "%~0" == "new" (
|
||||
if not defined SBT_ARGS (
|
||||
set sbt_new=true
|
||||
)
|
||||
)
|
||||
|
||||
if "%g:~0,2%" == "-D" (
|
||||
rem special handling for -D since '=' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%g%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%g%" == "%%a" (
|
||||
if not "%~1" == "" (
|
||||
call :dlog [args_loop] -D argument %~0=%~1
|
||||
set "SBT_ARGS=!SBT_ARGS! %~0=%~1"
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo %g% is missing a value
|
||||
goto error
|
||||
)
|
||||
) else (
|
||||
call :dlog [args_loop] -D argument %~0
|
||||
set "SBT_ARGS=!SBT_ARGS! %~0"
|
||||
goto args_loop
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if not "%g:~0,5%" == "-XX:+" if not "%g:~0,5%" == "-XX:-" if "%g:~0,3%" == "-XX" (
|
||||
rem special handling for -XX since '=' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%g%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%g%" == "%%a" (
|
||||
if not "%~1" == "" (
|
||||
call :dlog [args_loop] -XX argument %~0=%~1
|
||||
set "SBT_ARGS=!SBT_ARGS! %~0=%~1"
|
||||
shift
|
||||
goto args_loop
|
||||
) else (
|
||||
echo %g% is missing a value
|
||||
goto error
|
||||
)
|
||||
) else (
|
||||
call :dlog [args_loop] -XX argument %~0
|
||||
set "SBT_ARGS=!SBT_ARGS! %~0"
|
||||
goto args_loop
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem the %0 (instead of %~0) preserves original argument quoting
|
||||
set SBT_ARGS=!SBT_ARGS! %0
|
||||
|
||||
goto args_loop
|
||||
:args_end
|
||||
|
||||
rem Confirm a user's intent if the current directory does not look like an sbt
|
||||
rem top-level directory and the "new" command was not given.
|
||||
|
||||
if not defined sbt_args_sbt_create if not defined sbt_args_print_version if not defined sbt_args_print_sbt_version if not defined sbt_args_print_sbt_script_version if not exist build.sbt (
|
||||
if not exist project\ (
|
||||
if not defined sbt_new (
|
||||
echo [warn] Neither build.sbt nor a 'project' directory in the current directory: "%CD%"
|
||||
setlocal
|
||||
:confirm
|
||||
echo c^) continue
|
||||
echo q^) quit
|
||||
|
||||
set /P reply=^?
|
||||
if /I "!reply!" == "c" (
|
||||
goto confirm_end
|
||||
) else if /I "!reply!" == "q" (
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
goto confirm
|
||||
:confirm_end
|
||||
endlocal
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
call :process
|
||||
|
||||
rem avoid bootstrapping/java version check for script version
|
||||
|
||||
if !sbt_args_print_sbt_script_version! equ 1 (
|
||||
echo !init_sbt_version!
|
||||
goto :eof
|
||||
)
|
||||
|
||||
call :checkjava
|
||||
|
||||
call :copyrt
|
||||
|
||||
if defined JVM_DEBUG_PORT (
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=!JVM_DEBUG_PORT!
|
||||
)
|
||||
|
||||
call :sync_preloaded
|
||||
|
||||
call :run !SBT_ARGS!
|
||||
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:run
|
||||
|
||||
rem set arguments
|
||||
|
||||
if defined sbt_args_debug_inc (
|
||||
set _SBT_OPTS=-Dxsbt.inc.debug=true !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_no_colors (
|
||||
set _SBT_OPTS=-Dsbt.log.noformat=true !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_no_global (
|
||||
set _SBT_OPTS=-Dsbt.global.base=project/.sbtboot !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_no_share (
|
||||
set _SBT_OPTS=-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_supershell (
|
||||
set _SBT_OPTS=-Dsbt.supershell=!sbt_args_supershell! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_sbt_version (
|
||||
set _SBT_OPTS=-Dsbt.version=!sbt_args_sbt_version! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_sbt_dir (
|
||||
set _SBT_OPTS=-Dsbt.global.base=!sbt_args_sbt_dir! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_sbt_boot (
|
||||
set _SBT_OPTS=-Dsbt.boot.directory=!sbt_args_sbt_boot! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_ivy (
|
||||
set _SBT_OPTS=-Dsbt.ivy.home=!sbt_args_ivy! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_color (
|
||||
set _SBT_OPTS=-Dsbt.color=!sbt_args_color! !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_mem (
|
||||
call :addMemory !sbt_args_mem!
|
||||
) else (
|
||||
call :addDefaultMemory
|
||||
)
|
||||
|
||||
if defined sbt_args_timings (
|
||||
set _SBT_OPTS=-Dsbt.task.timings=true -Dsbt.task.timings.on.shutdown=true !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_traces (
|
||||
set _SBT_OPTS=-Dsbt.traces=true !_SBT_OPTS!
|
||||
)
|
||||
|
||||
if defined sbt_args_sbt_jar (
|
||||
set "sbt_jar=!sbt_args_sbt_jar!"
|
||||
) else (
|
||||
set "sbt_jar=!SBT_HOME!\bin\sbt-launch.jar"
|
||||
)
|
||||
|
||||
set sbt_jar=!sbt_jar:"=!
|
||||
|
||||
rem TODO: _SBT_OPTS needs to be processed as args and diffed against SBT_ARGS
|
||||
|
||||
if !sbt_args_print_sbt_version! equ 1 (
|
||||
call :set_sbt_version
|
||||
echo !sbt_version!
|
||||
goto :eof
|
||||
)
|
||||
|
||||
if !sbt_args_print_version! equ 1 (
|
||||
call :set_sbt_version
|
||||
echo sbt version in this project: !sbt_version!
|
||||
echo sbt script version: !init_sbt_version!
|
||||
goto :eof
|
||||
)
|
||||
|
||||
if defined sbt_args_verbose (
|
||||
echo # Executing command line:
|
||||
echo "!_JAVACMD!"
|
||||
if defined _JAVA_OPTS ( call :echolist !_JAVA_OPTS! )
|
||||
if defined _SBT_OPTS ( call :echolist !_SBT_OPTS! )
|
||||
echo -cp
|
||||
echo "!sbt_jar!"
|
||||
echo xsbt.boot.Boot
|
||||
if not "%~1" == "" ( call :echolist %* )
|
||||
echo.
|
||||
)
|
||||
|
||||
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! -cp "!sbt_jar!" xsbt.boot.Boot %*
|
||||
|
||||
goto :eof
|
||||
|
||||
rem for expression tries to interpret files, so simply loop over %* instead
|
||||
rem fixes dealing with quotes after = args: -Dscala.ext.dirs="C:\Users\First Last\.sbt\0.13\java9-rt-ext-adoptopenjdk_11_0_3"
|
||||
:echolist
|
||||
rem call method is in first call of %0
|
||||
shift
|
||||
|
||||
if "%~0" == "" goto echolist_end
|
||||
set "p=%~0"
|
||||
|
||||
if "%p:~0,2%" == "-D" (
|
||||
rem special handling for -D since '=' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%p%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%p%" == "%%a" if not "%~1" == "" (
|
||||
echo %0=%1
|
||||
shift
|
||||
goto echolist
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX" (
|
||||
rem special handling for -XX since '=' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%p%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%p%" == "%%a" if not "%~1" == "" (
|
||||
echo %0=%1
|
||||
shift
|
||||
goto echolist
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%p:~0,14%" == "-agentlib:jdwp" (
|
||||
rem special handling for --jvm-debug since '=' and ',' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%p%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%p%" == "%%a" if not "%~1" == "" if not "%~2" == "" if not "%~3" == "" if not "%~4" == "" if not "%~5" == "" if not "%~6" == "" if not "%~7" == "" if not "%~8" == "" (
|
||||
echo %0=%1=%2,%3=%4,%5=%6,%7=%8
|
||||
shift & shift & shift & shift & shift & shift & shift & shift
|
||||
goto echolist
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
echo %0
|
||||
goto echolist
|
||||
|
||||
:echolist_end
|
||||
|
||||
exit /B 0
|
||||
|
||||
:addJava
|
||||
call :dlog [addJava] arg = '%*'
|
||||
set "_JAVA_OPTS=!_JAVA_OPTS! %*"
|
||||
exit /B 0
|
||||
|
||||
:addMemory
|
||||
call :dlog [addMemory] arg = '%*'
|
||||
|
||||
rem evict memory related options
|
||||
set _new_java_opts=
|
||||
set _old_java_opts=!_JAVA_OPTS!
|
||||
:next_java_opt
|
||||
if "!_old_java_opts!" == "" goto :done_java_opt
|
||||
for /F "tokens=1,*" %%g in ("!_old_java_opts!") do (
|
||||
set "p=%%g"
|
||||
if not "!p:~0,4!" == "-Xmx" if not "!p:~0,4!" == "-Xms" if not "!p:~0,15!" == "-XX:MaxPermSize" if not "!p:~0,20!" == "-XX:MaxMetaspaceSize" if not "!p:~0,25!" == "-XX:ReservedCodeCacheSize" (
|
||||
set _new_java_opts=!_new_java_opts! %%g
|
||||
)
|
||||
set "_old_java_opts=%%h"
|
||||
)
|
||||
goto :next_java_opt
|
||||
:done_java_opt
|
||||
set _JAVA_OPTS=!_new_java_opts!
|
||||
|
||||
set _new_sbt_opts=
|
||||
set _old_sbt_opts=!_SBT_OPTS!
|
||||
:next_sbt_opt
|
||||
if "!_old_sbt_opts!" == "" goto :done_sbt_opt
|
||||
for /F "tokens=1,*" %%g in ("!_old_sbt_opts!") do (
|
||||
set "p=%%g"
|
||||
if not "!p:~0,4!" == "-Xmx" if not "!p:~0,4!" == "-Xms" if not "!p:~0,15!" == "-XX:MaxPermSize" if not "!p:~0,20!" == "-XX:MaxMetaspaceSize" if not "!p:~0,25!" == "-XX:ReservedCodeCacheSize" (
|
||||
set _new_sbt_opts=!_new_sbt_opts! %%g
|
||||
)
|
||||
set "_old_sbt_opts=%%h"
|
||||
)
|
||||
goto :next_sbt_opt
|
||||
:done_sbt_opt
|
||||
set _SBT_OPTS=!_new_sbt_opts!
|
||||
|
||||
rem a ham-fisted attempt to move some memory settings in concert
|
||||
set mem=%1
|
||||
set /a codecache=!mem! / 8
|
||||
if !codecache! GEQ 512 set /a codecache=512
|
||||
if !codecache! LEQ 128 set /a codecache=128
|
||||
|
||||
set /a class_metadata_size=!codecache! * 2
|
||||
|
||||
call :addJava -Xms!mem!m
|
||||
call :addJava -Xmx!mem!m
|
||||
call :addJava -Xss4M
|
||||
call :addJava -XX:ReservedCodeCacheSize=!codecache!m
|
||||
|
||||
if /I !JAVA_VERSION! LSS 8 (
|
||||
call :addJava -XX:MaxPermSize=!class_metadata_size!m
|
||||
)
|
||||
|
||||
exit /B 0
|
||||
|
||||
:addDefaultMemory
|
||||
rem if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} we need to NOT output our settings.
|
||||
rem The reason is the Xms/Xmx, if they don't line up, cause errors.
|
||||
|
||||
set _has_memory_args=
|
||||
|
||||
if defined _JAVA_OPTS for /F %%g in ("!_JAVA_OPTS!") do (
|
||||
set "p=%%g"
|
||||
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
||||
if "!p:~0,4!" == "-Xms" set _has_memory_args=1
|
||||
)
|
||||
|
||||
if defined JAVA_TOOL_OPTIONS for /F %%g in ("%JAVA_TOOL_OPTIONS%") do (
|
||||
set "p=%%g"
|
||||
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
||||
if "!p:~0,4!" == "-Xms" set _has_memory_args=1
|
||||
)
|
||||
|
||||
if defined _SBT_OPTS for /F %%g in ("!_SBT_OPTS!") do (
|
||||
set "p=%%g"
|
||||
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
||||
if "!p:~0,4!" == "-Xms" set _has_memory_args=1
|
||||
)
|
||||
|
||||
if not defined _has_memory_args (
|
||||
call :addMemory !sbt_default_mem!
|
||||
)
|
||||
exit /B 0
|
||||
|
||||
:dlog
|
||||
if defined sbt_args_debug (
|
||||
echo %* 1>&2
|
||||
)
|
||||
exit /B 0
|
||||
|
||||
:process
|
||||
rem Parses x out of 1.x; for example 8 out of java version 1.8.0_xx
|
||||
rem Otherwise, parses the major version; 9 out of java version 9-ea
|
||||
set JAVA_VERSION=0
|
||||
|
||||
for /f "tokens=3 usebackq" %%g in (`CALL "!_JAVACMD!" -Xms32M -Xmx32M -version 2^>^&1 ^| findstr /i version`) do (
|
||||
set JAVA_VERSION=%%g
|
||||
)
|
||||
|
||||
rem removes all quotes from JAVA_VERSION
|
||||
set JAVA_VERSION=!JAVA_VERSION:"=!
|
||||
|
||||
for /f "delims=.-_ tokens=1-2" %%v in ("!JAVA_VERSION!") do (
|
||||
if /I "%%v" EQU "1" (
|
||||
set JAVA_VERSION=%%w
|
||||
) else (
|
||||
set JAVA_VERSION=%%v
|
||||
)
|
||||
)
|
||||
|
||||
exit /B 0
|
||||
|
||||
:checkjava
|
||||
set /a required_version=6
|
||||
if /I !JAVA_VERSION! GEQ !required_version! (
|
||||
exit /B 0
|
||||
)
|
||||
echo.
|
||||
echo The Java Development Kit ^(JDK^) installation you have is not up to date.
|
||||
echo sbt requires at least version !required_version!+, you have
|
||||
echo version "!JAVA_VERSION!"
|
||||
echo.
|
||||
echo Please go to http://www.oracle.com/technetwork/java/javase/downloads/ and download
|
||||
echo a valid JDK and install before running sbt.
|
||||
echo.
|
||||
exit /B 1
|
||||
|
||||
:copyrt
|
||||
if /I !JAVA_VERSION! GEQ 9 (
|
||||
set "rtexport=!SBT_BIN_DIR!java9-rt-export.jar"
|
||||
|
||||
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! -jar "!rtexport!" --rt-ext-dir > "%TEMP%.\rtext.txt"
|
||||
set /p java9_ext= < "%TEMP%.\rtext.txt"
|
||||
set "java9_rt=!java9_ext!\rt.jar"
|
||||
|
||||
if not exist "!java9_rt!" (
|
||||
mkdir "!java9_ext!"
|
||||
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! -jar "!rtexport!" "!java9_rt!"
|
||||
)
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! -Dscala.ext.dirs="!java9_ext!"
|
||||
)
|
||||
exit /B 0
|
||||
|
||||
:sync_preloaded
|
||||
if not defined init_sbt_version (
|
||||
rem FIXME: better !init_sbt_version! detection
|
||||
FOR /F "tokens=* usebackq" %%F IN (`dir /b "!SBT_HOME!\lib\local-preloaded\org\scala-sbt\sbt" /B`) DO (
|
||||
SET init_sbt_version=%%F
|
||||
)
|
||||
)
|
||||
|
||||
set PRELOAD_SBT_JAR="%UserProfile%\.sbt\preloaded\org\scala-sbt\sbt\!init_sbt_version!\"
|
||||
if /I !JAVA_VERSION! GEQ 8 (
|
||||
where robocopy >nul 2>nul
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
if not exist !PRELOAD_SBT_JAR! (
|
||||
if exist "!SBT_HOME!\lib\local-preloaded\" (
|
||||
robocopy "!SBT_HOME!\lib\local-preloaded" "%UserProfile%\.sbt\preloaded" /E >nul 2>nul
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
exit /B 0
|
||||
|
||||
:usage
|
||||
|
||||
for /f "tokens=3 usebackq" %%g in (`CALL "!_JAVACMD!" -Xms32M -Xmx32M -version 2^>^&1 ^| findstr /i version`) do (
|
||||
set FULL_JAVA_VERSION=%%g
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Usage: %~n0 [options]
|
||||
echo.
|
||||
echo -h ^| --help print this message
|
||||
echo -v ^| --verbose this runner is chattier
|
||||
echo -V ^| --version print sbt version information
|
||||
echo --numeric-version print the numeric sbt version (sbt sbtVersion)
|
||||
echo --script-version print the version of sbt script
|
||||
echo -d ^| --debug set sbt log level to debug
|
||||
echo -debug-inc ^| --debug-inc
|
||||
echo enable extra debugging for the incremental debugger
|
||||
echo --no-colors disable ANSI color codes
|
||||
echo --color=auto^|always^|true^|false^|never
|
||||
echo enable or disable ANSI color codes ^(sbt 1.3 and above^)
|
||||
echo --supershell=auto^|always^|true^|false^|never
|
||||
echo enable or disable supershell ^(sbt 1.3 and above^)
|
||||
echo --traces generate Trace Event report on shutdown ^(sbt 1.3 and above^)
|
||||
echo --timings display task timings report on shutdown
|
||||
echo --sbt-create start sbt even if current directory contains no sbt project
|
||||
echo --sbt-dir ^<path^> path to global settings/plugins directory ^(default: ~/.sbt^)
|
||||
echo --sbt-boot ^<path^> path to shared boot directory ^(default: ~/.sbt/boot in 0.11 series^)
|
||||
echo --ivy ^<path^> path to local Ivy repository ^(default: ~/.ivy2^)
|
||||
echo --mem ^<integer^> set memory options ^(default: %sbt_default_mem%^)
|
||||
echo --no-share use all local caches; no sharing
|
||||
echo --no-global uses global caches, but does not use global ~/.sbt directory.
|
||||
echo --jvm-debug ^<port^> enable on JVM debugging, open at the given port.
|
||||
rem echo --batch disable interactive mode
|
||||
echo.
|
||||
echo # sbt version ^(default: from project/build.properties if present, else latest release^)
|
||||
echo --sbt-version ^<version^> use the specified version of sbt
|
||||
echo --sbt-jar ^<path^> use the specified jar as the sbt launcher
|
||||
echo.
|
||||
echo # java version ^(default: java from PATH, currently !FULL_JAVA_VERSION!^)
|
||||
echo --java-home ^<path^> alternate JAVA_HOME
|
||||
echo.
|
||||
echo # jvm options and output control
|
||||
echo JAVA_OPTS environment variable, if unset uses "!default_java_opts!"
|
||||
echo .jvmopts if this file exists in the current directory, its contents
|
||||
echo are appended to JAVA_OPTS
|
||||
echo SBT_OPTS environment variable, if unset uses "!default_sbt_opts!"
|
||||
echo .sbtopts if this file exists in the current directory, its contents
|
||||
echo are prepended to the runner args
|
||||
echo !SBT_CONFIG!
|
||||
echo if this file exists, it is prepended to the runner args
|
||||
echo -Dkey=val pass -Dkey=val directly to the java runtime
|
||||
rem echo -J-X pass option -X directly to the java runtime
|
||||
rem echo ^(-J is stripped^)
|
||||
rem echo -S-X add -X to sbt's scalacOptions ^(-S is stripped^)
|
||||
echo.
|
||||
echo In the case of duplicated or conflicting options, the order above
|
||||
echo shows precedence: JAVA_OPTS lowest, command line options highest.
|
||||
echo.
|
||||
|
||||
@endlocal
|
||||
exit /B 1
|
||||
|
||||
:set_sbt_version
|
||||
rem set project sbtVersion
|
||||
for /F "usebackq tokens=2" %%G in (`CALL "!_JAVACMD!" -jar "!sbt_jar!" "sbtVersion" 2^>^&1`) do set "sbt_version=%%G"
|
||||
exit /B 0
|
||||
|
||||
:error
|
||||
@endlocal
|
||||
exit /B 1
|
||||
|
||||
:end
|
||||
@endlocal
|
||||
exit /B 0
|
@ -1,14 +0,0 @@
|
||||
# Set the java args to high
|
||||
|
||||
-Xmx512M
|
||||
|
||||
-XX:MaxPermSize=256m
|
||||
|
||||
-XX:ReservedCodeCacheSize=128m
|
||||
|
||||
|
||||
|
||||
# Set the extra SBT options
|
||||
|
||||
-Dsbt.log.format=true
|
||||
|
@ -1,49 +0,0 @@
|
||||
# ------------------------------------------------ #
|
||||
# The SBT Configuration file. #
|
||||
# ------------------------------------------------ #
|
||||
|
||||
|
||||
# Disable ANSI color codes
|
||||
#
|
||||
#-no-colors
|
||||
|
||||
# Starts sbt even if the current directory contains no sbt project.
|
||||
#
|
||||
-sbt-create
|
||||
|
||||
# Path to global settings/plugins directory (default: ~/.sbt)
|
||||
#
|
||||
#-sbt-dir /etc/sbt
|
||||
|
||||
# Path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
|
||||
#
|
||||
#-sbt-boot ~/.sbt/boot
|
||||
|
||||
# Path to local Ivy repository (default: ~/.ivy2)
|
||||
#
|
||||
#-ivy ~/.ivy2
|
||||
|
||||
# set memory options
|
||||
#
|
||||
#-mem <integer>
|
||||
|
||||
# Use local caches for projects, no sharing.
|
||||
#
|
||||
#-no-share
|
||||
|
||||
# Put SBT in offline mode.
|
||||
#
|
||||
#-offline
|
||||
|
||||
# Sets the SBT version to use.
|
||||
#-sbt-version 0.11.3
|
||||
|
||||
# Scala version (default: latest release)
|
||||
#
|
||||
#-scala-home <path>
|
||||
#-scala-version <version>
|
||||
|
||||
# java version (default: java from PATH, currently $(java -version |& grep version))
|
||||
#
|
||||
#-java-home <path>
|
||||
|
@ -7,8 +7,8 @@ import akka.actor.typed.ActorSystem;
|
||||
import akka.actor.typed.Behavior;
|
||||
import akka.actor.typed.Terminated;
|
||||
import akka.actor.typed.javadsl.Behaviors;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.events.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.Participant;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoom;
|
||||
import java.util.ArrayList;
|
||||
@ -53,7 +53,7 @@ public class PotQuickStart {
|
||||
|
||||
/* for (int i = 0; i < numberOfTurns; i++) {
|
||||
// Participar en cada turno cantidad diferente
|
||||
for (ActorRef<ParticipantProtocol.ParticipantMessage> session : sessions) {
|
||||
for (ActorRef<ParticipantProtocol.ParticipantMessage> session : participants) {
|
||||
|
||||
// Pícaro
|
||||
if (session.path().name().contains("participante-0")) {
|
||||
|
@ -1,32 +0,0 @@
|
||||
package dev.freireservices.social_altruism.chat.commands;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static dev.freireservices.social_altruism.chat.events.ParticipantProtocol.*;
|
||||
|
||||
public class PotRoomProtocol {
|
||||
public interface PotRoomMessage {}
|
||||
|
||||
public record EnterPot(ActorRef<ParticipantMessage> replyTo)
|
||||
implements PotRoomMessage {}
|
||||
|
||||
public record StartSession(
|
||||
ActorRef<ParticipantMessage> replyTo,
|
||||
List<ActorRef<PotRoomMessage>> sessions)
|
||||
implements PotRoomMessage {}
|
||||
|
||||
public record ParticipateInTurn(String message) implements PotRoomMessage {}
|
||||
|
||||
public record ShareReturnPotWithParticipants(double returnedAmount) implements PotRoomMessage {}
|
||||
|
||||
public record PlayTurn(
|
||||
//ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<ParticipantMessage> replyTo,
|
||||
double pot)
|
||||
implements PotRoomMessage {}
|
||||
|
||||
// #chatroom-protocol
|
||||
// #chatroom-behavior
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package dev.freireservices.social_altruism.chat.events;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.PotRoomMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParticipantProtocol {
|
||||
public interface ParticipantMessage {}
|
||||
|
||||
public record SessionGranted(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<PotRoomProtocol.ParticipateInTurn> handle)
|
||||
implements ParticipantMessage {}
|
||||
|
||||
public record SessionStarted(
|
||||
ActorRef<PotRoomMessage> replyTo,
|
||||
List<ActorRef<ParticipantMessage>> participants)
|
||||
implements ParticipantMessage {}
|
||||
|
||||
public record SessionDenied(String reason) implements ParticipantMessage {}
|
||||
|
||||
public record PotReturned(
|
||||
ActorRef<PotRoomMessage> handle,
|
||||
ActorRef<ParticipantMessage> participant,
|
||||
double returnedAmount)
|
||||
implements ParticipantMessage {}
|
||||
}
|
@ -7,11 +7,13 @@ import akka.actor.typed.ActorRef;
|
||||
import akka.actor.typed.Behavior;
|
||||
import akka.actor.typed.javadsl.ActorContext;
|
||||
import akka.actor.typed.javadsl.Behaviors;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.ParticipateInTurn;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.PotRoomMessage;
|
||||
import dev.freireservices.social_altruism.chat.events.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol.PotRoomMessage;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol;
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol.SessionMessage;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -19,153 +21,160 @@ import lombok.Setter;
|
||||
@Getter
|
||||
public class Participant {
|
||||
|
||||
private final ActorContext<ParticipantProtocol.ParticipantMessage> context;
|
||||
private ActorRef<PotRoomMessage> chatRoom;
|
||||
private final ActorContext<ParticipantMessage> context;
|
||||
private ActorRef<PotRoomMessage> chatRoom;
|
||||
private ActorRef<SessionMessage> session;
|
||||
|
||||
private boolean collaborateSwitch;
|
||||
private int currentTurn;
|
||||
private double coins;
|
||||
private final double initialCoins;
|
||||
private int participantNumber;
|
||||
private int totalTurns;
|
||||
private final ParticipantType participantType;
|
||||
private boolean collaborateSwitch;
|
||||
private int currentTurn;
|
||||
private double coins;
|
||||
private final double initialCoins;
|
||||
private int participantNumber;
|
||||
private int totalTurns;
|
||||
private final ParticipantType participantType;
|
||||
|
||||
private Participant(
|
||||
ActorContext<ParticipantProtocol.ParticipantMessage> context,
|
||||
double coins,
|
||||
ParticipantType participantType) {
|
||||
this.context = context;
|
||||
this.coins = coins;
|
||||
this.initialCoins = coins;
|
||||
this.participantType = participantType;
|
||||
this.collaborateSwitch = participantType == JUSTICIERO || participantType == SANTO;
|
||||
}
|
||||
|
||||
public static Behavior<ParticipantProtocol.ParticipantMessage> create(
|
||||
int initialCoins, ParticipantType participantType) {
|
||||
return Behaviors.setup(ctx -> new Participant(ctx, initialCoins, participantType).behavior());
|
||||
}
|
||||
|
||||
public void decrementCoins(double coins) {
|
||||
this.coins -= coins;
|
||||
}
|
||||
|
||||
public void incrementCoins(double coins) {
|
||||
this.coins += coins;
|
||||
}
|
||||
|
||||
private Behavior<ParticipantProtocol.ParticipantMessage> behavior() {
|
||||
return Behaviors.receive(ParticipantProtocol.ParticipantMessage.class)
|
||||
.onMessage(ParticipantProtocol.SessionStarted.class, this::onSessionStarted)
|
||||
.onMessage(ParticipantProtocol.SessionDenied.class, this::onSessionDenied)
|
||||
.onMessage(ParticipantProtocol.SessionGranted.class, this::onSessionGranted)
|
||||
.onMessage(ParticipantProtocol.PotReturned.class, this::onPotReturned)
|
||||
.build();
|
||||
}
|
||||
|
||||
private Behavior<ParticipantProtocol.ParticipantMessage> onSessionDenied(
|
||||
ParticipantProtocol.SessionDenied message) {
|
||||
context.getLog().info("cannot start chat room session: {}", message.reason());
|
||||
return Behaviors.stopped();
|
||||
}
|
||||
|
||||
private Behavior<ParticipantProtocol.ParticipantMessage> onSessionGranted(
|
||||
ParticipantProtocol.SessionGranted message) {
|
||||
setChatRoom(message.chatRoom());
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private Behavior<ParticipantProtocol.ParticipantMessage> onSessionStarted(
|
||||
ParticipantProtocol.SessionStarted startSession) {
|
||||
resetCurrentTurn();
|
||||
setParticipantNumber(startSession.participants().size());
|
||||
playTurn(startSession.replyTo());
|
||||
|
||||
context.getLog().info("Session started with {} participants", startSession.participants());
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private void playTurn(ActorRef<PotRoomMessage> replyTo) {
|
||||
if (getCoins() > 0 && getCurrentTurn() < getTotalTurns()) {
|
||||
replyTo.tell(new PotRoomProtocol.PlayTurn(context.getSelf(), getCurrentTurnParticipation()));
|
||||
incrementCurrentTurn();
|
||||
private Participant(
|
||||
ActorContext<ParticipantMessage> context,
|
||||
double coins,
|
||||
ParticipantType participantType) {
|
||||
this.context = context;
|
||||
this.coins = coins;
|
||||
this.initialCoins = coins;
|
||||
this.participantType = participantType;
|
||||
this.collaborateSwitch = participantType == JUSTICIERO || participantType == SANTO;
|
||||
}
|
||||
}
|
||||
|
||||
private double getCurrentTurnParticipation() {
|
||||
var currentTurnCoins = getRandomNumberBetween(0, Math.floor(getCoins()));
|
||||
decrementCoins(currentTurnCoins);
|
||||
return currentTurnCoins;
|
||||
}
|
||||
|
||||
public static double getRandomNumberBetween(double min, double max) {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
return secureRandom.nextDouble(max - min) + min;
|
||||
}
|
||||
|
||||
private Behavior<ParticipantProtocol.ParticipantMessage> onPotReturned(
|
||||
ParticipantProtocol.PotReturned potReturned) {
|
||||
context.getLog().info("Pot returned: {}", potReturned.returnedAmount());
|
||||
incrementCoins(potReturned.returnedAmount());
|
||||
|
||||
context
|
||||
.getLog()
|
||||
.info(
|
||||
"Player {} has now {} coins; started with {} for a total profit of: {} %",
|
||||
potReturned.participant().path().name(),
|
||||
getCoins(),
|
||||
getInitialCoins(),
|
||||
calculateProfit());
|
||||
|
||||
// Still game?
|
||||
if (getCoins() > 0) {
|
||||
playTurn(potReturned.handle());
|
||||
} else {
|
||||
context
|
||||
.getLog()
|
||||
.info(
|
||||
"Player {} has now {} coins; started with {} for a total profit of: {} %",
|
||||
potReturned.participant().path().name(),
|
||||
getCoins(),
|
||||
getInitialCoins(),
|
||||
calculateProfit());
|
||||
|
||||
return Behaviors.stopped();
|
||||
public static Behavior<ParticipantMessage> create(
|
||||
int initialCoins, ParticipantType participantType) {
|
||||
return Behaviors.setup(ctx -> new Participant(ctx, initialCoins, participantType).behavior());
|
||||
}
|
||||
adjustBehaviour(potReturned);
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private void adjustBehaviour(ParticipantProtocol.PotReturned potReturned) {
|
||||
|
||||
switch (participantType) {
|
||||
case SANTO:
|
||||
setCollaborateSwitch(true);
|
||||
break;
|
||||
case PICARO:
|
||||
setCollaborateSwitch(false);
|
||||
break;
|
||||
case JUSTICIERO:
|
||||
// Tweak minimum amount to collaborate
|
||||
setCollaborateSwitch(potReturned.returnedAmount() > getParticipantNumber());
|
||||
break;
|
||||
public void decrementCoins(double coins) {
|
||||
this.coins -= coins;
|
||||
}
|
||||
}
|
||||
|
||||
public void participant() {
|
||||
ActorRef<ParticipateInTurn> handle;
|
||||
// return this;
|
||||
}
|
||||
public void incrementCoins(double coins) {
|
||||
this.coins += coins;
|
||||
}
|
||||
|
||||
public void resetCurrentTurn() {
|
||||
setCurrentTurn(0);
|
||||
}
|
||||
private Behavior<ParticipantMessage> behavior() {
|
||||
return Behaviors.receive(ParticipantMessage.class)
|
||||
.onMessage(ParticipantProtocol.SessionStarted.class, this::onSessionStarted)
|
||||
.onMessage(ParticipantProtocol.SessionDenied.class, this::onSessionDenied)
|
||||
.onMessage(ParticipantProtocol.SessionGranted.class, this::onSessionGranted)
|
||||
.onMessage(ParticipantProtocol.PotReturned.class, this::onPotReturned)
|
||||
.build();
|
||||
}
|
||||
|
||||
public void incrementCurrentTurn() {
|
||||
setCurrentTurn(this.currentTurn++);
|
||||
}
|
||||
private Behavior<ParticipantMessage> onSessionDenied(
|
||||
ParticipantProtocol.SessionDenied message) {
|
||||
context.getLog().info("cannot start chat room session: {}", message.reason());
|
||||
return Behaviors.stopped();
|
||||
}
|
||||
|
||||
private double calculateProfit() {
|
||||
return Math.round((getCoins() * 100) / getInitialCoins() - 100);
|
||||
}
|
||||
private Behavior<ParticipantMessage> onSessionGranted(
|
||||
ParticipantProtocol.SessionGranted message) {
|
||||
setChatRoom(message.chatRoom());
|
||||
setSession(message.session());
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private Behavior<ParticipantMessage> onSessionStarted(
|
||||
ParticipantProtocol.SessionStarted startSession) {
|
||||
resetCurrentTurn();
|
||||
setParticipantNumber(startSession.participants().size());
|
||||
setTotalTurns(startSession.totalTurns());
|
||||
playTurn(startSession.replyTo());
|
||||
context.getLog().info("Session started for {} with {} participants", context.getSelf().path().name(), startSession.participants().size());
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private void playTurn(ActorRef<SessionMessage> replyTo) {
|
||||
if (getCoins() > 0 && getCurrentTurn() < getTotalTurns()) {
|
||||
replyTo.tell(new SessionProtocol.PlayTurn(
|
||||
replyTo,
|
||||
context.getSelf(),
|
||||
getCurrentTurn(),
|
||||
getParticipationForCurrentTurn()
|
||||
));
|
||||
incrementCurrentTurn();
|
||||
}
|
||||
}
|
||||
|
||||
private double getParticipationForCurrentTurn() {
|
||||
var currentTurnCoins = getRandomNumberBetween(0, Math.floor(getCoins()));
|
||||
decrementCoins(currentTurnCoins);
|
||||
return currentTurnCoins;
|
||||
}
|
||||
|
||||
public static double getRandomNumberBetween(double min, double max) {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
return Math.round(secureRandom.nextDouble(max - min) + min);
|
||||
}
|
||||
|
||||
private Behavior<ParticipantMessage> onPotReturned(
|
||||
ParticipantProtocol.PotReturned potReturned) {
|
||||
context.getLog().info("Pot returned: {}", potReturned.returnedAmount());
|
||||
incrementCoins(potReturned.returnedAmount());
|
||||
|
||||
context
|
||||
.getLog()
|
||||
.info(
|
||||
"Player {} has now {} coins; started with {} for a total profit of: {} %",
|
||||
potReturned.participant().path().name(),
|
||||
getCoins(),
|
||||
getInitialCoins(),
|
||||
calculateProfit());
|
||||
|
||||
// Still game?
|
||||
if (getCoins() > 0) {
|
||||
playTurn(potReturned.session());
|
||||
} else {
|
||||
context
|
||||
.getLog()
|
||||
.info(
|
||||
"Player {} has now {} coins; started with {} for a total profit of: {} %",
|
||||
potReturned.participant().path().name(),
|
||||
getCoins(),
|
||||
getInitialCoins(),
|
||||
calculateProfit());
|
||||
|
||||
return Behaviors.stopped();
|
||||
}
|
||||
adjustBehaviour(potReturned);
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private void adjustBehaviour(ParticipantProtocol.PotReturned potReturned) {
|
||||
|
||||
switch (participantType) {
|
||||
case SANTO:
|
||||
setCollaborateSwitch(true);
|
||||
break;
|
||||
case PICARO:
|
||||
setCollaborateSwitch(false);
|
||||
break;
|
||||
case JUSTICIERO:
|
||||
// Tweak minimum amount to collaborate
|
||||
setCollaborateSwitch(potReturned.returnedAmount() > getParticipantNumber());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void participant() {
|
||||
ActorRef<SessionProtocol.ParticipateInTurn> handle;
|
||||
// return this;
|
||||
}
|
||||
|
||||
public void resetCurrentTurn() {
|
||||
setCurrentTurn(0);
|
||||
}
|
||||
|
||||
public void incrementCurrentTurn() {
|
||||
setCurrentTurn(this.currentTurn++);
|
||||
}
|
||||
|
||||
private double calculateProfit() {
|
||||
return Math.round((getCoins() * 100) / getInitialCoins() - 100);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package dev.freireservices.social_altruism.chat.participant;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol.PotRoomMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol;
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol.SessionMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParticipantProtocol {
|
||||
public interface ParticipantMessage {
|
||||
}
|
||||
|
||||
public record SessionGranted(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<SessionMessage> session
|
||||
)
|
||||
implements ParticipantMessage {
|
||||
}
|
||||
|
||||
public record SessionStarted(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
|
||||
ActorRef<SessionMessage> replyTo,
|
||||
List<ActorRef<ParticipantMessage>> participants,
|
||||
int totalTurns)
|
||||
implements ParticipantMessage {
|
||||
}
|
||||
|
||||
public record SessionDenied(String reason) implements ParticipantMessage {
|
||||
}
|
||||
|
||||
public record PotReturned(
|
||||
ActorRef<SessionMessage> session,
|
||||
ActorRef<ParticipantMessage> participant,
|
||||
double returnedAmount)
|
||||
implements ParticipantMessage {
|
||||
}
|
||||
}
|
@ -1,17 +1,15 @@
|
||||
package dev.freireservices.social_altruism.chat.potroom;
|
||||
|
||||
import static dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.*;
|
||||
import static java.nio.charset.StandardCharsets.*;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
import akka.actor.typed.Behavior;
|
||||
import akka.actor.typed.javadsl.ActorContext;
|
||||
import akka.actor.typed.javadsl.Behaviors;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.PotRoomMessage;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.ShareReturnPotWithParticipants;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol.StartSession;
|
||||
import dev.freireservices.social_altruism.chat.events.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.events.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol.*;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol.SessionMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
@ -20,165 +18,79 @@ import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class PotRoom {
|
||||
private final ActorContext<PotRoomMessage> context;
|
||||
private final List<ActorRef<PotRoomMessage>> participants;
|
||||
private final ActorContext<PotRoomMessage> context;
|
||||
private final List<ActorRef<ParticipantMessage>> participants;
|
||||
|
||||
private double currentPot = 0.0;
|
||||
private int currentTurn = 0;
|
||||
private int totalTurns = 0;
|
||||
private int participantsInTurn = 0;
|
||||
private final int numberOfParticipants;
|
||||
private final int totalTurns;
|
||||
private final int numberOfParticipants;
|
||||
|
||||
private PotRoom(
|
||||
ActorContext<PotRoomMessage> context,
|
||||
List<ActorRef<PotRoomMessage>> participants,
|
||||
int numberOfParticipants,
|
||||
int turns) {
|
||||
this.context = context;
|
||||
this.participants = participants;
|
||||
this.numberOfParticipants = numberOfParticipants;
|
||||
this.totalTurns = turns;
|
||||
}
|
||||
|
||||
public void resetPot() {
|
||||
this.currentPot = 0;
|
||||
}
|
||||
|
||||
public void addToPot(double pot) {
|
||||
this.currentPot += pot;
|
||||
}
|
||||
|
||||
public void incrementParticipantsInTurn() {
|
||||
this.participantsInTurn++;
|
||||
}
|
||||
|
||||
public void resetParticipantsInTurn() {
|
||||
this.participantsInTurn = 0;
|
||||
}
|
||||
|
||||
public int incrementCurrentTurnAndGet() {
|
||||
this.currentTurn++;
|
||||
return this.currentTurn;
|
||||
}
|
||||
|
||||
// #chatroom-behavior
|
||||
// #chatroom-protocol
|
||||
|
||||
private Behavior<PotRoomMessage> onGetPotSession(
|
||||
ActorRef<PotRoomMessage> chatRoom, PotRoomProtocol.EnterPot enterPot) {
|
||||
|
||||
validate(enterPot);
|
||||
|
||||
context.getLog().info("Participant joined {} pot", enterPot.replyTo().path().name());
|
||||
|
||||
ActorRef<ParticipantMessage> client = enterPot.replyTo();
|
||||
|
||||
ActorRef<PotRoomMessage> session =
|
||||
context.spawn(
|
||||
Session.create(chatRoom, client),
|
||||
URLEncoder.encode(enterPot.replyTo().path().name(), UTF_8));
|
||||
|
||||
client.tell(new ParticipantProtocol.SessionGranted(chatRoom,session.narrow()));
|
||||
|
||||
participants.add(session);
|
||||
|
||||
if (getNumberOfParticipants() == participants.size()) {
|
||||
context.getLog().info("All participants joined; pot is ready to start.");
|
||||
|
||||
// Communicate session start and share pot info with all participants
|
||||
chatRoom.tell(new StartSession(enterPot.replyTo(), participants));
|
||||
|
||||
return createPotBehaviour(chatRoom);
|
||||
} else {
|
||||
// Waiting for more participants
|
||||
context.getLog().info("Waiting for more participants.");
|
||||
return Behaviors.same();
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(PotRoomProtocol.EnterPot enterPot) {
|
||||
// Add check session started
|
||||
if (participants.stream()
|
||||
.anyMatch(
|
||||
s ->
|
||||
s.path()
|
||||
.name()
|
||||
.equals(URLEncoder.encode(enterPot.replyTo().path().name(), UTF_8)))) {
|
||||
|
||||
enterPot.replyTo().tell(new ParticipantProtocol.SessionDenied("Can only enter a pot once"));
|
||||
}
|
||||
}
|
||||
|
||||
private Behavior<PotRoomMessage> onPlayTurn(PotRoomProtocol.PlayTurn playTurn) {
|
||||
context
|
||||
.getLog()
|
||||
.info(
|
||||
"Participant joined for turn {} with {}",
|
||||
//playTurn.replyTo().path().name(),
|
||||
currentTurn,
|
||||
playTurn.pot());
|
||||
|
||||
// Add to current pot
|
||||
addToPot(playTurn.pot());
|
||||
incrementParticipantsInTurn();
|
||||
|
||||
if (getParticipantsInTurn() == numberOfParticipants) {
|
||||
|
||||
double amountToShare = (getCurrentPot() * 2) / numberOfParticipants;
|
||||
participants.forEach(s -> s.tell(new ShareReturnPotWithParticipants(amountToShare)));
|
||||
|
||||
resetPot();
|
||||
resetParticipantsInTurn();
|
||||
|
||||
context.getLog().info("Turn {} complete", getCurrentTurn());
|
||||
|
||||
if (incrementCurrentTurnAndGet() == totalTurns) {
|
||||
context.getLog().info("All turns completed");
|
||||
return Behaviors.stopped();
|
||||
}
|
||||
}
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private Behavior<PotRoomMessage> createPotBehaviour(ActorRef<PotRoomMessage> chatRoom) {
|
||||
return Behaviors.receive(PotRoomMessage.class)
|
||||
.onMessage(PotRoomProtocol.EnterPot.class, x -> onGetPotSession(chatRoom, x))
|
||||
.onMessage(PotRoomProtocol.PlayTurn.class, this::onPlayTurn)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Behavior<PotRoomMessage> create(int numberOfParticipants, int turns) {
|
||||
return Behaviors.setup(
|
||||
ctx ->
|
||||
new PotRoom(ctx, new ArrayList<>(), numberOfParticipants, turns)
|
||||
.createPotBehaviour(ctx.getSelf()));
|
||||
}
|
||||
|
||||
static class Session {
|
||||
static Behavior<PotRoomMessage> create(
|
||||
ActorRef<PotRoomMessage> chatRoom, ActorRef<ParticipantMessage> client) {
|
||||
return Behaviors.receive(PotRoomMessage.class)
|
||||
.onMessage(
|
||||
ShareReturnPotWithParticipants.class,
|
||||
sharePot -> onSharePotWithParticipants(chatRoom, client, sharePot.returnedAmount()))
|
||||
.onMessage(
|
||||
StartSession.class,
|
||||
(startSession) -> onSessionStarted(startSession.replyTo(), startSession.sessions()))
|
||||
.build();
|
||||
private PotRoom(
|
||||
ActorContext<PotRoomMessage> context,
|
||||
List<ActorRef<ParticipantMessage>> participants,
|
||||
int numberOfParticipants,
|
||||
int totalTurns) {
|
||||
this.context = context;
|
||||
this.participants = participants;
|
||||
this.numberOfParticipants = numberOfParticipants;
|
||||
this.totalTurns = totalTurns;
|
||||
}
|
||||
|
||||
private static Behavior<PotRoomMessage> onSessionStarted(
|
||||
ActorRef<ParticipantMessage> replyTo, List<ActorRef<PotRoomMessage>> participants) {
|
||||
participants.forEach(s -> s.tell(new StartSession(replyTo, participants)));
|
||||
return Behaviors.same();
|
||||
private Behavior<PotRoomMessage> onGetPotSession(
|
||||
ActorRef<PotRoomMessage> chatRoom, EnterPot enterPot) {
|
||||
|
||||
validate(enterPot);
|
||||
|
||||
context.getLog().info("Participant joined {} pot", enterPot.replyTo().path().name());
|
||||
|
||||
ActorRef<ParticipantMessage> participant = enterPot.replyTo();
|
||||
|
||||
ActorRef<SessionMessage> session =
|
||||
context.spawn(
|
||||
Session.create(getNumberOfParticipants(), totalTurns),
|
||||
URLEncoder.encode(enterPot.replyTo().path().name(), UTF_8));
|
||||
|
||||
participant.tell(new SessionGranted(chatRoom, session.narrow()));
|
||||
|
||||
participants.add(participant);
|
||||
|
||||
if (getNumberOfParticipants() == participants.size()) {
|
||||
context.getLog().info("All participants joined; pot is ready to start.");
|
||||
|
||||
// Communicate session start and share pot info with all participants
|
||||
participants.forEach(p -> p.tell(new SessionStarted(chatRoom, session, participants, totalTurns)));
|
||||
|
||||
return createPotBehaviour(chatRoom);
|
||||
} else {
|
||||
// Waiting for more participants
|
||||
context.getLog().info("Waiting for more participants.");
|
||||
return Behaviors.same();
|
||||
}
|
||||
}
|
||||
|
||||
private static Behavior<PotRoomMessage> onSharePotWithParticipants(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<ParticipantMessage> participant,
|
||||
double returnedAmount) {
|
||||
participant.tell(new ParticipantProtocol.PotReturned(chatRoom, participant, returnedAmount));
|
||||
return Behaviors.same();
|
||||
private void validate(EnterPot enterPot) {
|
||||
// Add check session started
|
||||
if (participants.stream()
|
||||
.anyMatch(
|
||||
s ->
|
||||
s.path()
|
||||
.name()
|
||||
.equals(URLEncoder.encode(enterPot.replyTo().path().name(), UTF_8)))) {
|
||||
|
||||
enterPot.replyTo().tell(new SessionDenied("Can only enter a pot once"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Behavior<PotRoomMessage> createPotBehaviour(ActorRef<PotRoomMessage> chatRoom) {
|
||||
return Behaviors.receive(PotRoomMessage.class)
|
||||
.onMessage(EnterPot.class, x -> onGetPotSession(chatRoom, x))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Behavior<PotRoomMessage> create(int numberOfParticipants, int turns) {
|
||||
return Behaviors.setup(
|
||||
ctx ->
|
||||
new PotRoom(ctx, new ArrayList<>(), numberOfParticipants, turns)
|
||||
.createPotBehaviour(ctx.getSelf()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package dev.freireservices.social_altruism.chat.potroom;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.*;
|
||||
|
||||
public class PotRoomProtocol {
|
||||
public interface PotRoomMessage {}
|
||||
|
||||
public record EnterPot(ActorRef<ParticipantMessage> replyTo)
|
||||
implements PotRoomMessage {}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package dev.freireservices.social_altruism.chat.potroom;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
import akka.actor.typed.Behavior;
|
||||
import akka.actor.typed.javadsl.ActorContext;
|
||||
import akka.actor.typed.javadsl.Behaviors;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol.PotRoomMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol.SessionMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class Session {
|
||||
|
||||
private final ActorContext<SessionMessage> context;
|
||||
private int currentTurn = 0;
|
||||
private final int totalTurns;
|
||||
private final int numberOfParticipants;
|
||||
|
||||
private double currentPot = 0.0;
|
||||
private int participantsInCurrentTurn;
|
||||
|
||||
|
||||
public Session(ActorContext<SessionMessage> context, int totalTurns, int numberOfParticipants) {
|
||||
this.context = context;
|
||||
this.totalTurns = totalTurns;
|
||||
this.numberOfParticipants = numberOfParticipants;
|
||||
}
|
||||
|
||||
|
||||
public void resetPot() {
|
||||
this.currentPot = 0;
|
||||
}
|
||||
|
||||
public void addToPot(double pot) {
|
||||
currentPot += pot;
|
||||
}
|
||||
|
||||
public void incrementParticipantsInTurn() {
|
||||
this.participantsInCurrentTurn++;
|
||||
}
|
||||
|
||||
public void resetParticipantsInTurn() {
|
||||
this.participantsInCurrentTurn = 0;
|
||||
}
|
||||
|
||||
public int incrementCurrentTurnAndGet() {
|
||||
return ++this.currentTurn;
|
||||
}
|
||||
|
||||
|
||||
public Behavior<SessionMessage> createSessionBehaviour() {
|
||||
return Behaviors.receive(SessionMessage.class)
|
||||
.onMessage(SessionProtocol.StartSession.class, startSession -> onSessionStarted(startSession.chatRoom()
|
||||
, startSession.replyTo(), startSession.participants(), totalTurns))
|
||||
.onMessage(SessionProtocol.PlayTurn.class, this::onPlayTurn)
|
||||
.onMessage(SessionProtocol.ShareReturnPotWithParticipants.class,
|
||||
sharePot -> onSharePotWithParticipant(sharePot.session(), sharePot.participant(), sharePot.returnedAmount()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public static Behavior<SessionMessage> create(int numberOfParticipants, int turns) {
|
||||
return Behaviors.setup(context -> new Session(context, numberOfParticipants, turns)
|
||||
.createSessionBehaviour());
|
||||
}
|
||||
|
||||
|
||||
private Behavior<SessionMessage> onPlayTurn(
|
||||
SessionProtocol.PlayTurn playTurn) {
|
||||
context.getLog()
|
||||
.info("Participant {} joined for turn {} with {}",
|
||||
playTurn.replyTo().path().name(),
|
||||
playTurn.turn(),
|
||||
playTurn.pot());
|
||||
|
||||
// Add to current pot
|
||||
addToPot(playTurn.pot());
|
||||
incrementParticipantsInTurn();
|
||||
|
||||
if (getParticipantsInCurrentTurn() == numberOfParticipants) {
|
||||
|
||||
double amountToShare = (getCurrentPot() * 2) / numberOfParticipants;
|
||||
|
||||
playTurn.session().narrow().tell(new SessionProtocol.ShareReturnPotWithParticipants(playTurn.session(), playTurn.replyTo(), amountToShare));
|
||||
|
||||
resetPot();
|
||||
resetParticipantsInTurn();
|
||||
|
||||
context.getLog().info("Turn {} complete", getCurrentTurn());
|
||||
|
||||
if (incrementCurrentTurnAndGet() == totalTurns) {
|
||||
context.getLog().info("All turns completed");
|
||||
//return Behaviors.stopped();
|
||||
}
|
||||
}
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private static Behavior<SessionMessage> onSessionStarted(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<SessionMessage> session,
|
||||
List<ActorRef<ParticipantMessage>> participants,
|
||||
int totalTurns) {
|
||||
participants.forEach(s -> s.tell(new ParticipantProtocol.SessionStarted(chatRoom, session, participants, totalTurns)));
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
private static Behavior<SessionMessage> onSharePotWithParticipant(
|
||||
ActorRef<SessionMessage> session,
|
||||
ActorRef<ParticipantMessage> participant,
|
||||
double returnedAmount) {
|
||||
participant.tell(new ParticipantProtocol.PotReturned(session, participant, returnedAmount));
|
||||
return Behaviors.same();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package dev.freireservices.social_altruism.chat.potroom;
|
||||
|
||||
import akka.actor.typed.ActorRef;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol.PotRoomMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class SessionProtocol {
|
||||
|
||||
public interface SessionMessage {
|
||||
}
|
||||
|
||||
public record StartSession(
|
||||
ActorRef<PotRoomMessage> chatRoom,
|
||||
ActorRef<SessionMessage> replyTo,
|
||||
List<ActorRef<ParticipantMessage>> participants)
|
||||
implements SessionMessage {
|
||||
}
|
||||
|
||||
public record ParticipateInTurn(String message) implements SessionMessage {
|
||||
}
|
||||
|
||||
public record ShareReturnPotWithParticipants(
|
||||
ActorRef<SessionMessage> session,
|
||||
ActorRef<ParticipantMessage> participant,
|
||||
double returnedAmount) implements SessionMessage {
|
||||
}
|
||||
|
||||
public record PlayTurn(
|
||||
ActorRef<SessionMessage> session,
|
||||
ActorRef<ParticipantMessage> replyTo,
|
||||
int turn,
|
||||
double pot)
|
||||
implements SessionMessage {
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration debug="true"
|
||||
xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
xmlns:log4j='https://jakarta.apache.org/log4j/'>
|
||||
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- This is a development logging configuration that logs to standard out, for an example of a production
|
||||
logging config, see the Akka docs: https://doc.akka.io/docs/akka/2.6/typed/logging.html#logback -->
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>[%date{ISO8601}] [%level] [%logger] [%thread] [%X{akkaSource}] - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>1024</queueSize>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="STDOUT" />
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ASYNC"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
@ -1,73 +1,93 @@
|
||||
package dev.freireservices.social_altruism.chat;
|
||||
|
||||
import static dev.freireservices.social_altruism.chat.participant.ParticipantType.*;
|
||||
import static java.net.URLEncoder.encode;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import akka.actor.testkit.typed.javadsl.ActorTestKit;
|
||||
import akka.actor.testkit.typed.javadsl.TestProbe;
|
||||
import akka.actor.typed.ActorRef;
|
||||
import dev.freireservices.social_altruism.chat.commands.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.events.ParticipantProtocol;
|
||||
import akka.actor.typed.javadsl.ActorContext;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.ParticipantMessage;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol.SessionStarted;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoomProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.ParticipantProtocol;
|
||||
import dev.freireservices.social_altruism.chat.participant.Participant;
|
||||
import dev.freireservices.social_altruism.chat.potroom.PotRoom;
|
||||
import dev.freireservices.social_altruism.chat.potroom.Session;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
import dev.freireservices.social_altruism.chat.potroom.SessionProtocol.SessionMessage;
|
||||
import org.junit.Test;
|
||||
|
||||
// #definition
|
||||
public class PotQuickStartTest {
|
||||
public static final int INITIAL_COINS = 100;
|
||||
public static final int TOTAL_PARTICIPANTS = 3;
|
||||
|
||||
// #definition
|
||||
@Test
|
||||
// FIXME - Improve or delete..
|
||||
public void testCooperationCaseOne() throws InterruptedException {
|
||||
|
||||
// #test
|
||||
@Test
|
||||
// FIXME - Improve or delete..
|
||||
public void testCooperationCaseOne() {
|
||||
final ActorTestKit testKit = ActorTestKit.create();
|
||||
|
||||
final ActorTestKit testKit = ActorTestKit.create();
|
||||
TestProbe<ParticipantMessage> testProbe =
|
||||
testKit.createTestProbe("TestProbe");
|
||||
|
||||
ActorRef<PotRoomProtocol.PotRoomMessage> chatRoomTest =
|
||||
testKit.spawn(PotRoom.create(3, 1), "potRoom");
|
||||
ActorRef<PotRoomProtocol.PotRoomMessage> chatRoomTest =
|
||||
testKit.spawn(PotRoom.create(3, 1), "potRoom");
|
||||
|
||||
ActorRef<ParticipantProtocol.ParticipantMessage> p1 = testKit.spawn(Participant.create(100, PICARO), "PICARO-1");
|
||||
ActorRef<ParticipantMessage> p1 =
|
||||
testKit.spawn(Participant.create(INITIAL_COINS, PICARO), "PICARO-1");
|
||||
|
||||
ActorRef<ParticipantProtocol.ParticipantMessage> p2 = testKit.spawn(Participant.create(100, JUSTICIERO), "JUSTICIERO-1");
|
||||
ActorRef<ParticipantMessage> p2 =
|
||||
testKit.spawn(Participant.create(INITIAL_COINS, JUSTICIERO), "JUSTICIERO-1");
|
||||
|
||||
ActorRef<ParticipantProtocol.ParticipantMessage> p3 = testKit.spawn(Participant.create(10, SANTO), "SANTO-1");
|
||||
ActorRef<ParticipantMessage> p3 =
|
||||
testKit.spawn(Participant.create(INITIAL_COINS, SANTO), "SANTO-1");
|
||||
|
||||
final List<ActorRef<ParticipantProtocol.ParticipantMessage>> sessions = List.of(p1, p2, p3);
|
||||
|
||||
// Enter POT
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(p1));
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(p2));
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(p3));
|
||||
ActorRef<SessionMessage> sessionP1 =
|
||||
testKit.spawn(Session.create(TOTAL_PARTICIPANTS, 1), encode(p1.path().name(), UTF_8));
|
||||
ActorRef<SessionMessage> sessionP2 =
|
||||
testKit.spawn(Session.create(TOTAL_PARTICIPANTS, 1), encode(p2.path().name(), UTF_8));
|
||||
ActorRef<SessionMessage> sessionP3 =
|
||||
testKit.spawn(Session.create(TOTAL_PARTICIPANTS, 1), encode(p3.path().name(), UTF_8));
|
||||
|
||||
// Turnos
|
||||
chatRoomTest.tell(new PotRoomProtocol.PlayTurn(p1,0));
|
||||
chatRoomTest.tell(new PotRoomProtocol.PlayTurn(p2,1));
|
||||
chatRoomTest.tell(new PotRoomProtocol.PlayTurn(p3, 3));
|
||||
final List<ActorRef<SessionMessage>> sessions = List.of(sessionP1, sessionP2, sessionP3);
|
||||
|
||||
// #assert
|
||||
// #assert
|
||||
// Enter POT
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(p1));
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(p2));
|
||||
//chatRoomTest.tell(new PotRoomProtocol.EnterPot(p3));
|
||||
|
||||
}
|
||||
//Session started
|
||||
|
||||
@Test
|
||||
public void testActorGetsUserDenied() {
|
||||
final ActorTestKit testKit = ActorTestKit.create();
|
||||
TestProbe<ParticipantProtocol.ParticipantMessage> testProbe = testKit.createTestProbe("TestProbe");
|
||||
testProbe.expectMessageClass(SessionStarted.class, Duration.ofSeconds(10));
|
||||
|
||||
ActorRef<PotRoomProtocol.PotRoomMessage> chatRoomTest =
|
||||
testKit.spawn(PotRoom.create(2, 1), "chatRoom");
|
||||
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(testProbe.ref()));
|
||||
}
|
||||
|
||||
testProbe.expectMessageClass(ParticipantProtocol.SessionGranted.class, Duration.ofSeconds(10));
|
||||
@Test
|
||||
public void testActorGetsUserDenied() {
|
||||
final ActorTestKit testKit = ActorTestKit.create();
|
||||
TestProbe<ParticipantMessage> testProbe =
|
||||
testKit.createTestProbe("TestProbe");
|
||||
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(testProbe.ref()));
|
||||
ActorRef<PotRoomProtocol.PotRoomMessage> chatRoomTest =
|
||||
testKit.spawn(PotRoom.create(2, 1), "chatRoom");
|
||||
|
||||
testProbe.expectMessage(
|
||||
Duration.ofSeconds(10), new ParticipantProtocol.SessionDenied("Can only enter a pot once"));
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(testProbe.ref()));
|
||||
|
||||
// #assert
|
||||
}
|
||||
testProbe.expectMessageClass(ParticipantProtocol.SessionGranted.class, Duration.ofSeconds(10));
|
||||
|
||||
chatRoomTest.tell(new PotRoomProtocol.EnterPot(testProbe.ref()));
|
||||
|
||||
testProbe.expectMessage(
|
||||
Duration.ofSeconds(10), new ParticipantProtocol.SessionDenied("Can only enter a pot once"));
|
||||
|
||||
// #assert
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration debug="true"
|
||||
xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
xmlns:log4j='https://jakarta.apache.org/log4j/'>
|
||||
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- This is a development logging configuration that logs to standard out, for an example of a production
|
||||
logging config, see the Akka docs: https://doc.akka.io/docs/akka/2.6/typed/logging.html#logback -->
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>[%date{ISO8601}] [%level] [%logger] [%thread] [%X{akkaSource}] - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>1024</queueSize>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="STDOUT" />
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ASYNC"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
@ -1,20 +1,22 @@
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$PotRoomMessage.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol$ParticipantMessage.class
|
||||
dev/freireservices/social_altruism/chat/potroom/Session.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol$PlayTurn.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantType.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$ParticipateInTurn.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol$SessionStarted.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol$ParticipateInTurn.class
|
||||
dev/freireservices/social_altruism/chat/potroom/PotRoomProtocol.class
|
||||
dev/freireservices/social_altruism/chat/PotQuickStart.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$EnterPot.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol$SessionDenied.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol$SessionGranted.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol$ParticipantMessage.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol.class
|
||||
dev/freireservices/social_altruism/chat/PotQuickStart$Main.class
|
||||
dev/freireservices/social_altruism/chat/potroom/PotRoom.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol$SessionGranted.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol$SessionDenied.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$SharePotWithParticipants.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol.class
|
||||
dev/freireservices/social_altruism/chat/potroom/PotRoomProtocol$PotRoomMessage.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol$PotReturned.class
|
||||
dev/freireservices/social_altruism/chat/participant/Participant.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$PlayTurn.class
|
||||
dev/freireservices/social_altruism/chat/potroom/PotRoom$Session.class
|
||||
dev/freireservices/social_altruism/chat/commands/PotRoomProtocol$StartSession.class
|
||||
dev/freireservices/social_altruism/chat/events/ParticipantProtocol$PotReturned.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol$ShareReturnPotWithParticipants.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol$SessionMessage.class
|
||||
dev/freireservices/social_altruism/chat/potroom/SessionProtocol$StartSession.class
|
||||
dev/freireservices/social_altruism/chat/potroom/PotRoomProtocol$EnterPot.class
|
||||
dev/freireservices/social_altruism/chat/participant/ParticipantProtocol$SessionStarted.class
|
||||
dev/freireservices/social_altruism/chat/participant/Participant$1.class
|
||||
|
@ -1,6 +1,8 @@
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/potroom/PotRoomProtocol.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/participant/ParticipantProtocol.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/potroom/PotRoom.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/commands/PotRoomProtocol.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/events/ParticipantProtocol.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/potroom/Session.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/participant/Participant.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/PotQuickStart.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/potroom/SessionProtocol.java
|
||||
/Users/rdev/Source/social_altruism_akka/src/main/java/dev/freireservices/social_altruism/chat/participant/ParticipantType.java
|
||||
|
Loading…
x
Reference in New Issue
Block a user