public static void main(String[] args) {
// ---------------- Section: Necessary initializations and
// registrations-----
Config config = Config.getInstance();
PackagingManager.getInstance()
.registerPackager(new StateOnlyPackager());
ResourceManager.getInstance().registerResourceProvider(
new SimpleIntResourceProvider());
ServiceManager.getInstance().registerService(
new IntHarvestersHomeService(1000));// here the target value <----
ServiceManager.getInstance().registerService(
new IntHarvestersForeignService());
try {
P2PManager.getInstance().registerP2PNetwork(
(P2PNetwork) Class.forName(config.getP2p_protocol())
.newInstance());
} catch (Throwable e) {
System.out.println(e.getMessage());
}
P2PManager.getInstance().connect();
ContainerManager.getInstance().setContainer(
SimpleContainer.getInstance());
ContainerManager.getInstance().getContainer().addContainerListener(
new SimpleContainerLogComponent());
ContainerManager.getInstance().getContainer().addContainerListener(SimpleContainer.getInstance().scv);
MessagingManager.getInstance().registerMessagingProvider(
new PidginMessageProvider());
// -----------------End Section-----------------------------------------
// ---------------- Section: Test Cocoon with XML ----------------------
try {
List<Gene> genes = new ArrayList<Gene>();
genes.add(new FieldGene(SimpleIntHarvester.class
.getDeclaredField("danceThreshold"), 5));
genes.add(new FieldGene(SimpleIntHarvester.class
.getDeclaredField("someString"), "menewstring"));
genes.add(new MethodGene(1, 1));
genes.add(new MethodGene(2, 1));
genes.add(new MethodGene(3, 1));
genes.add(new MethodGene(4, 1));
genes.add(new MethodGene(5, 1));
genes.add(new MethodGene(6, 1));
genes.add(new MethodGene(7, 1));
genes.add(new MethodGene(8, 1));
genes.add(new MethodGene(9, 1));
genes.add(new MethodGene(10, 1));
genes.add(new MethodGene(11, 1));
BeeDNA b = new BeeDNA(genes, "SimpleIntHarvester");
String repPath = "src/de/uniol/informatik/vlba/intharvesters/unittest/behavior_repository.xml";
System.out.println("Get a cocoon");
Cocoon cocoon = new Cocoon(SimpleIntHarvester.class);
// cocoon.createBees(b, 10, repPath);
List<Bee> beeslst = cocoon
.instanciateBees(config.getAgent_number(),
"de.uniol.informatik.vlba.prototype.agent.Agent_1270717415470");
SimpleIntHarvester[] bees = (SimpleIntHarvester[]) (beeslst
.toArray(new SimpleIntHarvester[0]));
//-----------------------------Diversify---