-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
33 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,6 @@ public void setUp() throws Exception { | |
jid = new JID("[email protected]"); | ||
request = readStanzaAsIq("/iq/pubsub/channel/configure/request.stanza"); | ||
|
||
nodeConfigure.setServerDomain("shakespeare.lit"); | ||
|
||
element = new BaseElement("create"); | ||
element.addAttribute("node", "/user/[email protected]/posts"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,8 +46,6 @@ public void setUp() throws Exception { | |
jid = new JID("[email protected]"); | ||
request = readStanzaAsIq("/iq/pubsub/channel/create/request.stanza"); | ||
|
||
nodeCreate.setServerDomain("shakespeare.lit"); | ||
|
||
element = new BaseElement("create"); | ||
element.addAttribute("node", node); | ||
} | ||
|
@@ -106,6 +104,11 @@ public void testRequestingAlreadyExistingNodeReturnsErrorStanza() | |
public void testUnauthenticatedUserCanNotCreateNode() throws Exception { | ||
JID jid = new JID("[email protected]"); | ||
|
||
Configuration.getInstance().remove( | ||
Configuration.CONFIGURATION_LOCAL_DOMAIN_CHECKER); | ||
Configuration.getInstance().putProperty( | ||
Configuration.CONFIGURATION_SERVER_DOMAIN, "shakespeare.lit"); | ||
|
||
nodeCreate.process(element, jid, request, null); | ||
Packet response = queue.poll(100, TimeUnit.MILLISECONDS); | ||
|
||
|
@@ -139,26 +142,24 @@ public void testInvalidlyFormattedNodeReturnsError() throws Exception { | |
} | ||
|
||
@Test | ||
public void testNewNodeMustBeOnADomainSupportedByCurrentServer() | ||
throws Exception { | ||
public void testNodeFromUnknownDomain() throws Exception { | ||
element.addAttribute("node", "/user/capulet@shakespearelit/posts"); | ||
|
||
nodeCreate.setTopicsDomain("topics.shakespeare.lit"); | ||
|
||
Configuration.getInstance().putProperty( | ||
Configuration.CONFIGURATION_LOCAL_DOMAIN_CHECKER, Boolean.FALSE.toString()); | ||
|
||
nodeCreate.process(element, jid, request, null); | ||
Packet response = queue.poll(100, TimeUnit.MILLISECONDS); | ||
|
||
PacketError error = response.getError(); | ||
Assert.assertNotNull(error); | ||
Assert.assertEquals(PacketError.Type.modify, error.getType()); | ||
Assert.assertEquals(PacketError.Condition.not_acceptable, error.getCondition()); | ||
Assert.assertNull(response.getError()); | ||
Assert.assertNotNull(response.getElement().element("pubsub").element("actor")); | ||
/** | ||
* Add this check back in once Tinder supports xmlns on standard | ||
* conditions Assert.assertEquals(JabberPubsub.NS_XMPP_STANZAS, | ||
* error.getApplicationConditionNamespaceURI()); | ||
*/ | ||
} | ||
|
||
@Test | ||
public void testchannelManagerFailureReturnsInternalServerErrorResponse() | ||
throws Exception { | ||
|
@@ -270,4 +271,5 @@ public void testFailingNodeConfigurationReturnsErrorStanza() | |
* error.getApplicationConditionNamespaceURI()); | ||
*/ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,6 @@ public void setUp() throws Exception { | |
|
||
this.queue = new LinkedBlockingQueue<Packet>(); | ||
this.nodeDelete = new NodeDelete(queue, channelManager); | ||
this.nodeDelete.setServerDomain("shakespeare.lit"); | ||
this.element = new BaseElement("delete"); | ||
Configuration.getInstance().putProperty(Configuration.CONFIGURATION_LOCAL_DOMAIN_CHECKER, | ||
Boolean.TRUE.toString()); | ||
|
@@ -139,8 +138,13 @@ public void testNotRegisteredActor() throws Exception { | |
|
||
String node = deleteEl.attributeValue("node"); | ||
Mockito.when(channelManager.nodeExists(node)).thenReturn(true); | ||
nodeDelete.setServerDomain("fake.domain"); | ||
|
||
Configuration.getInstance().remove( | ||
Configuration.CONFIGURATION_LOCAL_DOMAIN_CHECKER); | ||
Configuration.getInstance().putProperty( | ||
Configuration.CONFIGURATION_SERVER_DOMAIN, "shakespeare.lit"); | ||
|
||
JID jid = new JID("[email protected]"); | ||
nodeDelete.process(deleteEl, jid, request, null); | ||
Packet response = queue.poll(); | ||
|
||
|
@@ -214,13 +218,14 @@ public void testNodeFromUnknownDomain() throws Exception { | |
String node = deleteEl.attributeValue("node"); | ||
Mockito.when(channelManager.nodeExists(node)).thenReturn(true); | ||
|
||
Configuration.getInstance().putProperty( | ||
Configuration.CONFIGURATION_LOCAL_DOMAIN_CHECKER, Boolean.FALSE.toString()); | ||
|
||
nodeDelete.process(deleteEl, jid, request, null); | ||
Packet response = queue.poll(); | ||
|
||
PacketError error = response.getError(); | ||
Assert.assertNotNull(error); | ||
Assert.assertEquals(PacketError.Type.modify, error.getType()); | ||
Assert.assertEquals(PacketError.Condition.not_acceptable, error.getCondition()); | ||
Assert.assertNull(response.getError()); | ||
Assert.assertNotNull(response.getElement().element("pubsub").element("actor")); | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,6 @@ public void setUp() throws Exception { | |
jid = new JID("[email protected]/balcony"); | ||
request = readStanzaAsIq("/iq/pubsub/publish/request.stanza"); | ||
|
||
publish.setServerDomain("shakespeare.lit"); | ||
publish.setChannelManager(channelManager); | ||
publish.setEntryValidator(validateEntry); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters