mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +01:00
Fix compile errors in jingle code
Which where introduced by merging20eabca1b3
afterb14aca744f
This commit is contained in:
parent
1d53889874
commit
541c9ecfdd
4 changed files with 26 additions and 25 deletions
|
@ -70,7 +70,7 @@ public abstract class JingleContentTransport implements ExtensionElement {
|
|||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
addExtraAttributes(xml);
|
||||
|
||||
if (candidates.isEmpty() && infos.isEmpty()) {
|
||||
if (candidates.isEmpty() && info == null) {
|
||||
xml.closeEmptyElement();
|
||||
|
||||
} else {
|
||||
|
|
|
@ -39,8 +39,8 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
private final String dstAddr;
|
||||
private final Bytestream.Mode mode;
|
||||
|
||||
protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, List<JingleContentTransportInfo> infos, String streamId, String dstAddr, Bytestream.Mode mode) {
|
||||
super(candidates, infos);
|
||||
protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, JingleContentTransportInfo info, String streamId, String dstAddr, Bytestream.Mode mode) {
|
||||
super(candidates, info);
|
||||
StringUtils.requireNotNullOrEmpty(streamId, "sid MUST be neither null, nor empty.");
|
||||
this.streamId = streamId;
|
||||
this.dstAddr = dstAddr;
|
||||
|
@ -94,7 +94,7 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
private String dstAddr;
|
||||
private Bytestream.Mode mode;
|
||||
private ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();
|
||||
private ArrayList<JingleContentTransportInfo> infos = new ArrayList<>();
|
||||
private JingleContentTransportInfo info;
|
||||
|
||||
public Builder setStreamId(String sid) {
|
||||
this.streamId = sid;
|
||||
|
@ -116,29 +116,29 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder addTransportInfo(JingleContentTransportInfo info) {
|
||||
this.infos.add(info);
|
||||
public Builder setTransportInfo(JingleContentTransportInfo info) {
|
||||
this.info = info;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCandidateUsed(String candidateId) {
|
||||
return addTransportInfo(JingleS5BTransportInfo.CandidateUsed(candidateId));
|
||||
return setTransportInfo(JingleS5BTransportInfo.CandidateUsed(candidateId));
|
||||
}
|
||||
|
||||
public Builder setCandidateActivated(String candidateId) {
|
||||
return addTransportInfo(JingleS5BTransportInfo.CandidateActivated(candidateId));
|
||||
return setTransportInfo(JingleS5BTransportInfo.CandidateActivated(candidateId));
|
||||
}
|
||||
|
||||
public Builder setCandidateError() {
|
||||
return addTransportInfo(JingleS5BTransportInfo.CandidateError());
|
||||
return setTransportInfo(JingleS5BTransportInfo.CandidateError());
|
||||
}
|
||||
|
||||
public Builder setProxyError() {
|
||||
return addTransportInfo(JingleS5BTransportInfo.ProxyError());
|
||||
return setTransportInfo(JingleS5BTransportInfo.ProxyError());
|
||||
}
|
||||
|
||||
public JingleS5BTransport build() {
|
||||
return new JingleS5BTransport(candidates, infos, streamId, dstAddr, mode);
|
||||
return new JingleS5BTransport(candidates, info, streamId, dstAddr, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,23 +83,23 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
break;
|
||||
|
||||
case JingleS5BTransportInfo.CandidateActivated.ELEMENT:
|
||||
builder.addTransportInfo(JingleS5BTransportInfo.CandidateActivated(
|
||||
builder.setTransportInfo(JingleS5BTransportInfo.CandidateActivated(
|
||||
parser.getAttributeValue(null,
|
||||
JingleS5BTransportInfo.CandidateActivated.ATTR_CID)));
|
||||
break;
|
||||
|
||||
case JingleS5BTransportInfo.CandidateUsed.ELEMENT:
|
||||
builder.addTransportInfo(JingleS5BTransportInfo.CandidateUsed(
|
||||
builder.setTransportInfo(JingleS5BTransportInfo.CandidateUsed(
|
||||
parser.getAttributeValue(null,
|
||||
JingleS5BTransportInfo.CandidateUsed.ATTR_CID)));
|
||||
break;
|
||||
|
||||
case JingleS5BTransportInfo.CandidateError.ELEMENT:
|
||||
builder.addTransportInfo(JingleS5BTransportInfo.CandidateError());
|
||||
builder.setTransportInfo(JingleS5BTransportInfo.CandidateError());
|
||||
break;
|
||||
|
||||
case JingleS5BTransportInfo.ProxyError.ELEMENT:
|
||||
builder.addTransportInfo(JingleS5BTransportInfo.ProxyError());
|
||||
builder.setTransportInfo(JingleS5BTransportInfo.ProxyError());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingle.transports.jingle_s5b;
|
|||
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.TestUtils;
|
||||
|
@ -114,10 +115,10 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
JingleS5BTransport candidateErrorTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateError));
|
||||
assertNull(candidateErrorTransport.getDestinationAddress());
|
||||
assertEquals(1, candidateErrorTransport.getInfos().size());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals("vj3hs98y", candidateErrorTransport.getStreamId());
|
||||
assertEquals(JingleS5BTransportInfo.CandidateError(),
|
||||
candidateErrorTransport.getInfos().get(0));
|
||||
candidateErrorTransport.getInfo());
|
||||
assertEquals(candidateError, candidateErrorTransport.toXML().toString());
|
||||
|
||||
String proxyError =
|
||||
|
@ -127,10 +128,10 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
JingleS5BTransport proxyErrorTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(proxyError));
|
||||
assertNull(proxyErrorTransport.getDestinationAddress());
|
||||
assertEquals(1, proxyErrorTransport.getInfos().size());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals("vj3hs98y", proxyErrorTransport.getStreamId());
|
||||
assertEquals(JingleS5BTransportInfo.ProxyError(),
|
||||
proxyErrorTransport.getInfos().get(0));
|
||||
proxyErrorTransport.getInfo());
|
||||
assertEquals(proxyError, proxyErrorTransport.toXML().toString());
|
||||
|
||||
String candidateUsed =
|
||||
|
@ -139,12 +140,12 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
"</transport>";
|
||||
JingleS5BTransport candidateUsedTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateUsed));
|
||||
assertEquals(1, candidateUsedTransport.getInfos().size());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals(JingleS5BTransportInfo.CandidateUsed("hr65dqyd"),
|
||||
candidateUsedTransport.getInfos().get(0));
|
||||
candidateUsedTransport.getInfo());
|
||||
assertEquals("hr65dqyd",
|
||||
((JingleS5BTransportInfo.CandidateUsed)
|
||||
candidateUsedTransport.getInfos().get(0)).getCandidateId());
|
||||
candidateUsedTransport.getInfo()).getCandidateId());
|
||||
assertEquals(candidateUsed, candidateUsedTransport.toXML().toString());
|
||||
|
||||
String candidateActivated =
|
||||
|
@ -153,12 +154,12 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
"</transport>";
|
||||
JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateActivated));
|
||||
assertEquals(1, candidateActivatedTransport.getInfos().size());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals(JingleS5BTransportInfo.CandidateActivated("hr65dqyd"),
|
||||
candidateActivatedTransport.getInfos().get(0));
|
||||
candidateActivatedTransport.getInfo());
|
||||
assertEquals("hr65dqyd",
|
||||
((JingleS5BTransportInfo.CandidateActivated)
|
||||
candidateActivatedTransport.getInfos().get(0)).getCandidateId());
|
||||
candidateActivatedTransport.getInfo()).getCandidateId());
|
||||
assertEquals(candidateActivated, candidateActivatedTransport.toXML().toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue