Coder Social home page Coder Social logo

gooddata-java's People

Contributors

anvuong119 avatar apascenko avatar benky avatar caohhung avatar daniel-rusnak avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar gdgate avatar hung-nguyen-hoang avatar jakub-plichta avatar jeskepetr avatar jimirocks avatar koles avatar kub avatar liry avatar liry17 avatar marek-ciz avatar martiner avatar milankovacik avatar mmatula avatar mmensik avatar mrataj-gd avatar ostumpf avatar peter-plochan avatar pmsgd avatar sadam21 avatar standevgd avatar tantalor93 avatar xmort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gooddata-java's Issues

Fix ModelService

  • make method ModelService.getProjectModelDiff(Project, DiffRequest) protected (it is not usable for user)
  • remove method ModelService.updateProjectModel(Project, ModelDiff) which is wrong - it runs all the MAQLs returned by the diff API (eg. destructive and non-destructive)
  • add method to ModelDiff class should to pick the best UpdateScript
  • add method ModelService.updateProjectModel(Project, UpdateScript)
  • add method ModelService.updateProjectModel(Project, Reader)
  • method ModelService.updateProjectModel() should read error (instead of throw new ModelException("Update project model finished with status ERROR");

Make the SDK easily extensible

Let experienced user to plugin own developed service configured/initialized with the same restTemplate as built-in services.

Improve error logging (at least requestId)

If any execution fails, the error output is not very friendly, e.g.

org.springframework.web.client.RestTemplate handleResponseError
WARNING: POST request for "/gdc/md/XXX/obj" resulted in 400 (Bad Request); invoking error handler

I would prefer to get a requestId or any other error identification.

GoodData client doesn't work with Jackson2 on classpath

Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: No suitable constructor found for type [simple type, class com.gooddata.project.Project]: can not instantiate from JSON object (need to add/enable type information?)
 at [Source: org.apache.http.client.entity.LazyDecompressingInputStream@25da8379; line: 1, column: 2]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class com.gooddata.project.Project]: can not instantiate from JSON object (need to add/enable type information?)
 at [Source: org.apache.http.client.entity.LazyDecompressingInputStream@25da8379; line: 1, column: 2]
    at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:181)
    at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.read(MappingJackson2HttpMessageConverter.java:173)
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:94)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:496)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:222)
    at com.gooddata.project.ProjectService.getProjectByUri(ProjectService.java:114)
    at com.gooddata.project.ProjectService.getProjectById(ProjectService.java:135)

The problem is in RestTemplate constructor which favours Jackson2 over Jackson1:

if (jackson2Present) {
    this.messageConverters.add(new MappingJackson2HttpMessageConverter());
}
else if (jacksonPresent) {
    this.messageConverters.add(new MappingJacksonHttpMessageConverter());
}

GoodData object initialized with http protocol returns error 302

GoodData object initialized with http protocol instead of default https

goodData = new GoodData(hostname, username, password, 80, "http")
project = goodData.getProjectService().getProjectById(projectId)

returns error when accessing project using ProjectService

com.gooddata.http.client.GoodDataAuthException: Unable to login: 302
    at com.gooddata.http.client.LoginSSTRetrievalStrategy.obtainSst(LoginSSTRetrievalStrategy.java:77)
    at com.gooddata.http.client.GoodDataHttpClient.handleResponse(GoodDataHttpClient.java:168)
    at com.gooddata.http.client.GoodDataHttpClient.execute(GoodDataHttpClient.java:290)
    at com.gooddata.http.client.GoodDataHttpClient.execute(GoodDataHttpClient.java:255)
    at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:88)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:91)
    at com.gooddata.HeaderSettingRequestInterceptor.intercept(HeaderSettingRequestInterceptor.java:32)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:81)
    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:67)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:488)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:222)
    at com.gooddata.project.ProjectService.getProjectByUri(ProjectService.java:114)
    at com.gooddata.project.ProjectService.getProjectById(ProjectService.java:135)

Introduce GridElement inheritance

GridElement can be one of

  • metricGroup (a string, can be maximally one time in rows or columns)
  • URI (URI is allowed for backward compatibility)
  • current GridElement (originally called AttributeInGrid)

We probably should introduce some type hierarchy over GridElement.

Also type of Grid.columns should be Collection<GridElement> not Collection<String>

