diff --git a/libs/ASAPJava.jar b/libs/ASAPJava.jar index ee0e24b..c256788 100644 Binary files a/libs/ASAPJava.jar and b/libs/ASAPJava.jar differ diff --git a/local_mvn_repo/net/sharksystem/asapjava/0.8/_remote.repositories b/local_mvn_repo/net/sharksystem/asapjava/0.8/_remote.repositories deleted file mode 100644 index 1c41a17..0000000 --- a/local_mvn_repo/net/sharksystem/asapjava/0.8/_remote.repositories +++ /dev/null @@ -1,4 +0,0 @@ -#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. -#Tue Feb 28 19:26:21 CET 2023 -asapjava-0.8.jar>= -asapjava-0.8.pom>= diff --git a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar b/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar deleted file mode 100644 index b0b92dc..0000000 Binary files a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar and /dev/null differ diff --git a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar.lastUpdated b/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar.lastUpdated deleted file mode 100644 index 5265f77..0000000 --- a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.jar.lastUpdated +++ /dev/null @@ -1,6 +0,0 @@ -#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. -#Tue Feb 28 19:20:42 CET 2023 -https\://repo.maven.apache.org/maven2/.lastUpdated=1677608442967 -file\:///home/marvin/.m2/.error= -https\://repo.maven.apache.org/maven2/.error= -file\:///home/marvin/.m2/.lastUpdated=1677608442816 diff --git a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom b/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom deleted file mode 100644 index 92754dd..0000000 --- a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - net.sharksystem - asapjava - 0.8 - POM was created from install:install-file - diff --git a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom.lastUpdated b/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom.lastUpdated deleted file mode 100644 index f5f8b48..0000000 --- a/local_mvn_repo/net/sharksystem/asapjava/0.8/asapjava-0.8.pom.lastUpdated +++ /dev/null @@ -1,6 +0,0 @@ -#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. -#Tue Feb 28 19:20:42 CET 2023 -https\://repo.maven.apache.org/maven2/.lastUpdated=1677608442813 -file\:///home/marvin/.m2/.error= -https\://repo.maven.apache.org/maven2/.error= -file\:///home/marvin/.m2/.lastUpdated=1677608442788 diff --git a/local_mvn_repo/net/sharksystem/asapjava/maven-metadata-local.xml b/local_mvn_repo/net/sharksystem/asapjava/maven-metadata-local.xml deleted file mode 100644 index aed7457..0000000 --- a/local_mvn_repo/net/sharksystem/asapjava/maven-metadata-local.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - net.sharksystem - asapjava - - 0.8 - - 0.8 - - 20230523172159 - - diff --git a/src/main/java/net/sharksystem/hub/peerside/ASAPHubManagerImpl.java b/src/main/java/net/sharksystem/hub/peerside/ASAPHubManagerImpl.java index 45faac9..6ac9968 100644 --- a/src/main/java/net/sharksystem/hub/peerside/ASAPHubManagerImpl.java +++ b/src/main/java/net/sharksystem/hub/peerside/ASAPHubManagerImpl.java @@ -1,9 +1,6 @@ package net.sharksystem.hub.peerside; -import net.sharksystem.asap.ASAPEncounterManager; -import net.sharksystem.asap.ASAPException; -import net.sharksystem.asap.ASAPPeer; -import net.sharksystem.asap.EncounterConnectionType; +import net.sharksystem.asap.*; import net.sharksystem.hub.Connector; import net.sharksystem.utils.AlarmClock; import net.sharksystem.utils.AlarmClockListener; @@ -275,7 +272,7 @@ public void notifySynced(Connector connector, boolean changed) { Log.writeLog(this, this.toString(), "got peerIDs: " + peerIDs); if (peerIDs != null && !peerIDs.isEmpty()) for (CharSequence peerID : peerIDs) { if (this.asapEncounterManager.shouldCreateConnectionToPeer( - peerID, EncounterConnectionType.ASAP_HUB)) { + peerID, ASAPEncounterConnectionType.ASAP_HUB)) { hubConnector.connectPeer(peerID); } } @@ -291,7 +288,7 @@ public void notifySynced(Connector connector, boolean changed) { @Override public void notifyPeerConnected(CharSequence targetPeerID, StreamPair streamPair) { try { - this.asapEncounterManager.handleEncounter(streamPair, EncounterConnectionType.ASAP_HUB); + this.asapEncounterManager.handleEncounter(streamPair, ASAPEncounterConnectionType.ASAP_HUB); } catch (IOException e) { Log.writeLogErr(this, this.toString(), "cannot handle peer encounter: " + e.getLocalizedMessage()); diff --git a/src/main/java/net/sharksystem/hub/peerside/HubTester.java b/src/main/java/net/sharksystem/hub/peerside/HubTester.java index f624518..9ccf373 100644 --- a/src/main/java/net/sharksystem/hub/peerside/HubTester.java +++ b/src/main/java/net/sharksystem/hub/peerside/HubTester.java @@ -22,12 +22,13 @@ public class HubTester { private final CharSequence format; private PrintStream printStream; - public HubTester(String peerId, CharSequence format) throws IOException, ASAPException { + public HubTester(String peerId, CharSequence format) throws IOException, SharkException { String ROOT_FOLDER = "./testPeerFS" + "/" + peerId; FSUtils.removeFolder(ROOT_FOLDER); this.asapPeer = new ASAPTestPeerFS(peerId, new ArrayList<>(Collections.singletonList(format))); this.format = format; - this.hubConnectionManager = new HubConnectionManagerImpl(new ASAPEncounterManagerImpl(asapPeer), asapPeer); + this.hubConnectionManager = new HubConnectionManagerImpl( + new ASAPEncounterManagerImpl(asapPeer, asapPeer.getPeerID()), asapPeer); printStream = System.out; } diff --git a/src/test/java/net/sharksystem/hub/HubConnectionManagerTest.java b/src/test/java/net/sharksystem/hub/HubConnectionManagerTest.java index 5698f23..4306fdc 100644 --- a/src/test/java/net/sharksystem/hub/HubConnectionManagerTest.java +++ b/src/test/java/net/sharksystem/hub/HubConnectionManagerTest.java @@ -33,7 +33,8 @@ public void setUp() throws Exception { hubPort = TestHelper.getPortNumber(); localHostHubDescription = new TCPHubConnectorDescriptionImpl("localhost", hubPort, multiChannel); ASAPPeerFS asapPeer = new ASAPTestPeerFS(ALICE_ID, Collections.singletonList(FORMAT)); - hubConnectionManager = new HubConnectionManagerImpl(new ASAPEncounterManagerImpl(asapPeer), asapPeer); + hubConnectionManager = new HubConnectionManagerImpl( + new ASAPEncounterManagerImpl(asapPeer, asapPeer.getPeerID()), asapPeer); asapHub = ASAPTCPHub.startTCPHubThread(hubPort, multiChannel, MAX_IDLE_IN_SECONDS); } diff --git a/src/test/java/net/sharksystem/hub/HubManagerTests.java b/src/test/java/net/sharksystem/hub/HubManagerTests.java index c4726d0..3924a56 100644 --- a/src/test/java/net/sharksystem/hub/HubManagerTests.java +++ b/src/test/java/net/sharksystem/hub/HubManagerTests.java @@ -1,5 +1,6 @@ package net.sharksystem.hub; +import net.sharksystem.SharkException; import net.sharksystem.asap.ASAPEncounterManagerImpl; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.apps.testsupport.ASAPTestPeerFS; @@ -22,7 +23,7 @@ public class HubManagerTests { @Test - public void test1() throws IOException, ASAPException, InterruptedException { + public void test1() throws IOException, SharkException, InterruptedException { // launch hub int specificPort = TestHelper.getPortNumber(); CharSequence host = "localhost"; @@ -60,7 +61,7 @@ public void test1() throws IOException, ASAPException, InterruptedException { Thread.sleep(maxTimeOutMillis*2); // add to hub manager - ASAPEncounterManagerImpl asapEncounterManager = new ASAPEncounterManagerImpl(alicePeer); + ASAPEncounterManagerImpl asapEncounterManager = new ASAPEncounterManagerImpl(alicePeer, alicePeer.getPeerID()); ASAPHubManagerImpl asapASAPHubManager = new ASAPHubManagerImpl(asapEncounterManager); asapASAPHubManager.setTimeOutInMillis(maxTimeOutMillis); asapASAPHubManager.addHub(aliceHubConnector); diff --git a/src/test/java/net/sharksystem/hub/HubUsageTests.java b/src/test/java/net/sharksystem/hub/HubUsageTests.java index 1589b1e..f7c5221 100644 --- a/src/test/java/net/sharksystem/hub/HubUsageTests.java +++ b/src/test/java/net/sharksystem/hub/HubUsageTests.java @@ -1,5 +1,6 @@ package net.sharksystem.hub; +import net.sharksystem.SharkException; import net.sharksystem.asap.ASAPEncounterManagerImpl; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.apps.testsupport.ASAPTestPeerFS; @@ -169,16 +170,16 @@ public void runUsageTest( } @Test - public void usageHubManagerAndTwoPeers_MultiChannel_True() throws IOException, InterruptedException, ASAPException { + public void usageHubManagerAndTwoPeers_MultiChannel_True() throws IOException, InterruptedException, SharkException { this.usageHubManagerAndTwoPeers(true); } @Test - public void usageHubManagerAndTwoPeers_MultiChannel_False() throws IOException, InterruptedException, ASAPException { + public void usageHubManagerAndTwoPeers_MultiChannel_False() throws IOException, InterruptedException, SharkException { this.usageHubManagerAndTwoPeers(false); } - public void usageHubManagerAndTwoPeers(boolean multichannel) throws IOException, InterruptedException, ASAPException { + public void usageHubManagerAndTwoPeers(boolean multichannel) throws IOException, InterruptedException, SharkException { int hubPort = TestHelper.getPortNumber(); HubConnectorDescription localHostHubDescription = new TCPHubConnectorDescriptionImpl("localhost", hubPort, multichannel); @@ -210,7 +211,7 @@ public void usageHubManagerAndTwoPeers(boolean multichannel) throws IOException, ///////////////////// connect to hub - Alice // setup encounter manager with a connection handler ASAPEncounterManagerImpl aliceEncounterManager = - new ASAPEncounterManagerImpl(aliceASAPPeer); + new ASAPEncounterManagerImpl(aliceASAPPeer, aliceASAPPeer.getPeerID()); // setup hub manager // ASAPHubManager aliceHubManager = ASAPHubManagerImpl.startASAPHubManager(aliceEncounterManager); @@ -223,7 +224,7 @@ public void usageHubManagerAndTwoPeers(boolean multichannel) throws IOException, ///////////////////// connect to hub - Bob // setup encounter manager with a connection handler ASAPEncounterManagerImpl bobEncounterManager = - new ASAPEncounterManagerImpl(bobASAPPeer); + new ASAPEncounterManagerImpl(bobASAPPeer, bobASAPPeer.getPeerID()); // setup hub manager // ASAPHubManager bobHubManager = ASAPHubManagerImpl.startASAPHubManager(bobEncounterManager); diff --git a/src/test/java/net/sharksystem/hub/KnownBugsHubConnectionManagerTest.java b/src/test/java/net/sharksystem/hub/KnownBugsHubConnectionManagerTest.java index d254a8e..ac8e51d 100644 --- a/src/test/java/net/sharksystem/hub/KnownBugsHubConnectionManagerTest.java +++ b/src/test/java/net/sharksystem/hub/KnownBugsHubConnectionManagerTest.java @@ -28,7 +28,8 @@ public class KnownBugsHubConnectionManagerTest { public void setUp() throws Exception { hubPort = TestHelper.getPortNumber(); ASAPPeerFS asapPeer = new ASAPTestPeerFS(ALICE_ID, Collections.singletonList(FORMAT)); - hubConnectionManager = new HubConnectionManagerImpl(new ASAPEncounterManagerImpl(asapPeer), asapPeer); + hubConnectionManager = new HubConnectionManagerImpl( + new ASAPEncounterManagerImpl(asapPeer, asapPeer.getPeerID()), asapPeer); asapHub = ASAPTCPHub.startTCPHubThread(hubPort, multiChannel, MAX_IDLE_IN_SECONDS); }