mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Merge js5btbFixes
This commit is contained in:
commit
ff899d05e7
2 changed files with 31 additions and 2 deletions
|
@ -93,8 +93,8 @@ public class JingleS5BTransport extends JingleContentTransport {
|
||||||
private String streamId;
|
private String streamId;
|
||||||
private String dstAddr;
|
private String dstAddr;
|
||||||
private Bytestream.Mode mode;
|
private Bytestream.Mode mode;
|
||||||
private ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();
|
private final ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();
|
||||||
private JingleContentTransportInfo info = null;
|
private JingleContentTransportInfo info;
|
||||||
|
|
||||||
public Builder setStreamId(String sid) {
|
public Builder setStreamId(String sid) {
|
||||||
this.streamId = sid;
|
this.streamId = sid;
|
||||||
|
@ -112,11 +112,22 @@ public class JingleS5BTransport extends JingleContentTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder addTransportCandidate(JingleS5BTransportCandidate candidate) {
|
public Builder addTransportCandidate(JingleS5BTransportCandidate candidate) {
|
||||||
|
if (info != null) {
|
||||||
|
throw new IllegalStateException("Builder has already an info set. " +
|
||||||
|
"The transport can only have either an info or transport candidates, not both.");
|
||||||
|
}
|
||||||
this.candidates.add(candidate);
|
this.candidates.add(candidate);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setTransportInfo(JingleContentTransportInfo info) {
|
public Builder setTransportInfo(JingleContentTransportInfo info) {
|
||||||
|
if (!candidates.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Builder has already at least one candidate set. " +
|
||||||
|
"The transport can only have either an info or transport candidates, not both.");
|
||||||
|
}
|
||||||
|
if (this.info != null) {
|
||||||
|
throw new IllegalStateException("Builder has already an info set.");
|
||||||
|
}
|
||||||
this.info = info;
|
this.info = info;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,15 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.transports.jingle_s5b;
|
package org.jivesoftware.smackx.jingle.transports.jingle_s5b;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
import static junit.framework.TestCase.assertNotNull;
|
import static junit.framework.TestCase.assertNotNull;
|
||||||
import static junit.framework.TestCase.assertNull;
|
import static junit.framework.TestCase.assertNull;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
=======
|
||||||
|
import static junit.framework.TestCase.assertNull;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
>>>>>>> js5btbFixes
|
||||||
|
|
||||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||||
import org.jivesoftware.smack.test.util.TestUtils;
|
import org.jivesoftware.smack.test.util.TestUtils;
|
||||||
|
@ -128,7 +134,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
||||||
JingleS5BTransport proxyErrorTransport = new JingleS5BTransportProvider()
|
JingleS5BTransport proxyErrorTransport = new JingleS5BTransportProvider()
|
||||||
.parse(TestUtils.getParser(proxyError));
|
.parse(TestUtils.getParser(proxyError));
|
||||||
assertNull(proxyErrorTransport.getDestinationAddress());
|
assertNull(proxyErrorTransport.getDestinationAddress());
|
||||||
|
<<<<<<< HEAD
|
||||||
assertNotNull(proxyErrorTransport.getInfo());
|
assertNotNull(proxyErrorTransport.getInfo());
|
||||||
|
=======
|
||||||
|
assertNotNull(candidateErrorTransport.getInfo());
|
||||||
|
>>>>>>> js5btbFixes
|
||||||
assertEquals("vj3hs98y", proxyErrorTransport.getStreamId());
|
assertEquals("vj3hs98y", proxyErrorTransport.getStreamId());
|
||||||
assertEquals(JingleS5BTransportInfo.ProxyError(),
|
assertEquals(JingleS5BTransportInfo.ProxyError(),
|
||||||
proxyErrorTransport.getInfo());
|
proxyErrorTransport.getInfo());
|
||||||
|
@ -140,7 +150,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
||||||
"</transport>";
|
"</transport>";
|
||||||
JingleS5BTransport candidateUsedTransport = new JingleS5BTransportProvider()
|
JingleS5BTransport candidateUsedTransport = new JingleS5BTransportProvider()
|
||||||
.parse(TestUtils.getParser(candidateUsed));
|
.parse(TestUtils.getParser(candidateUsed));
|
||||||
|
<<<<<<< HEAD
|
||||||
assertNotNull(candidateUsedTransport.getInfo());
|
assertNotNull(candidateUsedTransport.getInfo());
|
||||||
|
=======
|
||||||
|
assertNotNull(candidateErrorTransport.getInfo());
|
||||||
|
>>>>>>> js5btbFixes
|
||||||
assertEquals(JingleS5BTransportInfo.CandidateUsed("hr65dqyd"),
|
assertEquals(JingleS5BTransportInfo.CandidateUsed("hr65dqyd"),
|
||||||
candidateUsedTransport.getInfo());
|
candidateUsedTransport.getInfo());
|
||||||
assertEquals("hr65dqyd",
|
assertEquals("hr65dqyd",
|
||||||
|
@ -154,7 +168,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
||||||
"</transport>";
|
"</transport>";
|
||||||
JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()
|
JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()
|
||||||
.parse(TestUtils.getParser(candidateActivated));
|
.parse(TestUtils.getParser(candidateActivated));
|
||||||
|
<<<<<<< HEAD
|
||||||
assertNotNull(candidateActivatedTransport.getInfo());
|
assertNotNull(candidateActivatedTransport.getInfo());
|
||||||
|
=======
|
||||||
|
assertNotNull(candidateErrorTransport.getInfo());
|
||||||
|
>>>>>>> js5btbFixes
|
||||||
assertEquals(JingleS5BTransportInfo.CandidateActivated("hr65dqyd"),
|
assertEquals(JingleS5BTransportInfo.CandidateActivated("hr65dqyd"),
|
||||||
candidateActivatedTransport.getInfo());
|
candidateActivatedTransport.getInfo());
|
||||||
assertEquals("hr65dqyd",
|
assertEquals("hr65dqyd",
|
||||||
|
|
Loading…
Reference in a new issue