cdevents / sdk-java

Java SDK for CDEvents
Apache License 2.0
5 stars 6 forks source link

Java SDK for CDE CloudEvents #1

Closed rjalander closed 2 years ago

rjalander commented 2 years ago

This PR includes the initial changes for a library to create CloudEvents with CD Extensions.

A class file(CDEventTypes.java) added to create cd events for all the types mentioned in Enum class (CDEventEnums.java) And corresponding Unit tests to create CDEvents (CDEventTypesTest.java)

Note: This PR is to fix the issue from sig-events - https://github.com/cdfoundation/sig-events/issues/110 The Command line interface to create the cdevents using the library and publish the events will be handled in separate PR.

afrittoli commented 2 years ago

As a side note, I'm working on a PR that adds the CloudEvents binding and schemas for the version of the spec, once that's ready and merged we should align this to that - hopefully the user API for the SDK does not need to change though.

https://github.com/cdevents/spec/pull/35

rjalander commented 2 years ago

@afrittoli Created a separate PR to run the checkstyle using linter, please review the PR https://github.com/cdevents/sdk-java/pull/2 Also added linter configuration in same PR to check the code violations

m-linner-ericsson commented 2 years ago

Ran the unit tests and they passed. @rjalander you didn't intend to add run of unit test in this PR?

afrittoli commented 2 years ago

Heh, it looks like the linter may have to be tuned to your preferred coding style 🙇

afrittoli commented 2 years ago

@afrittoli Created a separate PR to run the checkstyle using linter, please review the PR #2 Also added linter configuration in same PR to check the code violations

Cool - PR merged now. I setup some basic branch protection for the repo as well.

rjalander commented 2 years ago

inter may have to be tuned to your preferred coding st

@m-linner-ericsson I did not add any action for test earlier, but added with the latest commit - https://github.com/cdevents/sdk-java/pull/1/commits/3e6f87933c0012fb0921ce6b6990ddcd87e5f79d

Now, the action is failing while pulling the super-linter:v4.9.1 image

afrittoli commented 2 years ago

Oh, it looks like there's a merge conflict, probably with PR #2

rjalander commented 2 years ago

Oh, it looks like there's a merge conflict, probably with PR #2

yeah, fixing it now

rjalander commented 2 years ago

Thank you all for the quick review and comments. Could someone help with Merging this PR?

afrittoli commented 2 years ago

Thank you all for the quick review and comments. Could someone help with Merging this PR?

Sure @rjalander - I've been waiting for you to resolved the merge conflicts and squash the commits

image

Let me know if you need help with that.

rjalander commented 2 years ago

I think I need some help @afrittoli I could see the below as no conflicts and allowing me to Squash and merge {3525B562-2344-44CD-9496-C3DE87302123} .

afrittoli commented 2 years ago

I tried fixing this but I'm not allowed to push to your fork so I cannot update the PR. There are a few duplicated commits as well, so the easiest is to squash them down all to one.

# From you branch
git rebase -i HEAD~12

# Mark all commits - except for the first one - with s for "squash" instead of pick. Save an exit the interactive rebase.
# It will ask you to edit the commit message. Remove all the existing content. I had it condensed to:

Initial setup of the Java SDK

 - Java sdk library impl
 - Create linter.yml for checkstyle
 - Running unit test action

Once the above is done ^^^ you will only have 1 commit in your branch. Make sure you have the latest main:

# Switch to main and update
git checkout main
git pull

# Switch back to your branch and rebase
git checkout java-sdk-issue-110
git rebase main

# Fix any merge conflict. Basically you can keep the version from your PR

Finally push your branch back to the PR

# I don't know what is the name of the remote that points to your fork
REMOTE_FORK=....
git push $REMOTE_FORK  java-sdk-issue-110 --force

Let me know if this works for you.

rjalander commented 2 years ago

Actually, I get this error after edit and save with the interactive rebase command

git rebase -i HEAD~12 error: cannot 'squash' without a previous commit You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'. Or you can abort the rebase with 'git rebase --abort'.

Not sure If I can do Squash and merge from GitHub UI directly, image

afrittoli commented 2 years ago

Oh, I see - it wouldn't let me do it because I had "rebase and merge" selected. Let me try the squash and merge.