Commit graph

194 commits

Author SHA1 Message Date
Chris Beams
879ff57789
Remove obsolete SeedNodeForTesting class 2014-11-10 15:04:41 +01:00
Chris Beams
3398a97311
Rename Node#{id => name}
Refer to the "name" of a node rather than its "id". This is reflected in
the command line options as well. Instead of `--id`, now pass `--name`.
Instead of `--bootstrap.node.id`, now pass `--bootstrap.node.id`.
2014-11-10 14:34:30 +01:00
Manfred Karrer
865fe73bfb Remove random ports and static ID 2014-11-10 13:17:06 +01:00
Chris Beams
2ae5949448
Allow command-line configuration of local node id and port
This change does away with the notion of "clientPort" and replaces it,
simply, with "port". There are only two ports we care about in
Bitsquare:

 1. The port that the local node (i.e. a Bitsquare UI running on
    your laptop) listens on. This value is now specified with `--port`

 2. The port of the bootstrap node that the local node will connect to on
    its first run. This value is specified with `--bootstrap.node.port`

So, for example, the following is a valid commandline invocation:

    java -jar bitsquare.jar --port 1234 --bootstrap.node.port=9876

Both of these values default to Node.DEFAULT_PORT (currently 7366)

This commit also introduces the --id flag for configuring the ID of the
local node.
2014-11-10 13:05:14 +01:00
Chris Beams
cb0e214a28
Polish whitespace 2014-11-10 13:04:55 +01:00
Manfred Karrer
775a391be3 Add ChannelClientConfiguration 2014-11-10 01:51:25 +01:00
Manfred Karrer
501a3ccbc2 Merge remote-tracking branch 'origin/master' 2014-11-10 01:35:17 +01:00
Manfred Karrer
2ec1fe1c59 Sync with Thomas changes, add bootstrap call 2014-11-10 01:35:08 +01:00
Manfred Karrer
c1a645500f Remove caching as it has some side effects for failing tests 2014-11-10 01:10:45 +01:00
Chris Beams
e8986aa7a2
Rename NAME_FLAG => APP_NAME_KEY and move to AppModule 2014-11-10 00:50:59 +01:00
Chris Beams
935785e611
Organize imports 2014-11-10 00:44:48 +01:00
Chris Beams
b5f95e00a3
Supply appName via properties as well
Like all other command-line options and/or configuration file
properties, appName is now parsed for early in #main and its value
(default or custom) is then used to populate the Properties object made
available to all Guice modules. See the previous commit for additional
details.
2014-11-09 23:42:57 +01:00
Chris Beams
162fc3da0e
Favor use of Properties vs. for configuration
This reverts a number of changes made in commit 3033a19. Primary changes
include:

 - Restoring the immutability of the Node class

 - The argparse4j Namespace object is no longer passed down through
   Guice modules

 - Instead, arguments are eagerly read from the Namespace object by the
   #main method and these values are used to populate the Properties
   object that is already supplied to each Guice module

Other changes include:

 - The addition of a BootstrapNodes#DEFAULT_BOOTSTRAP_NODE field as
   a convenient alias to BootstrapNodes#DIGITAL_OCEAN_1 (or whatever the
   future default bootstrap node may be)

 - A Node#getPortAsString method has been added for convenience when
   dealing with String-based properties

 - A variant of the Node#at static factory method has been added which
   accepts the port value as a String vs. an int--again this is for
   convenience when dealing with String-based properties

 - Tests have been added to NodeTests to reflect the above
2014-11-09 23:14:46 +01:00
Chris Beams
017ebb3f38
Polish whitespace
Run "Reformat code" and "Optimize Imports" from within IDEA, cleaning up
trailing whitespace and other issues.
2014-11-09 23:10:58 +01:00
Manfred Karrer
d9372383bf Fix test 2014-11-08 16:38:09 +01:00
Manfred Karrer
3033a19b46 Change default port, Add ip to args, pass namespace to messageModule 2014-11-08 16:28:49 +01:00
Manfred Karrer
d72d7299df Add missing RepeatRule, Simplify SeedNodeForTesting 2014-11-07 18:33:59 +01:00
Manfred Karrer
089be0ca16 Use compatible version with latest TomP2P lib 2014-11-07 00:58:24 +01:00
Chris Beams
5d56dc62c9
Merge branch 'wip-cbeams'
Additional changes during the process of isolating TomP2P. High-level
changes include:

 - Beginning to break up the monolithic MessageFacade into modular
   repository classes, starting with the OfferRepository interface and
   its TomP2P implementation

 - Major refactoring of the CreateOfferCoordinator class, eliminating
   the never-completely-implemented resume logic. This class still needs
   quite a bit of work, but it's now considerably simpler than it was

 - Refactoring the Node and BootstrapNode types for greater clarity and
   ease of use

 - Most classes that use the net.tomp2p API have been moved into tomp2p
   subpackages, e.g. io.bitsquare.offer.tomp2p. Classes within have been
   made package private wherever possible.

 - The Guice module structure has evolved. For example, note the
   relationship between offer.OfferModule and offer.tomp2p.TomP2POfferModule,
   and note how the latter is consumed by app.AppModule. This arrangement
   provides for clear contracts as to what is required to assemble a
   functioning Bitsquare application, while allowing implementation-specific
   modules to be swapped in and out with ease and still allowing
   implementation-specific classes to remain package-private.

See extended commit comments for further details.

* wip-cbeams:
  Rename io.bitsquare.{Abstract=>}BitsquareModule
  Move io.bitsquare.{network=>util}.tomp2p.BaseFutureUtil
  Introduce app.gui.MainModule
  Optimize imports
  Introduce io.bitsquare.msg.tomp2p package
  Introduce io.bitsquare.offer.tomp2p package
  Extract isSuccess(BaseFuture) method into util class
  Remove offer creation recovery from CreateOfferCoordinator
  Remove unused MessageFacade from CreateOfferCoordinator
  Inline BroadCastOfferFeeTx#run into CreateOfferCoordinator
  Inline CreateOfferFeeTx#run into CreateOfferCoordinator
  Replace VerifyOffer class with Offer#validate method
  Inline CreateOfferCoordinator#onFailed
  Rename methods used to implement *Handler lambdas
  Rename *Handler methods
  Move generic *Handler types to new util.task package
  Replace AddOfferListener Result/Fault handlers
  Introduce OfferRepository interface and TomP2P impl
2014-11-06 17:05:01 +01:00
Chris Beams
486cd9824e
Introduce app.gui.MainModule 2014-11-06 16:58:23 +01:00
Chris Beams
21098afd45
Optimize imports 2014-11-06 16:58:22 +01:00
Chris Beams
96fa93f608
Introduce io.bitsquare.msg.tomp2p package 2014-11-06 16:58:20 +01:00
Manfred Karrer
1dde1f361f Use compatible version with latest TomP2P lib 2014-11-06 16:43:09 +01:00
Chris Beams
e201bf88ce
Rename i.b.network.{BootstrapNode=>BootstrapNodes} 2014-11-06 14:00:36 +01:00
Chris Beams
640a736ec3
Repeat TomP2PTests tests using @Repeat vs. loops 2014-11-06 13:17:54 +01:00
Chris Beams
1a92b05bf4
Introduce @Repeat and RepeatRule for repeatable @Test methods
With thanks to original author Frank Appel (@fappel)

See:
 - https://gist.github.com/fappel/8bcb2aea4b39ff9cfb6e
 - http://www.codeaffine.com/2013/04/10/running-junit-tests-repeatedly-without-loops/
2014-11-06 13:17:28 +01:00
Chris Beams
8b6f0ac64e
Refactor TomP2PTests
- Introduce use of Node abstraction for concision
 - Use to BootstrapNode#LOCALHOST and #DIGITAL_OCEAN1 vs. repeating info
 - Make all configuration variables static and final constants
2014-11-06 13:17:28 +01:00
Chris Beams
655100e69f
Introduce Node#at static factory and NodeTests 2014-11-06 11:25:52 +01:00
Chris Beams
da163bcc97
Introduce io.bitsquare.network.Node#DEFAULT_PORT 2014-11-06 11:25:51 +01:00
Manfred Karrer
4fb8030a43 Add loops, add extra SeedNode class, remove LanTest class 2014-11-05 20:41:34 +01:00
Manfred Karrer
bcaa8b9946 Fix random ports 2014-11-05 17:02:26 +01:00
Manfred Karrer
96f8a6c281 Use @Ignore 2014-11-05 16:47:12 +01:00
Manfred Karrer
ef68e08b50 Fix return value 2014-11-05 16:44:59 +01:00
Manfred Karrer
c8a470fb7b Add test with pong reply 2014-11-05 16:20:07 +01:00
Manfred Karrer
25be5bdbe1 Finished tests for localhost case 2014-11-05 15:37:27 +01:00
Manfred Karrer
afe7ec295b Add shutdown method 2014-11-05 15:09:37 +01:00
Manfred Karrer
879c5ca244 Use @Ignore for class, add Put test 2014-11-05 15:06:04 +01:00
Manfred Karrer
5533be6e57 Rename to TomP2PTests, add logs 2014-11-05 14:59:59 +01:00
Manfred Karrer
7fa631dfde Refactor tests (WIP) 2014-11-05 14:45:50 +01:00
Manfred Karrer
28b6e0ad9d WIP 2014-11-05 02:05:42 +01:00
Manfred Karrer
58da80ca2d Add bootstrapping methods 2014-11-05 02:05:42 +01:00
Chris Beams
dc7d861f8e
Rename io.bitsquare.{=>gui}.FatalException
Localize this exception within the gui package for now, as it's the only
place where it's used at the moment.
2014-11-05 01:13:31 +01:00
Chris Beams
55ef0b43d7
Rename io.bitsquare.{di=>app}.BitsquareModule 2014-11-05 01:13:30 +01:00
Chris Beams
11b6a4a341
Remove BitsquareTestSuite
This class is unnecessary; Gradle runs all JUnit test classes by
default, and IDEA and other IDEs automatically detect JUnit test classes
as well.
2014-11-05 01:13:28 +01:00
Chris Beams
fe3985a510
Rename io.bitsquare.{util=>gui}.ViewLoader 2014-11-05 01:13:28 +01:00
Chris Beams
865cf39e64
Remove static access to Bitsquare#getAppName 2014-11-05 01:13:26 +01:00
Chris Beams
6f27c5ce29
Remove static access to BitsquareUI#getPrimaryStage
- Bind BitsquareUI#start's primaryStage for DI
 - Statically inject primaryStage directly into Help and Popups
2014-11-05 01:13:25 +01:00
Chris Beams
6f830d20c9
Introduce ViewLoaderTest and FxmlResource interface
Tests basic loading of FXML resources via the ViewLoader API. Also
introduces the FxmlResource abstraction, an interface which the
Nagivation.Items enum now implements. This simplifies the process of
testing, e.g. in this case testing a non-existent resource without
having to add a bogus value to the enum itself.

Note the @BeforeClass logic necessary to initialize the JavaFX platform.
This is necessary in order to avoid "Toolkit not initialized"
exceptions. See http://stackoverflow.com/q/11385604 for details.
2014-11-05 01:13:21 +01:00
Chris Beams
c71d9a0fb8
Remove UI test runner classes and .fxml files
These classes were used during individual screen creation but are now
effectively dead test code.
2014-11-05 01:13:18 +01:00
Chris Beams
830932d93d
Strip trailing whitespace 2014-11-03 12:33:41 +01:00