fixed the issue #21267, moved to gcube-bom 2.0.1

This commit is contained in:
Francesco Mangiacrapa 2021-05-17 11:08:37 +02:00
parent 03b78681e6
commit 6b528f8eef
8 changed files with 80 additions and 10 deletions

View File

@ -13,6 +13,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>

49
CHANGELOG.md Normal file
View File

@ -0,0 +1,49 @@
# Changelog
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.5.1-SNAPSHOT] - 2020-11-17
#### Fixes
[21267] Fixed the slf4j-log4j12 dependency
Moved to gcube-bom 2.0.1
## [v1.5.0] - 2019-11-26
[Task #16415] Migrate to Firebase Dynamic Links APIs
## [v1.2.0] - 2017-06-14
[Support #8940] src/it/simple-it/pom.xm
## [v1.1.1] - 2016-12-19
removed lo4j dependency from pom
## [v1.1.0] - 2016-09-27
removed jump of scope during read of Runtime HTTP-URL-Shortener
removed constructor with the parameter scope
## [v1.0.2] - 2016-06-30
removed maven portal bom dependency
## [v1.0.1] - 2016-04-26
maven-bom replaced by portal-bom
## [v1.0.0] - 2014-10-13
First Release

13
pom.xml
View File

@ -12,7 +12,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-url-shortener</artifactId>
<version>1.5.0</version>
<version>1.5.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gcube-url-shortener </name>
<description>The Gcube Url Shortener uses the Firebase Dynamic Links Short Links API provided by Google (at https://firebase.google.com/docs/reference/dynamic-links/link-shortener).
@ -51,7 +51,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>1.4.0</version>
<version>2.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -95,10 +95,17 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>
<!-- JSON PARSER -->

View File

@ -191,6 +191,15 @@ public final class UrlShortener {
JSONObject jsonObj = new JSONObject();
//jsonObj.put(LONG_URL, longUrl);
String toLongURL = String.format("%s?link=%s",dynamicLink,longUrl);
/*String toRequestShortURL = longUrl;
if(toRequestShortURL.contains("?")) {
//I need to encode the URL before submit the request to Google DL
toRequestShortURL = URLEncoder.encode(longUrl, "UTF-8");
}
String toLongURL = String.format("%s?link=%s",dynamicLink,toRequestShortURL);*/
jsonObj.put(LONG_DYNAMIC_LINK, toLongURL);
JSONObject jsonObjSuffix = null;

View File

@ -2,12 +2,10 @@ package org.gcube.portlets.user.urlshortener;
import java.util.HashMap;
import org.junit.Test;
public class Encoder {
@Test
//@Test
public void encode() {
// System.out.println(UrlEncoderUtil.encodeQuery("request=GetStyles", "layers=test Name", "service=WMS", "version=1.1.1"));

View File

@ -1,6 +1,5 @@
package org.gcube.portlets.user.urlshortener;
import org.gcube.common.scope.api.ScopeProvider;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -18,7 +17,7 @@ public class Shortener {
protected static Logger logger = LoggerFactory.getLogger(Shortener.class);
protected static int tnt = 0;
@Test
//@Test
public void testShortener(){
Thread th = new Thread(){

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.urlshortener;
import org.gcube.common.scope.api.ScopeProvider;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -17,7 +18,7 @@ public class TestUrlShortener {
protected static Logger logger = LoggerFactory.getLogger(TestUrlShortener.class);
protected static int tnt = 0;
// @Test
@Test
public void testShortener(){
Thread th = new Thread(){
@ -27,7 +28,7 @@ public class TestUrlShortener {
ScopeProvider.instance.set(scope);
UrlShortener urlSh = new UrlShortener();
System.out.println("UrlShortener: "+urlSh);
String shorten = urlSh.shorten("http://data.d4science.org/uri-resolver/UUFYTGtkaEtiK2s0TURzdTBQckpBSDJmbVkrOXAzazVHbWJQNStIS0N6Yz0");
String shorten = urlSh.shorten("https://data.dev.d4science.org/shub/E_YjVxTHljYUQ1WXdqeExVMUJBTG16cHhUTEF0OVBsdWZydzAvNHgwNG9pNkFUVEVNck1uOGd4YmVsUDJiei9DMw==");
//String shorten = urlSh.shorten("https://developers.google.com/url-shortener/v1/getting_started?hl=it "+new Random().nextDouble());
System.out.println("Shorted: "+shorten);
} catch (Exception e) {

6
src/test/resources/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/devNext.gcubekey
/devsec.gcubekey
/gcube.gcubekey
/log4j.properties
/pred4s.gcubekey
/preprod.gcubekey