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;
|
||||||
|
|
|
@ -99,8 +99,7 @@ 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 {
|
||||||
|
@ -108,6 +107,11 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
}
|
}
|
||||||
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() {
|
||||||
|
boolean toReturn = false;
|
||||||
|
try {
|
||||||
ScopeBean scope = new ScopeBean(getASLSession().getScope());
|
ScopeBean scope = new ScopeBean(getASLSession().getScope());
|
||||||
return scope.is(Type.INFRASTRUCTURE);
|
toReturn = scope.is(Type.INFRASTRUCTURE);
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
catch (NullPointerException e) {
|
||||||
|
_log.error("NullPointerException in isInfrastructureScope returning false");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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