[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #12869 [Onionoo]: protocol api separation



#12869: protocol api separation
-------------------------+----------------------
     Reporter:  iwakeh   |      Owner:  iwakeh
         Type:  task     |     Status:  assigned
     Priority:  normal   |  Milestone:
    Component:  Onionoo  |    Version:
   Resolution:           |   Keywords:
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+----------------------

Comment (by iwakeh):

 It would be nice to eliminate the util package dependency entirely.
 Ideas for removing it:

 * I just became aware that util.Time is just there for testing.
 Why don't you use Mocking for testing?
 Here is an older reference
 http://www.lshift.net/blog/2009/12/06/testing-times-in-java

 The time testing could use this this (near the end of the page):
 {{{
 @MockClass(realClass = System.class)
 public class MockSystem {
     private Calendar now = null;

     public MockSystem(Calendar now) {
         this.now = now;
     }

     @Mock
     public long currentTimeMillis() {
         return now.getTimeInMillis();
     }
 }
 }}}

 This would free the onionoo runtime from test dependencies.

 * util.Logger is a mixture of formatting and logging.
 In docs only DocumentStore.getStatsString uses the number formatting
 functionality of Logger. This could be changed? E.g. replaced,
 i.e. use String.format("%,d", decimalNumber) directly, and
 by moving something like the byte formatting elsewere inside docs?

 And, a general question, why doesn't onionoo use a logging framework?

 ---
 Here is the ant task based on docs being independent of util:
 {{{
   <target name="protocol-api-jar" depends="test">
     <jar destfile="protocol-api.jar"
          basedir="${classes}"
          includes="**/docs/"
          excludes="**/*Test.class"
          duplicate="fail"
          failonerror="true">
       <manifest>
         <attribute name="Built-By" value="onionoo project"/>
         <!-- maybe other attributes like the license etc. -->
       </manifest>
     </jar>
   </target>
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12869#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs