Skip to content
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

[WIP (redo after atomic-tx merge)] Define new CLI output formatting api, check old vs new diffs #5715

Conversation

ghubstan
Copy link
Member

@ghubstan ghubstan commented Sep 21, 2021

The CLI console output formatting code will be replaced with a simpler, easier to maintain output formatting api. This PR defines the api, but does not adjust the CLI to it (that will happen in next PR).

I verified there are no diffs in the old vs new console output, excepting removal of some extra white space. Test cases are included, to verify the new console output == the old console output. These test cases will be removed in the next PR, where deprecated code will be completely removed.

Changes were committed in the following stages.

  • Deprecated CLI output formatting classes being replaced.

  • Defined CLI table column interface and implementations.

  • Added license banners and class level javadoc.

  • Added proto consuming CLI Table builders.

  • Added CLI test dependency 'cowwoc:diff-match-patch'.
    This is never released, and helps flag diffs in changes to CLI output during development.

  • Added old vs new CLI output diff checks
    Include non unit (jupiter) test cases to prove the new CLI output api prints the same text as the deprecated CLI output formatters. These test cases will be modified in the next PR, which will delete the deprecated CLI output formatters.

This is the 5th in a series of PRs starting with #5685.
#5691 should be reviewed & merged before this one.

So we can see all fields (especially address) -- not always shown
by annotation generated toString.
Note that newest Intellij code auto-formatter has improved indentation
of method parameters on separate lines.
As usual, method pkg tests are disabled to reduce gradle apitest case
runtimes.  Method pkg tests are run from bisq.apitest.scenario test cases
to reduce # of time test harness setup/shutdown is run.
The method pkg trade test cases were refactored to cut size.
Refactored some CLI console output formatting code to adjust to new
XMR offer support in API.  (TableFormat's 'formatOfferTable' method
was moved to a new OfferFormat class.)

BSQ offers cannot have a margin-based-price, and trigger-price was
never displayed.  XMR offers can have a margin-based-price and a
trigger-price, so altcoin offer display in the console is not as
simple as before.
Unfortunately, the EditOffer proto triggerPrice field was declared as
a long instead of a string, so the CLI has to look at the offer to know
how to scale the trigger-price (for a fiat or altcoin offer) param sent
to the server in its 'editoffer' request.  That means a preliminary round
trip to the server:  a 'getmyoffer' request.
So far, only a BSQ altcoin offer cannot be mkt price margin based,
and cannot have a trigger price.  An XMR offer can, so the server side
'editoffer' validator must not prevent editing the relevant price
fields.
- Adjusted test cases to CLI console's offer formatting changes.
- Disabled an edit xmr test until current mkt xmr price can be
  requested via API.
Resulting from github website file conflict resolution -- my 1st.
This is never released, and helps flag diffs in changes to CLI
output during development.
Include non unit (jupiter) test cases to prove the new CLI output
api prints the same text as the deprecated CLI output formatters.

These test cases will be modified in the next PR, which will delete
the deprecated CLI output formatters.
@ghubstan ghubstan changed the title Replace CLI output formatters and check old vs new diffs Define new CLI output formatting api, check old vs new diffs Sep 22, 2021
@ghubstan ghubstan marked this pull request as draft October 20, 2021 15:43
@ghubstan ghubstan changed the title Define new CLI output formatting api, check old vs new diffs [WIP (redo after atomic-tx merge)] Define new CLI output formatting api, check old vs new diffs Oct 20, 2021
@ghubstan ghubstan closed this Nov 4, 2021
@ghubstan ghubstan deleted the 5-replace-cli-output-fmts-n-test-diffs branch January 10, 2022 14:15
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.

None yet

2 participants