added test case to avoidsthat you release using a fake development user when session expires
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@93473 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
053564a916
commit
eb48d7dcf7
|
@ -4,6 +4,9 @@
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
<dependent-module archiveName="user-selection-dialog-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/user-selection-dialog/user-selection-dialog">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="news-feed"/>
|
<property name="context-root" value="news-feed"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -60,7 +60,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HasAlignment;
|
import com.google.gwt.user.client.ui.HasAlignment;
|
||||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
|
||||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
|
|
||||||
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
|
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
|
||||||
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
|
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -99,15 +99,19 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
_log.warn("USER IS NULL setting testing user and Running OUTSIDE PORTAL");
|
_log.warn("USER IS NULL setting testing user and Running OUTSIDE PORTAL");
|
||||||
user = "test.user";
|
user = getDevelopmentUser();
|
||||||
// user = "massimiliano.assante";
|
//SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/TestVREFolder2");
|
||||||
// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/TestVREFolder2");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
withinPortal = true;
|
withinPortal = true;
|
||||||
}
|
}
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
}
|
}
|
||||||
|
public String getDevelopmentUser() {
|
||||||
|
String user = "test.user";
|
||||||
|
//user = "massimiliano.assante";
|
||||||
|
return user;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* this is the first method called by the web app
|
* this is the first method called by the web app
|
||||||
*/
|
*/
|
||||||
|
@ -154,9 +158,18 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
* @return <code>true</code> if it is, <code>false</code> otherwise.
|
* @return <code>true</code> if it is, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
private boolean isInfrastructureScope() {
|
private boolean isInfrastructureScope() {
|
||||||
ScopeBean scope = new ScopeBean(getASLSession().getScope());
|
boolean toReturn = false;
|
||||||
return scope.is(Type.INFRASTRUCTURE);
|
try {
|
||||||
|
ScopeBean scope = new ScopeBean(getASLSession().getScope());
|
||||||
|
toReturn = scope.is(Type.INFRASTRUCTURE);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
catch (NullPointerException e) {
|
||||||
|
_log.error("NullPointerException in isInfrastructureScope returning false");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,7 +350,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String key: feedsMap.keySet()) {
|
for (String key: feedsMap.keySet()) {
|
||||||
toMerge.add(feedsMap.get(key));
|
toMerge.add(feedsMap.get(key));
|
||||||
}
|
}
|
||||||
|
@ -366,23 +379,23 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
_log.trace("Reading desc: " + feed.getDescription());
|
_log.trace("Reading desc: " + feed.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (! onlyConnections) {
|
// if (! onlyConnections) {
|
||||||
// //User Own Feeds
|
// //User Own Feeds
|
||||||
// ArrayList<Feed> userFeeds = (ArrayList<Feed>) store.getRecentFeedsByUser(userName, 10);
|
// ArrayList<Feed> userFeeds = (ArrayList<Feed>) store.getRecentFeedsByUser(userName, 10);
|
||||||
// for (Feed feed : userFeeds)
|
// for (Feed feed : userFeeds)
|
||||||
// feedsMap.put(feed.getKey(), feed);
|
// feedsMap.put(feed.getKey(), feed);
|
||||||
// // //Portal Feeds
|
// // //Portal Feeds
|
||||||
// ArrayList<Feed> portalFeeds = (ArrayList<Feed>) store.getAllPortalPrivacyLevelFeeds();
|
// ArrayList<Feed> portalFeeds = (ArrayList<Feed>) store.getAllPortalPrivacyLevelFeeds();
|
||||||
// for (Feed feed : portalFeeds)
|
// for (Feed feed : portalFeeds)
|
||||||
// feedsMap.put(feed.getKey(), feed);
|
// feedsMap.put(feed.getKey(), feed);
|
||||||
// }
|
// }
|
||||||
// //UserFriends Feeds
|
// //UserFriends Feeds
|
||||||
// ArrayList<String> userFriendsIds = (ArrayList<String>)store.getFriends(userName);
|
// ArrayList<String> userFriendsIds = (ArrayList<String>)store.getFriends(userName);
|
||||||
// for (String userid : userFriendsIds) {
|
// for (String userid : userFriendsIds) {
|
||||||
// for (Feed feed : store.getRecentFeedsByUser(userid, 10)) {
|
// for (Feed feed : store.getRecentFeedsByUser(userid, 10)) {
|
||||||
// feedsMap.put(feed.getKey(), feed);
|
// feedsMap.put(feed.getKey(), feed);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
for (String key: feedsMap.keySet()) {
|
for (String key: feedsMap.keySet()) {
|
||||||
toMerge.add(feedsMap.get(key));
|
toMerge.add(feedsMap.get(key));
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,7 @@ a.person-link:hover {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
word-break:break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tweet-separator {
|
.tweet-separator {
|
||||||
|
@ -366,6 +367,7 @@ a.person-link:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tweet-actions {
|
.tweet-actions {
|
||||||
|
width: 500px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial,
|
font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial,
|
||||||
sans-serif;
|
sans-serif;
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
package org.gcube.portlets.user.newsfeed.client;
|
|
||||||
|
|
||||||
import com.google.gwt.junit.client.GWTTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
|
|
||||||
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
|
|
||||||
* surefire during the test phase.
|
|
||||||
*
|
|
||||||
* If you run the tests using the Maven command line, you will have to
|
|
||||||
* navigate with your browser to a specific url given by Maven.
|
|
||||||
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
|
|
||||||
* for details.
|
|
||||||
*/
|
|
||||||
public class GwtTestNewsFeed extends GWTTestCase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Must refer to a valid module that sources this class.
|
|
||||||
*/
|
|
||||||
public String getModuleName() {
|
|
||||||
return "org.gcube.portlets.user.newsfeed.NewsFeedJUnit";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests the FieldVerifier.
|
|
||||||
*/
|
|
||||||
public void testFieldVerifier() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This test will send a request to the server using the greetServer method in
|
|
||||||
* GreetingService and verify the response.
|
|
||||||
*/
|
|
||||||
public void testGreetingService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.gcube.portlets.user.newsfeed.test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.newsfeed.server.NewsServiceImpl;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TestForDeploy {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserIsTestUser() {
|
||||||
|
NewsServiceImpl serviceImpl = new NewsServiceImpl();
|
||||||
|
String username = serviceImpl.getDevelopmentUser();
|
||||||
|
System.out.println("username for deploy is: " + username);
|
||||||
|
assertTrue(username.compareTo("test.user") == 0);
|
||||||
|
System.out.println("Test OK!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue