Removed uneeded test class
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@176828 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c7324fe5d3
commit
f6e7654ee3
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
import org.gcube.socialnetworking.socialtoken.SanitizedURL;
|
||||
import org.gcube.socialnetworking.socialtoken.SocialMessageParser;
|
||||
import org.gcube.socialnetworking.socialtoken.URLToken;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -98,4 +99,24 @@ public class MessageParserTest {
|
|||
public void auxTest() throws MalformedURLException {
|
||||
new SanitizedURL(null);
|
||||
}
|
||||
|
||||
protected String findFirstLink(String message) {
|
||||
try {
|
||||
SocialMessageParser messageParser = new SocialMessageParser(message);
|
||||
List<URLToken> urlTokens = messageParser.getURLTokens();
|
||||
return urlTokens.get(0).getExtractedURL().toString();
|
||||
}catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTest() {
|
||||
String text = "Hello (https://doodle.com/poll/not-existing-poll)";
|
||||
logger.debug(findFirstLink(text));
|
||||
|
||||
text = "post \"a text with #hashtag);\"";
|
||||
SocialMessageParser messageParser = new SocialMessageParser(text);
|
||||
logger.debug(messageParser.getParsedMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
package org.gcube.social_networking.socialutillibrary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.socialnetworking.socialtoken.SocialMessageParser;
|
||||
import org.gcube.socialnetworking.socialtoken.URLToken;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class TestUnit {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MessageParserTest.class);
|
||||
|
||||
//@Test
|
||||
public void testHashtag() {
|
||||
String text = "Dear members, The item 'ADSDTest4CWP' has been just published by Leonardo Candela. " +
|
||||
"You can find it here: http://data.d4science.org/ctlg/CWP_Secretariat/adsdtest4cwp " +
|
||||
"#Area #Geospatial #Periodicity-When_updates_are_available ";
|
||||
List<String> hashtags = Utils.getHashTags(text);
|
||||
System.out.println("Hashtags are " + hashtags);
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void extractUrl(){
|
||||
|
||||
String url = " test http://2001:db8:0:1:1:1:1:1:8080/group/preeco/what-if?p_p_id=simul_WAR_simulfishgrowthportlet&p_p_lifecycle=0 ";
|
||||
String result = Utils.extractURL(url);
|
||||
System.out.println("urls are " + result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
String urlString = "http://2001:db8:0:1:1:1:1:1:8080/group/preeco/what-if?p_p_id=simul_WAR_simulfishgrowthportlet&p_p_lifecycle=0";
|
||||
String[] ends = new String[] {".", ",", ";",":",")","]","}",""};
|
||||
for(String s : ends) {
|
||||
URLToken urlToken = new URLToken(urlString+s, "\n", 0, 0);
|
||||
logger.debug(urlToken.getTokenReplacement());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected String findFirstLink(String message) {
|
||||
try {
|
||||
SocialMessageParser messageParser = new SocialMessageParser(message);
|
||||
List<URLToken> urlTokens = messageParser.getURLTokens();
|
||||
return urlTokens.get(0).getExtractedURL().toString();
|
||||
}catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTest() {
|
||||
String text = "Hello (https://doodle.com/poll/not-existing-poll)";
|
||||
logger.debug(findFirstLink(text));
|
||||
|
||||
text = "post \"a text with #hashtag);\"";
|
||||
SocialMessageParser messageParser = new SocialMessageParser(text);
|
||||
logger.debug(messageParser.getParsedMessage());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue