Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Commit

Permalink
Clean main class
Browse files Browse the repository at this point in the history
  • Loading branch information
dethi committed Dec 9, 2017
1 parent 1cb4681 commit de4cb89
Showing 1 changed file with 4 additions and 41 deletions.
45 changes: 4 additions & 41 deletions src/main/java/com/epita/guereza/Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.epita.guereza;

import com.epita.domain.*;
import com.epita.domain.Crawler;
import com.epita.domain.Document;
import com.epita.domain.Index;
import com.epita.domain.Indexer;
import com.epita.eventbus.EventBusClient;
import com.epita.eventbus.EventMessage;
import com.epita.eventbus.NettyEventBusClient;
import com.epita.eventbus.NettyServer;
import com.epita.guereza.service.CrawlerService;
Expand All @@ -11,35 +13,14 @@
import com.epita.winter.provider.LazySingleton;
import com.epita.winter.provider.Prototype;
import com.epita.winter.provider.Singleton;
import com.fasterxml.jackson.core.JsonProcessingException;

import java.util.Map;
import java.util.function.Function;

public class Main {
private static final String NETTY_HOST = "localhost";
private static final int NETTY_PORT = 8000;

public static void main(String[] args) {
// final Index index = new Index();
// final Repo repo = new UrlStore();
//
// //repo.store(new String[]{"https://www.bbc.co.uk/food/recipes/saladenicoise_6572"});
//
// boolean server = false;
// boolean client = true;
// if (server) {
// testEventBusClientSubscribe();
// } else {
// testServer();
// }
//
// //testSearch(index, "onions courgettes pepper");

testApp();
}

private static void testApp() {
final Crawler crawler = new CrawlerService();
final Indexer indexer = new IndexerService();

Expand Down Expand Up @@ -69,24 +50,6 @@ private static void testServer() {
ns.run(NETTY_PORT);
}


private static void testEventBusClientSubscribe() {
final NettyEventBusClient nebc = new NettyEventBusClient();
final boolean succeed = nebc.run(NETTY_HOST, NETTY_PORT);

if (succeed) {
final EventBusClient.Subscription s = nebc.subscribe("room", message -> {
System.out.println("sub: " + message.getContent());
});
try {
nebc.publish(new EventMessage("room", "Hi!"));
nebc.publish(new EventMessage("game", "Salut mec"));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
}

private static void testSearch(final Index index, final String query) {
IndexerService indexer = new IndexerService();

Expand Down

0 comments on commit de4cb89

Please sign in to comment.