GoodDataAuthException is thrown on invalid login/pass

com.gooddata.http.client.GoodDataAuthException: Unable to login: 403
    at com.gooddata.http.client.LoginSSTRetrievalStrategy.obtainSst(LoginSSTRetrievalStrategy.java:77)
    at com.gooddata.http.client.GoodDataHttpClient.handleResponse(GoodDataHttpClient.java:168)
    at com.gooddata.http.client.GoodDataHttpClient.execute(GoodDataHttpClient.java:290)
    at com.gooddata.http.client.GoodDataHttpClient.execute(GoodDataHttpClient.java:255)
    at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:88)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:91)
    at com.gooddata.HeaderSettingRequestInterceptor.intercept(HeaderSettingRequestInterceptor.java:32)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:81)
    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:67)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:488)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:222)
    at com.gooddata.account.AccountService.getCurrent(AccountService.java:33)

but com.gooddata.GoodDataException should be thrown.

Unit tests failing on Windows OS

Please see below the invalid handling of paths (when running unit tests on Windows)

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@53a9d5
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Tests run: 154, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 1.28 sec <<< FAILURE!
testMergeUrisWithSlash(com.gooddata.UriPrefixerTest) Time elapsed: 0 sec <<< FAILURE!
java.lang.AssertionError:
Expected: is "http://localhost:1/uploads/test"
but: was "http://localhost:1/๐Ÿ˜ฆ%5Cuploads%5Ctest"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
at com.gooddata.UriPrefixerTest.testMergeUrisWithSlash(UriPrefixerTest.java:19)

testMergeUrisWithoutSlash(com.gooddata.UriPrefixerTest) Time elapsed: 0 sec <<< FAILURE!
java.lang.AssertionError:
Expected: is "http://localhost:1/uploads/test"
but: was "http://localhost:1/๐Ÿ˜ฆ%5Cuploads%5Ctest"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
at com.gooddata.UriPrefixerTest.testMergeUrisWithoutSlash(UriPrefixerTest.java:26)

shouldZipDir(com.gooddata.util.ZipUtilsTest) Time elapsed: 0 sec <<< FAILURE!
java.lang.AssertionError:
Expected: is "toZip/a/b/someFile.txt"
but: was "toZip\a\b\someFile.txt"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
at com.gooddata.util.ZipUtilsTest.verifyZipContent(ZipUtilsTest.java:97)
at com.gooddata.util.ZipUtilsTest.shouldZipDir(ZipUtilsTest.java:56)

shouldZipDirWithoutRoot(com.gooddata.util.ZipUtilsTest) Time elapsed: 0 sec <<< FAILURE!
java.lang.AssertionError:
Expected: is "a/b/someFile.txt"
but: was "a\b\someFile.txt"

AttributeInGrid incorrect serialization/deserialization

AttributeInGrid is not properly serialized/deserialized when part of ReportDefinition. Result JSON is missing "attribute" wrapper.

Actual

{
    "uri": "/gdc/md/FoodMartDemo/obj/8362",
    "totals": [],
    "alias": ""
}

Expected:

{
    "attribute": {
        "uri": "/gdc/md/FoodMartDemo/obj/8362",
        "totals": [],
        "alias": ""
    }
}

Improve project metric creation not to add obj/IDs

Right now, you have to add objects identifications to create metric, it would be helpful to add only string identifications or add ability to load object IDs before creating metric.

Example, instead of:
Metric metric = new Metric(
"Count XXX",
"SELECT COUNT([/gdc/md/XXX/obj/XXX]) WHERE " +
"[/gdc/md/XXX/obj/XXX] NOT IN " +
"([/gdc/md/XXX/obj/XXX/elements?id=XXX])", "#,##0");

Metric metric = new Metric(
"Count XXX",
"SELECT COUNT(XXX.YYY) WHERE " +
"XXX.YYY NOT IN " +
"XXX.YYY.ZZZ", "#,##0");
or
String obj = metadataService.getAttributeId("XXX.YYY");
and then
Metric metric = new Metric("Count XXX", "SELECT COUNT(%s)".format(obj), "#,##0");

Add a way to execute http requests on arbitrary resources

Until this library covers entire GoodData API, it would be nice to have a way to execute a normal HTTP request on an arbitrary resource. The library would just execute the request with correct TT (possibly refresing it) and return the result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.