Skip to content

feat: Strings API v2 #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2020
Merged

Conversation

AlexanderNovak
Copy link
Contributor

TCM-2046 Strings API collection not included in Java SDK

pom.xml Outdated
@@ -30,6 +31,17 @@
<org.jboss.resteasy.version>3.11.0.Final</org.jboss.resteasy.version>
</properties>

<!-- [+] TODO: ALX Revert this -->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to revert this


import java.util.List;

public class StringsCreationPTO

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do I do create+authorize?
you need to add into this class
private StringsAuthorizationPTO authorization;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from public doc.
Note: You cannot authorize a string via API. Once you have created the strings, they will need to be authorized by a content owner in the Smartling Dashboard.
so did this by intend

Copy link
Contributor

@foo4u foo4u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the Alex to remove block in the POM. I also mentioned how you can remove boilerplate from DTOs, but not necessary.

pom.xml Outdated
Comment on lines 34 to 44
<!-- [+] TODO: ALX Revert this -->
<repositories>
<repository>
<id>resolve-parent</id>
<url>https://artifactory.smartling.net/artifactory/repo</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<!-- [-] TODO: ALX Revert this -->

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to revert this, right?

Copy link
Contributor Author

@AlexanderNovak AlexanderNovak Aug 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, will do. was fighting with dependencies but it turned into java 11 problem

package com.smartling.api.strings.v2.pto;


public class CreatedStringPTO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@dkBrazz dkBrazz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of artifactory dependency
Other comments are optional


@GET
@Path("/projects/{projectUid}/processes/{processUid}")
AsyncStatusResponsePTO asyncProcess(@PathParam("projectUid") String projectUid, @PathParam("processUid") String processUid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our reference this method is described as "Check string status" which is not consistent with "asyncProcess" method name
https://api-reference.smartling.com/#operation/getAddStringsToProjectRequestStatus

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.... going to rename this to checkStatus, any other suggestions about naming?

pom.xml Outdated
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<!-- [-] TODO: ALX Revert this -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a public open-source project, it mustn't depend on any closed source library

private String modifiedDate;
private ProcessStatisticsPTO processStatistics;

public String getProcessUid()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use Lombok in all other SDKs
I think it is better to do so across the whole project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do lombok style then :)


import static org.junit.Assert.*;

public class StringsApiTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You check only method and path from the request but you never check that the payload is serialized as expected
You also don't check how the response is deserialized

This API implementation is copypasted from the legacy project which is working and well tested
tests will be very helpful when we will switch major versions of Resteasy or Jackson

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well... it actually tests json marshalling (from public doc examples) and it will fail if for instance boolean property in DTO turns into Integer. In this case I just do not check that DTO contains exact payload from json that I provide. In this case examining DTO it turns into test for test

@AlexanderNovak AlexanderNovak merged commit 549b36a into master Aug 11, 2020
@AlexanderNovak AlexanderNovak deleted the TCM-2046-Strings-API-In-Java-SDK branch August 28, 2020 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants