@Override protected void setUp() throws Exception { super.setUp(LimeTestUtils.createInjector(Stage.PRODUCTION)); // get the resource file for com/limegroup/gnutella File file = TestUtils.getResourceFile("com/limegroup/gnutella/metadata/ID3V24.mp3"); assertNotNull(gnutellaFileCollection.add(file).get(1, TimeUnit.SECONDS)); }
@Override public void setUp() throws Exception { Expand.expandFile( TestUtils.getResourceFile("com/limegroup/gnutella/xml/xml.war"), CommonUtils.getUserSettingsDir()); Injector injector = LimeTestUtils.createInjector(); limeXMLSchemaRepository = injector.getInstance(LimeXMLSchemaRepository.class); }
@Override public void setUp() throws Exception { networkManagerStub = new NetworkManagerStub(); Injector injector = LimeTestUtils.createInjector( Stage.PRODUCTION, MyCallback.class, new LimeTestUtils.NetworkManagerStubModule(networkManagerStub)); super.setUp(injector); fileManager = injector.getInstance(FileManager.class); messagesSupportedVendorMessage = injector.getInstance(MessagesSupportedVendorMessage.class); searchServices = injector.getInstance(SearchServices.class); responseFactory = injector.getInstance(ResponseFactory.class); queryReplyFactory = injector.getInstance(QueryReplyFactory.class); replyNumberVendorMessageFactory = injector.getInstance(ReplyNumberVendorMessageFactory.class); queryRequestFactory = injector.getInstance(QueryRequestFactory.class); downloadServices = injector.getInstance(DownloadServices.class); messageRouter = injector.getInstance(MessageRouter.class); messageFactory = injector.getInstance(MessageFactory.class); pingReplyFactory = injector.getInstance(PingReplyFactory.class); onDemandUnicaster = injector.getInstance(OnDemandUnicaster.class); callback = (MyCallback) injector.getInstance(ActivityCallback.class); macManager = injector.getInstance(MACCalculatorRepositoryManager.class); remoteFileDescFactory = injector.getInstance(RemoteFileDescFactory.class); pushEndpointFactory = injector.getInstance(PushEndpointFactory.class); networkManagerStub.setAcceptedIncomingConnection(true); networkManagerStub.setCanReceiveSolicited(true); networkManagerStub.setCanReceiveUnsolicited(true); networkManagerStub.setOOBCapable(true); networkManagerStub.setPort(SERVER_PORT); File file = TestUtils.getResourceFile("com/limegroup/gnutella/metadata/metadata.mp3"); assertNotNull(fileManager.getGnutellaFileList().add(file).get(1, TimeUnit.SECONDS)); UDP_ACCESS = new DatagramSocket[10]; for (int i = 0; i < UDP_ACCESS.length; i++) UDP_ACCESS[i] = new DatagramSocket(); for (int i = 0; i < testUP.length; i++) { assertTrue("should be open", testUP[i].isOpen()); assertTrue( "should be up -> leaf", testUP[i].getConnectionCapabilities().isSupernodeClientConnection()); BlockingConnectionUtils.drain(testUP[i], 100); // OOB client side needs server side leaf guidance testUP[i].send(messagesSupportedVendorMessage); testUP[i].flush(); } Thread.sleep(250); // we should now be guess capable and tcp incoming capable.... // test on acceptor since network manager is stubbed out // assertTrue(injector.getInstance(Acceptor.class).acceptedIncoming()); }