Skip to content

Commit 16fccb6

Browse files
author
Lloyd Watkin
committed
Merge branch 'master' of github.com:buddycloud/buddycloud-server-java into local-access
Conflicts: src/main/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/get/items/UserItemsGet.java
2 parents ff9f94b + ed7169f commit 16fccb6

24 files changed

Lines changed: 634 additions & 168 deletions

File tree

pom.xml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,31 +139,49 @@
139139
<build>
140140
<plugins>
141141
<plugin>
142-
<groupId>org.apache.maven.plugins</groupId>
143-
<artifactId>maven-antrun-plugin</artifactId>
144-
<version>1.6</version>
142+
<!-- Extended Maven antrun plugin -->
143+
<!-- https://maven-antrun-extended-plugin.dev.java.net/ -->
144+
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
145+
<artifactId>maven-antrun-extended-plugin</artifactId>
145146
<executions>
146-
<execution>
147-
<id>buddycloud-server-start</id>
148-
<phase>server-start</phase>
149-
<configuration>
150-
<tasks>
151-
<ant antfile="build.xml" target="run" />
152-
</tasks>
153-
</configuration>
154-
<goals>
155-
<goal>run</goal>
156-
</goals>
157-
</execution>
147+
<execution>
148+
<id>test-reports</id>
149+
<phase>test</phase>
150+
<configuration>
151+
<tasks>
152+
<junitreport todir="target/surefire-reports">
153+
<fileset dir="target/surefire-reports">
154+
<include name="**/*.xml"/>
155+
</fileset>
156+
<report format="noframes" todir="target/surefire-reports"/>
157+
</junitreport>
158+
</tasks>
159+
</configuration>
160+
<goals>
161+
<goal>run</goal>
162+
</goals>
163+
</execution>
158164
</executions>
165+
<dependencies>
166+
<dependency>
167+
<groupId>org.apache.ant</groupId>
168+
<artifactId>ant-junit</artifactId>
169+
<version>1.8.0</version>
170+
</dependency>
171+
<dependency>
172+
<groupId>org.apache.ant</groupId>
173+
<artifactId>ant-trax</artifactId>
174+
<version>1.8.0</version>
175+
</dependency>
176+
</dependencies>
159177
</plugin>
160178
<plugin>
161179
<groupId>org.apache.maven.plugins</groupId>
162180
<artifactId>maven-surefire-plugin</artifactId>
163181
<version>2.5</version>
164182
<configuration>
165183
<skipTests>false</skipTests>
166-
<!-- <testFailureIgnore>true</testFailureIgnore> -->
184+
<testFailureIgnore>true</testFailureIgnore>
167185
<forkMode>once</forkMode>
168186
<includes>
169187
<include>**/*Test.java</include>

src/main/java/org/buddycloud/channelserver/channel/ChannelManagerImpl.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ public int countUserAffiliations(JID jid) throws NodeStoreException {
132132
}
133133

134134
@Override
135-
public ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId)
135+
public ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId, boolean isOwnerModerator)
136136
throws NodeStoreException {
137-
return nodeStore.getNodeAffiliations(nodeId);
137+
return nodeStore.getNodeAffiliations(nodeId, isOwnerModerator);
138138
}
139139

140140
@Override
141-
public ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId,
141+
public ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId, boolean isOwnerModerator,
142142
String afterItemId, int maxItemsToReturn) throws NodeStoreException {
143-
return nodeStore.getNodeAffiliations(nodeId, afterItemId,
143+
return nodeStore.getNodeAffiliations(nodeId, isOwnerModerator, afterItemId,
144144
maxItemsToReturn);
145145
}
146146

@@ -150,8 +150,8 @@ public ArrayList<JID> getNodeOwners(String node) throws NodeStoreException {
150150
}
151151

152152
@Override
153-
public int countNodeAffiliations(String nodeId) throws NodeStoreException {
154-
return nodeStore.countNodeAffiliations(nodeId);
153+
public int countNodeAffiliations(String nodeId, boolean isOwnerModerator) throws NodeStoreException {
154+
return nodeStore.countNodeAffiliations(nodeId, isOwnerModerator);
155155
}
156156

157157
@Override
@@ -185,21 +185,23 @@ public int countUserSubscriptions(JID user) throws NodeStoreException {
185185
}
186186

187187
@Override
188-
public ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId)
189-
throws NodeStoreException {
190-
return nodeStore.getNodeSubscriptions(nodeId);
188+
public ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId,
189+
boolean isOwnerModerator) throws NodeStoreException {
190+
return nodeStore.getNodeSubscriptions(nodeId, isOwnerModerator);
191191
}
192192

193193
@Override
194194
public ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId,
195-
JID afterItemId, int maxItemsToReturn) throws NodeStoreException {
196-
return nodeStore.getNodeSubscriptions(nodeId, afterItemId,
197-
maxItemsToReturn);
195+
boolean isOwnerModerator, JID afterItemId, int maxItemsToReturn)
196+
throws NodeStoreException {
197+
return nodeStore.getNodeSubscriptions(nodeId, isOwnerModerator,
198+
afterItemId, maxItemsToReturn);
198199
}
199200

200201
@Override
201-
public int countNodeSubscriptions(String nodeId) throws NodeStoreException {
202-
return nodeStore.countNodeSubscriptions(nodeId);
202+
public int countNodeSubscriptions(String nodeId, boolean isOwnerModerator)
203+
throws NodeStoreException {
204+
return nodeStore.countNodeSubscriptions(nodeId, isOwnerModerator);
203205
}
204206

205207
@Override
@@ -258,7 +260,7 @@ public boolean isCachedNode(String nodeId) throws NodeStoreException {
258260
@Override
259261
public boolean nodeHasSubscriptions(String nodeId)
260262
throws NodeStoreException {
261-
return (nodeStore.countNodeSubscriptions(nodeId) > 0);
263+
return (nodeStore.countNodeSubscriptions(nodeId, false) > 0);
262264
}
263265

264266
public boolean isCachedJID(JID jid) throws NodeStoreException {
@@ -366,7 +368,7 @@ public ResultSet<NodeSubscription> getNodeSubscriptionListeners(
366368
String nodeId) throws NodeStoreException {
367369
return nodeStore.getNodeSubscriptionListeners(nodeId);
368370
}
369-
371+
370372
@Override
371373
public ResultSet<NodeSubscription> getNodeSubscriptionListeners()
372374
throws NodeStoreException {
@@ -431,28 +433,31 @@ public int getFirehoseItemCount(boolean isAdmin) throws NodeStoreException {
431433
@Override
432434
public Affiliations getDefaultNodeAffiliation(String nodeId)
433435
throws NodeStoreException {
434-
String affiliationString = getNodeConfValue(nodeId, Conf.DEFAULT_AFFILIATION);
435-
436-
if(affiliationString != null) {
436+
String affiliationString = getNodeConfValue(nodeId,
437+
Conf.DEFAULT_AFFILIATION);
438+
439+
if (affiliationString != null) {
437440
try {
438441
return Affiliations.valueOf(affiliationString);
439-
}
440-
catch(IllegalArgumentException e) {
441-
logger.error("Invalid default affiliation stored for node " + nodeId + ": " + affiliationString, e);
442+
} catch (IllegalArgumentException e) {
443+
logger.error("Invalid default affiliation stored for node "
444+
+ nodeId + ": " + affiliationString, e);
442445
}
443446
}
444-
447+
445448
return Affiliations.member;
446449
}
447450

448451
@Override
449452
public CloseableIterator<NodeItem> performSearch(JID searcher,
450-
List content, JID author, int page, int rpp) throws NodeStoreException {
453+
List content, JID author, int page, int rpp)
454+
throws NodeStoreException {
451455
return nodeStore.performSearch(searcher, content, author, page, rpp);
452456
}
453457

454458
@Override
455-
public ResultSet<NodeItem> getUserItems(JID userJid) throws NodeStoreException {
459+
public ResultSet<NodeItem> getUserItems(JID userJid)
460+
throws NodeStoreException {
456461
return nodeStore.getUserItems(userJid);
457462
}
458463

@@ -481,5 +486,4 @@ public ResultSet<NodeThread> getNodeThreads(String node, String afterId,
481486
public int countNodeThreads(String node) throws NodeStoreException {
482487
return nodeStore.countNodeThreads(node);
483488
}
484-
485489
}

src/main/java/org/buddycloud/channelserver/db/NodeStore.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ ResultSet<NodeAffiliation> getAffiliationChanges(JID user, Date startDate, Date
219219
* the node id
220220
* @return
221221
*/
222-
ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId)
222+
ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId, boolean isOwnerModerator)
223223
throws NodeStoreException;
224224

225225
/**
@@ -229,8 +229,8 @@ ResultSet<NodeAffiliation> getNodeAffiliations(String nodeId)
229229
* @param afterItemId
230230
* @return
231231
*/
232-
ResultSet<NodeAffiliation> getNodeAffiliations(String node
233-
, String afterItemId, int maxItemsToReturn) throws NodeStoreException;
232+
ResultSet<NodeAffiliation> getNodeAffiliations(String node, boolean isOwnerModerator,
233+
String afterItemId, int maxItemsToReturn) throws NodeStoreException;
234234

235235
/**
236236
* Get a list of node owners
@@ -246,7 +246,7 @@ ResultSet<NodeAffiliation> getNodeAffiliations(String node
246246
* @param nodeId
247247
* @return
248248
*/
249-
int countNodeAffiliations(String nodeId) throws NodeStoreException;
249+
int countNodeAffiliations(String nodeId, boolean isOwnerModerator) throws NodeStoreException;
250250

251251
/**
252252
* Gets the set of nodes to which the user is subscribed.
@@ -289,9 +289,10 @@ ResultSet<NodeSubscription> getSubscriptionChanges(JID user,
289289
*
290290
* @param nodeId
291291
* the node reference.
292+
* @param isOwnerModerator
292293
* @return
293294
*/
294-
ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId)
295+
ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId, boolean isOwnerModerator)
295296
throws NodeStoreException;
296297

297298

@@ -304,7 +305,7 @@ ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId)
304305
* after this JID
305306
* @return
306307
*/
307-
ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId, JID afterItemId,
308+
ResultSet<NodeSubscription> getNodeSubscriptions(String nodeId, boolean isOwnerModerator, JID afterItemId,
308309
int maxItemsToReturn) throws NodeStoreException;
309310

310311
/**
@@ -467,10 +468,11 @@ CloseableIterator<NodeItem> getRecentItems(JID user, Date since,
467468
*
468469
* @param nodeId
469470
* the node id from which to retrieve the item count.
471+
* @param isOwnerModerator
470472
* @return the entries count.
471473
* @throws NodeStoreException
472474
*/
473-
int countNodeSubscriptions(String nodeId) throws NodeStoreException;
475+
int countNodeSubscriptions(String nodeId, boolean isOwnerModerator) throws NodeStoreException;
474476

475477
/**
476478
* Retrieves a single node item by the node item id.

0 commit comments

Comments
 (0)