Skip to content

Commit

Permalink
feat: Adapt Mocked SpaceService API in Test context - MEED-7590 - Mee…
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Oct 14, 2024
1 parent 04aedd3 commit 245b294
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ public List<SpaceBean> searchSpaces(String keyword) throws WikiException {
// search by keyword
SpaceFilter spaceFilter = new SpaceFilter(keyword);
spaceFilter.setRemoteId(currentUser);
spaceFilter.setAppId("Wiki");

SpaceService spaceService = ExoContainerContext.getCurrentContainer()
.getComponentInstanceOfType(SpaceService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider;
import org.exoplatform.social.core.manager.IdentityManager;
import org.exoplatform.social.core.space.SpaceListAccess;
import org.exoplatform.social.core.space.SpaceListAccessType;
import org.exoplatform.social.core.space.spi.SpaceService;
import org.exoplatform.social.core.storage.api.SpaceStorage;
import org.exoplatform.wiki.service.search.SearchResult;
import org.exoplatform.wiki.utils.Utils;

import io.meeds.social.core.search.SpaceSearchConnector;

@RunWith(MockitoJUnitRunner.Silent.class)
public class WikiElasticSearchServiceConnectorTest extends AbstractKernelTest {

Expand All @@ -45,10 +48,13 @@ public class WikiElasticSearchServiceConnectorTest extends AbstractKernelTest {

@Mock
private SpaceService spaceService;

@Mock
private SpaceStorage spaceStorage;

@Mock
private SpaceSearchConnector spaceSearchConnector;

@Mock
private ConfigurationManager configurationManager;

Expand Down Expand Up @@ -129,8 +135,9 @@ protected String getPermissionFilter() {
+ " \"pre_tags\" : [\"<span class='searchMatchExcerpt'>\"],\n" + " \"post_tags\" : [\"</span>\"]\n"
+ " }\n" + " }\n" + " }\n" + "}");
when(spaceService.getMemberSpaces("__system")).thenReturn(new SpaceListAccess(spaceStorage,
spaceSearchConnector,
"__system",
SpaceListAccess.Type.MEMBER));
SpaceListAccessType.MEMBER));
when(spaceStorage.getMemberSpacesCount("__system")).thenReturn(0);
when(identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,"__system")).thenReturn(new org.exoplatform.social.core.identity.model.Identity("1"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,14 @@ public Space createSpace(Space space, String creator, List<Identity> identities)
return null;
}

public void saveSpace(Space space, boolean isNew) throws SpaceException {

}

public void renameSpace(Space space, String newDisplayName) throws SpaceException {
public void createSpace(Space space, boolean isNew) throws SpaceException {

}

public void renameSpace(Space space, String newDisplayName, String remoteId) throws SpaceException {

}

public void deleteSpace(String spaceId) throws SpaceException {

}

public void initApp(Space space) throws SpaceException {

}
Expand All @@ -268,22 +260,6 @@ public void deInitApps(Space space) throws SpaceException {

}

public void addMember(String spaceId, String userId) throws SpaceException {

}

public void removeMember(String spaceId, String userId) throws SpaceException {

}

public List<String> getMembers(Space space) throws SpaceException {
return null;
}

public List<String> getMembers(String spaceId) throws SpaceException {
return null;
}

public void setLeader(Space space, String userId, boolean isLeader) throws SpaceException {

}
Expand All @@ -308,10 +284,6 @@ public boolean isOnlyLeader(String spaceId, String userId) throws SpaceException
return false;
}

public boolean isMember(String spaceId, String userId) throws SpaceException {
return false;
}

public boolean hasAccessPermission(String spaceId, String userId) throws SpaceException {
return false;
}
Expand Down Expand Up @@ -380,10 +352,6 @@ public void removeApplication(String spaceId, String appId, String appName) thro

}

public void updateSpaceAccessed(String remoteId, Space space) throws SpaceException {

}

public List<Space> getLastAccessedSpace(String remoteId, String appId, int offset, int limit) throws SpaceException {
return null;
}
Expand Down

0 comments on commit 245b294

Please sign in to comment.