Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Introduced QueryBuilder approach - #14

Merged
twingly-mob merged 4 commits into
twingly:masterfrom
xSAVIKx:queryBuilder
Mar 11, 2016
Merged

twingly-mob merged 4 commits into
twingly:masterfrom
xSAVIKx:queryBuilder

Conversation

@xSAVIKx

@xSAVIKx xSAVIKx commented Mar 9, 2016

Copy link
Copy Markdown
Contributor

refactored Query and Client classes, so that now:
API key, base URL and search path are now related to Client.
Query object is now just holder for search pattern and related parameters (start and end time, document language)
Introduced QueryBuilder that follows Builder pattern and should be used for Query object creation.
refactored all related to changes unit tests
rewritten examples to use new approach
refactored README to compile successfully in IDEA and to follow changes

refactored Query and Client classes, so that now:
API key, base URL and search path are now related to Client.
Query object is now just holder for search pattern and related parameters (start and end time, document language)
Introduced QueryBuilder that follows Builder pattern and should be used for Query object creation.
refactored all related to changes unit tests
rewritten examples to use new approach
refactored README to compile successfully in IDEA and to follow changes
@twingly-mob

Copy link
Copy Markdown
Member

Slightly off-topic question, we are curious on https://github.com/twingly/twingly-search-api-java/pull/14/files#diff-04c6e90faac2675aa89e2176d2eec7d8R56 what does it do? It seems like it builds a jar file, but we can't find the key embedded in it. Where should we find the key?

class QueryBuilderSpockTest extends Specification {
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.DATE_FORMAT);

def "should through QueryException for empty search pattern"() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

through -> throw

@xSAVIKx

xSAVIKx commented Mar 9, 2016

Copy link
Copy Markdown
Contributor Author

Slightly off-topic question, we are curious on https://github.com/twingly/twingly-search-api-java/pull/14/files#diff-04c6e90faac2675aa89e2176d2eec7d8R56 what does it do? It seems like it builds a jar file, but we can't find the key embedded in it. Where should we find the key?

It's just an example how key should be passed to any jvm-based program.
Maybe, it'll be more clear, if the example will be smth like:
java -jar myJar.jar -DTWINGLY_SEARCH_KEY=some_key_value

@twingly-mob

Copy link
Copy Markdown
Member

It's just an example how key should be passed to any jvm-based program.
Maybe, it'll be more clear, if the example will be smth like:
java -jar myJar.jar -DTWINGLY_SEARCH_KEY=some_key_value

Yes, that's clearer.

@xSAVIKx

xSAVIKx commented Mar 10, 2016

Copy link
Copy Markdown
Contributor Author

@twingly-mob I've updated documentation with new example.

new UrlConnectionClient()
then:
notThrown(TwinglySearchException)
System.properties.remove(Constants.TWINGLY_API_KEY_PROPERTY)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WDYT of moving the removal of the property to cleanup:?

@dentarg dentarg mentioned this pull request Mar 10, 2016
@dentarg

dentarg commented Mar 10, 2016

Copy link
Copy Markdown
Contributor

@xSAVIKx great work, we will take a last quick look tomorrow, I think we will be happy :)

twingly-mob added a commit that referenced this pull request Mar 11, 2016
Introduced QueryBuilder approach
@twingly-mob
twingly-mob merged commit 4ccc042 into twingly:master Mar 11, 2016
@xSAVIKx
xSAVIKx deleted the queryBuilder branch May 11, 2017 18:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants