Release 0.4 – Final Update

In the last post, I mentioned I’ll be working again on Marquez project. After writing Unit tests, I was eager to write more test for Marquez. So, I wrote two tests for this release. It was pretty hard initially as the way Marquez handles each of its modules is quite challenging. So, writing tests for different modules was difficult. But, I figured out after looking into the code, digging deep into some tests.

Let’s talk more about the issues I worked on for release 0.4.

I like writing JUnit tests as it is quite interesting. And my job was to bring the coverage closer to 75% which was currently below 25%. Let’s check out the code I wrote for this fix.

 @Test
  public void testMap() throws SQLException {
    final ResultSet results = mock(ResultSet.class);
    when(results.getObject(Columns.ROW_UUID, UUID.class)).thenReturn(ROW_UUID);
    when(results.getTimestamp(Columns.CREATED_AT)).thenReturn(Timestamp.from(CREATED_AT));
    when(results.getObject(Columns.DATASET_UUID, UUID.class)).thenReturn(DATASET_UUID);
    when(results.getObject(Columns.DB_TABLE_INFO_UUID, UUID.class)).thenReturn(DB_TABLE_INFO_UUID);
    when(results.getString(Columns.DB_TABLE_NAME)).thenReturn(DB_TABLE_NAME);

    final StatementContext context = mock(StatementContext.class);

    final DbTableVersionRowMapper dbTableVersionRowMapper = new DbTableVersionRowMapper();
    final DbTableVersionRow dbTableVersionRow = dbTableVersionRowMapper.map(results, context);
    assertEquals(ROW_UUID, dbTableVersionRow.getUuid());
    assertEquals(CREATED_AT, dbTableVersionRow.getCreatedAt());
    assertEquals(DATASET_UUID, dbTableVersionRow.getDatasetUuid());
    assertEquals(DB_TABLE_INFO_UUID, dbTableVersionRow.getDbTableInfoUuid());
    assertEquals(DB_TABLE_NAME, dbTableVersionRow.getDbTable());
  }

So, I had to mock the ResultSet and StatementContext class as you can see it above. Basically, we had to check whether the DbTableVersionRowMapper works as expected. So, we just pass two mock objects and after that check, if the output is what was expected by using assertEquals.

DbTableVersionRowMapper

This is the second issue I’m currently fixing. As this test is to be written in a different package, it is quite difficult because all these modules work differently and their JUnits also needs to be implemented in a different way.

final DbTableVersion dbTableVersion =
        DbTableVersion.builder()
            .connectionUrl(CONNECTION_URL)
            .dbSchemaName(DB_SCHEMA_NAME)
            .dbTableName(DB_TABLE_NAME)
            .build();

    final DbTableVersionRow dbTableVersionRow =
        DbTableVersionRowMapper.map(datasetRow, dbTableInfoRow, dbTableVersion);
    assertNotNull(dbTableVersionRow);
    assertNotNull(dbTableVersionRow.getUuid());
    assertEquals(G_UUID, dbTableVersionRow.getDatasetUuid());
    assertEquals(G_UUID, dbTableVersionRow.getDbTableInfoUuid());
    assertEquals(DB_TABLE_NAME.getValue(), dbTableVersionRow.getDbTable());

So, for this JUnit, you need to mock some objects, also build some mock objects. You can see above how I mocked DbTableVersion object. It actually passed all the checks but my forked repository wasn’t updated so I didn’t pull the latest changes. Unfortunately, some of the classes got changed which I was using for this test. So, I had to update my repository and had to make changes again. I’ll be working on this PR until it gets merged.

This release helped me to understand some core functionalities of Marquez and I gained invaluable experience. I’m happy to work on these fixes and hopefully will continue contributing to Marquez project.

Issue 1 Link

Issue 2 Link

Pull Request 1

Pull Request 2

Release 0.4 – Update

After working on an issue which was more than a “good-first-issue”, I gained so much experience in Marquez project. For release 0.4, I was looking for a similar issue but I couldn’t find any interesting issue even after spending hours. The issues I wanted to work on was either assigned to someone else or fixed already. Some issues were way too hard for me to fix it at this moment. So, I decided to take on one similar issue in Marquez project with which am familiar after contributing to it many times. The issue I’ll be working on if I don’t find any other interesting issue will be writing JUnit tests to increase the coverage.

Issue Link

I’ll be posting the final update of release 0.4 next week. Also, you can check out my previous posts as well.

Release 0.3 – Final Update

As I mentioned in my earlier post, that the issue I worked on might be assigned to someone else or it might have fixed already. But, hopefully, my code was approved and was merged in by the project maintainer. So, now let’s talk about what did I actually implemented for the Marquez project.

Adding a test for mapper class

So, the issue was basically to implement a test for a mapper class using the JUnit framework.

So, the idea behind this was to increase the test coverage and get it closer to 75%. I had some previous experience with the JUnit framework, so I started implementing the code. Initially, I had to face many problems but as soon as I got going, it was just a matter of time. I had to test every single entity and return a test data when that particular function was called.


  @Test
  public void testMap() throws SQLException {
    final ResultSet results = mock(ResultSet.class);
    when(results.getObject(Columns.ROW_UUID, UUID.class)).thenReturn(ROW_UUID);
    when(results.getTimestamp(Columns.CREATED_AT)).thenReturn(Timestamp.from(CREATED_AT));
    when(results.getString(Columns.DB_NAME)).thenReturn(DBNAME);
    when(results.getString(Columns.DB_SCHEMA_NAME)).thenReturn(DBSCHEMA);
    final StatementContext context = mock(StatementContext.class);

    final DbTableInfoRowMapper dbTableInfoRowMapper = new DbTableInfoRowMapper();
    final DbTableInfoRow dbTableInfoRow = dbTableInfoRowMapper.map(results, context);
    assertEquals(ROW_UUID, dbTableInfoRow.getUuid());
    assertEquals(CREATED_AT, dbTableInfoRow.getCreatedAt());
    assertEquals(DBNAME, dbTableInfoRow.getDb());
    assertEquals(DBSCHEMA, dbTableInfoRow.getDbSchema());
  } 

This is a part of the code that I wrote for that test class. And it basically mocks the function calls that are defined in the mapper class. And then, we do a check with assertEquals to know the data returned is valid and true. Also, I had written two more tests to check Null exception is thrown properly.


My pull request got merged and as you can see the report from CodeCov, the coverage for DbTableInfoRowMapper has increased by 87.5%.

Additional Useful Info:(if you are planning to contribute)

  • I had formatting issues after making all the changes and the build was failing. You can easily fix it with the command
$ ./gradlew spotlessApply
  • Also, my tests were failing and I didn’t know what command to use to trigger all the test locally. If you are curious here is the command. And I found the command from the CircleCI that Marquez has set up. I didn’t know what CircleCI was before I took the OSD course. But our professor did make all of us familiar with these technologies which really helped me in this PR.
./gradlew --no-daemon --stacktrace test

Overall, this release gave me a good experience as I got deep into the Marquez project and slowly I’ve started gaining some valuable experience which will be very useful in my future contributions to this project.

Issue Link

PR Link

Release 0.3 – Update

For, release 0.3, I picked two issues, one from Marquez project and another one from Sloth android project. I was very excited to work on these two issues, but unfortunately, the issue from Marquez project was assigned to someone else and the Sloth project code maintainer didn’t reply to me yet with any information.

So, I had to pick another issue from marquez project, but either they were assigned to someone else or they were too hard for me to fix it. Then, I found an issue where I had to write a test for one of the mapper class. I found that really interesting as I had to use Junit. I’ve written JUnit tests before during my CIBC’s co-op work term and I was quite familiar with that. So, I’ve started working on it and I am pretty much done implementing it. Though, I still need a confirmation from the code maintainers that the issue isn’t assigned to someone else or it’s already fixed. Otherwise, my whole effort will go in vain.

Issue link

Lab 8 – Release 0.3

Hey there! Now, I have got experience to fix small bugs for open source projects. I’ll now push my limits and will work on issues that make me think out of the box and I’ll implement something more than code cleanups or good first issue where I fixed typos or did small code changes.

Sloth Android App

I wanted to work on an android open source project because that is something that I am interested in. Here is the issue link which I think I’ll be working on for next releases

Issue link

Marquez Project

I love java programming, so I’ll like to contribute to this project more and I did contribute to marquez project before.

Issue link

Also, I would like to contribute for React Native and Spring framework if I find issues which I will be able to implement.

STAY TUNED!!!!!

Release 0.2 – Summary

For the entire month of February, we were assigned to fix multiple bugs and had to write blogs every week. Here are the links to all my PR’s and the blogs I’ve created.

Pull Requests

Blog Posts

Overall, it was a great learning experience to work on different projects and fixing different bugs. I worked on an Android app, Javascript project and a Java project. All three projects made me think out of the box while I was going through all of the code. Also, finding bugs that you want to work on made me go through a number of projects and I learned about new technologies these projects were using.

Working on these projects was easy, but setting up the environment for each project was really hard. Also, finding an issue you want to work on was really hard.

Overall, it was a great learning experience and I learned a lot of new stuff while working on those bugs. I’ll be fixing more bugs in Release 0.3 and Release 0.4.

Stay Tuned!!!

Release 0.2 – March 6 Update

Hey there! This week, I fixed on a couple of issues and tried to work on more bugs. The bug I fixed was in the Marquez project where I had to rename some functions.

I made the changes and then ran the tests to ensure I didn’t break anything. Then I raised the pull request and it got merged.

Issue Link

Pull Request Link

As this was a small and easy change, I worked on another issue in the same project where I had to remove the @Bind property in some files. I learned a lot from this as I didn’t know what that code means. Still, I tried my best and with the help of code maintainer, I got my pull request merged and learned a lot of new stuff.

Pull Request Link

Issue Link

Brewery Finder

This is a react-typed project to find breweries. The issue was to handle the empty search input while searching for a brewery. Steps for setting up the environment.

  • Forked the Repository
  • Run npm install to download all the dependencies
  • Run npm test to ensure you have an error-free working copy
  • Run npm start to start your development server

I made all the required changes and submitted the pull request.

Issue Link

Pull Request Link

Release 0.2 – March 1 Update

After fixing the bug for Marquez project, I was excited to fix more bugs for the same project as it is something that interests me. And I was learning so much while fixing those bugs. But I was unable to get the pull request submitted until the end of the day.

Issues to be fixed

I am currently looking into this issue and also working on a couple more issues.

I’ll be making two more Pull request next week and both in different projects.

Stay tuned!!!!

Release 0.2 – Feb 22 Update

After fixing the bug for Sloth open source project, I had a hard time to find a bug which I was interested in fixing. But, at last, I found Marquez project which had really interesting bugs to fix.

Marquez

It is an open source metadata service for the collection, aggregation and visualization of the data ecosystem’s metadata.

Bug to be fixed

I asked for permission, and they were happy to assign it to me. I had to remove the @JsonProperty from the api models. Basically, I had to clean up some files. So, I made the changes and submitted the pull request.

But, the circleCI build failed and their member was happy to help me fixing that and I found that I just had to run the below command to fix it.

$ ./gradlew spotlessApply

I learned so much fixing this bug and will work on the same project for my next bug fix. Until then stay tuned!!!

Pull Request Link

Issue Link

Release 0.2 – Feb 15 Update

After contributing to my first open source project FilerJS, it was time to start contributing to more open source projects. This week, I worked on Sloth android application which is managed by Kolten Sturgill.

Sloth is an Android note-taking app developed by Mobi Social Coding Team. I had to redirect the user to a new settings page when clicked. At first, the issue seemed pretty easy but, setting up the environment took me more than three hours. And then understanding the code was also a bit difficult. I asked for permission to work on it.

Setting up the Environment

  1. I forked the repository.
  2. I cloned the repo and opened it in Android Studio.
  3. I faced version problems, so had to tweak the build.gradle file.
  4. Then I built the project on my physical device, to check there were no errors.

Code Changes

Now, it was time to make code changes. I modified the MainActivity.java file to redirect the user to the new settings page. I had to add two lines in the if statement.

After modifying MainActivity.java, I had to add a new SettingsActivity.java and activity_settings.xml to the project.

After making all the changes, I then re-tested the application to make sure it wasn’t breaking. And then, I pushed my change to a new branch referencing the issue. My changes got merged with the master branch luckily.

Pull Request Link

Issue Link

Stay tuned!!!!