Skip to content

Issue2517 application api with numbers #2550

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 9 commits into from
Oct 10, 2017

Conversation

otsakir
Copy link
Contributor

@otsakir otsakir commented Oct 6, 2017

This is about issue #2517 .

The following automated tests have been added/updated:

ApplicationRetrievalTest
ApplicationConverterTest
ApplicationEndpointTest

Also, manual testing has been done on a customized Restcomm-JBoss-AS7-8.2.0.1319 and using both hsql and mysql storage backends.

- Updated Application entity
- Provided integration test
- Some work on ApplicationDao layer

Refers #2517
Also updated application.xml in all places in codebase

Refers #2517
- Added entity, converter and updated related components
- Added unit test for converter

Refers #2517
@otsakir otsakir changed the title Issue2517 application api with numbers summary Issue2517 application api with numbers Oct 6, 2017
@@ -0,0 +1,37 @@
CREATE SCHEMA PUBLIC AUTHORIZATION DBA

Choose a reason for hiding this comment

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

We have been discussing on maintenance cost of hsql scripts needed for tests-suit:
imo we should handle a new test's logic by reusing an existing script and add new rows of our desire.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maria-farooq , i agree in principle. Is this script in place ? There should be one with guarantees that it won't contain any more INSERTS that may affect the results of other tests.

In any case, i consider what you describe a separate issue altogether.

@@ -36,6 +36,9 @@

List<Application> getApplications(Sid accountSid);

// this may optionally return related numbers as part of an Application
List<Application> getApplications(Sid accountSid, boolean includeNumbers);
Copy link
Contributor

Choose a reason for hiding this comment

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

why dont we create a simple getApplicationsWithNumbers, who is goign to call getApplications(sid,false)??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, @jaimecasero .


final SqlSession session = sessions.openSession();
try {
final List<Map<String, Object>> results = session.selectList(namespace + "getApplicationsAndNumbers", accountSid.toString());
Copy link
Contributor

@jaimecasero jaimecasero Oct 6, 2017

Choose a reason for hiding this comment

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

again, the method with boolean flag, and the sql query involved doesnt make much sense. basically "includeNumber==false" is like calling getApplications

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, agreed.

Application app = null;
for (final Map<String, Object> result : results) {
app = toApplication(result);
if (previousApp != null && previousApp.getSid().equals(app.getSid()) )
Copy link
Contributor

Choose a reason for hiding this comment

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

is this based on query results being order by appId, i didnt see any orderBy clause when the query was specified?

Assert.assertEquals(5, apps.size());
Assert.assertNotNull(searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers());
// applications bound with many numbers are property returned
Assert.assertEquals("Three (3) numbers should be bound to this application", searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers().size(), 3);
Copy link
Contributor

@jaimecasero jaimecasero Oct 6, 2017

Choose a reason for hiding this comment

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

i think expectedValue is second argument. If "3" is placed in proper place, there is not much requirement on putting custom message for this assertion, since the default one will be self explanatory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct. fixed it.

… date_created.

Also simplified getApplications() interface.

Refers #2517, PR #2550
@jaimecasero
Copy link
Contributor

@otsakir otsakir merged commit 0e9a142 into master Oct 10, 2017
@otsakir otsakir deleted the issue2517_application_api_with_Numbers_summary branch October 10, 2017 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants