Package edu.csusm.cs671.auction.sockets.client

Examples of edu.csusm.cs671.auction.sockets.client.MessageEvent


 
  public static void main(String[] args) throws IOException {

    boolean running = true;
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig(args[0]);
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
    int id = agentConfig.getId();
    String cmd;
    Scanner scan = new Scanner(System.in);
    while(running)
    {
      System.out.print("Agent " + id +" Started");
      cmd =  scan.nextLine().toLowerCase();
     
      if (cmd.equals("exit"))
      {
        running = false;
      }else if (cmd.equals("status")){
        System.out.println(auctionAgent);
      }else{
        System.out.println("Type \"exit\" to stop the agent");
        System.out.println("Type \"status\" to agent's status");
      }
    }
   
    auctionAgent.stop();
    //Terminated
    System.out.println("Agent " +id + " Terminated");
    System.out.println("Final Stats");
    System.out.println(auctionAgent);
   
View Full Code Here


 
 
  public static void testAgentBid() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    StartAuctionMessage auctionMessage = new StartAuctionMessage();
   
    Work work = new Work(WorkType.TYPE_A,new Size(10000) );
   
    auctionMessage.setAuctionID(UUID.randomUUID());
    //auctionMessage.setTimeAuctionIsOpen(new Duration(10));
    auctionMessage.setWorkForAuction(work);
   
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

  }
 
  public static void testAgentWon() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    WinnerAuctionMessage auctionMessage = new WinnerAuctionMessage();
   
    Work work = new Work(WorkType.TYPE_A,new Size(10000) );
   
    auctionMessage.setAuctionID(UUID.randomUUID());
    auctionMessage.setWorkForAuction(work);
//    auction Message.setBidAmount(new Currency(100));
    auctionMessage.setAgentID(1);
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

 
  public static void main(String[] args) throws IOException {

    boolean running = true;
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig(args[0]);
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
    int id = agentConfig.getId();
    String cmd;
    Scanner scan = new Scanner(System.in);
    while(running)
    {
      System.out.print("Agent " + id +" Started");
      cmd =  scan.nextLine().toLowerCase();
     
      if (cmd.equals("exit"))
      {
        running = false;
      }else if (cmd.equals("status")){
        System.out.println(auctionAgent);
      }else{
        System.out.println("Type \"exit\" to stop the agent");
        System.out.println("Type \"status\" to agent's status");
      }
    }
   
    auctionAgent.stop();
    //Terminated
    System.out.println("Agent " +id + " Terminated");
    System.out.println("Final Stats");
    System.out.println(auctionAgent);
   
View Full Code Here

 
 
  public static void testAgentBid() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    StartAuctionMessage auctionMessage = new StartAuctionMessage();
   
    Work work = new Work(WorkType.TYPE_A,new Size(10000) );
   
    auctionMessage.setAuctionID(UUID.randomUUID());
    //auctionMessage.setTimeAuctionIsOpen(new Duration(10));
    auctionMessage.setWorkForAuction(work);
   
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

  }
 
  public static void testAgentWon() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    WinnerAuctionMessage auctionMessage = new WinnerAuctionMessage();
   
    Work work = new Work(WorkType.TYPE_A,new Size(10000) );
   
    auctionMessage.setAuctionID(UUID.randomUUID());
    auctionMessage.setWorkForAuction(work);
//    auction Message.setBidAmount(new Currency(100));
    auctionMessage.setAgentID(1);
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

 
  public static void main(String[] args) throws IOException {

    boolean running = true;
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig(args[0]);
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
    int id = agentConfig.getId();
    String cmd;
    Scanner scan = new Scanner(System.in);
    while(running)
    {
      System.out.print("Agent " + id +" Started");
View Full Code Here

  }
 
 
  public static void testAgentBid() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    StartAuctionMessage auctionMessage = new StartAuctionMessage();
   
View Full Code Here

   
  }
 
  public static void testAgentWon() throws FileNotFoundException, IOException{
   
    AgentConfig agentConfig = AgentConfigBuilder.buildAgentConfig("agentConfig_1.properties");
    AuctionAgent auctionAgent = new AuctionAgentImpl(agentConfig);
    auctionAgent.start();
   
    WinnerAuctionMessage auctionMessage = new WinnerAuctionMessage();
   
View Full Code Here

  private static int ratioB=1;
  private static int ratioC=1;
   
  public static void main(String[] args) throws IOException {

    AuctioneerConfig auctioneerConfig = new AuctioneerConfig();
    auctioneerConfig.setPort(PORT);
    auctioneer = new AuctioneerImpl(auctioneerConfig);
    String cmd;
    Scanner scan = new Scanner(System.in);
    Timer timer = null;
    workTimerTask = null;
View Full Code Here

TOP

Related Classes of edu.csusm.cs671.auction.sockets.client.MessageEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.