[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 karsten):

 Replying to [comment:3 iwakeh]:
 > It would be nice to eliminate the util package dependency entirely.

 Agreed, let's try that.

 > 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.

 Sure, happy to talk about using a mocking framework.  But we'll have to
 find one that is shipped with Debian stable.  See development guidelines
 here:
 https://trac.torproject.org/projects/tor/wiki/org/operations/Guidelines

 Do you have any suggestions?  And do you want to create a new ticket for
 that?

 > * 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?

 It doesn't use a logging framework yet, because I didn't look into which
 framework would work well with our two execution modes: started once per
 hour by the system cron and running inside Tomcat.  If you have
 suggestions or want to help with patches, awesome!

 Also, new ticket? :)

 > ---
 > 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">
 >       <manifest>
 >       <attribute name="Built-By" value="onionoo project"/>
 >       <!-- maybe other attributes like the license etc. -->
 >       </manifest>
 >     </jar>
 >   </target>
 > }}}

 Or should we include all packages in that jar, not just the docs package?
 We can still continue working on making docs independent of util, but it
 seems that a more general Ant target might also be useful for future use
 cases we didn't think of yet.  And the jar shouldn't be that much bigger
 than with just docs classes.

 Also, what do you think about including referenced jars?  I don't feel
 strongly here, so whatever works better for you is fine with me.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12869#comment:4>
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