예제 #1
0
  private static Client createClient() {
    Client cl = new Client();
    cl.setName("JUnit Client");
    cl.setWorkspace(workspace);

    cl = jToggl.createClient(cl);
    Assert.assertNotNull(cl);

    return cl;
  }
예제 #2
0
  @Test
  public void updateClient() {
    final String NAME = "ABC";

    client.setName(NAME);
    Client cl = jToggl.updateClient(client);

    Assert.assertNotNull(cl);
    Assert.assertEquals(NAME, cl.getName());
  }
예제 #3
0
  public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub

    ArrayList<Client> clients = new ArrayList<Client>();
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    Client carlos = new Client();
    carlos.setName("Carlos");
    carlos.setSurName("Gil");
    carlos.setDOB(formatter.parse("26/03/1974"));
    clients.add(carlos);

    Client jose = new Client();
    carlos.setName("Jose");
    carlos.setSurName("Huerta");
    carlos.setDOB(formatter.parse("26/03/1970"));
    clients.add(jose);

    Collections.sort(clients);
  }
예제 #4
0
  public static void main(String[] args) {

    Shop shop = new Shop("Fantastiko");
    shop.setName("Fantastiko");
    shop.start();
    Client client1 = new Client("Bai Gosho", shop);
    client1.setName(client1.name);
    Client client2 = new Client("Bai Ivan", shop);
    client2.setName(client2.name);
    Client client3 = new Client("Bai Nasko", shop);
    client3.setName(client3.name);
    client1.start();
    client2.start();
    client3.start();

    Shop shop2 = new Shop("Lidl");
    shop2.setName("Lidl");
    shop2.start();
    Client client4 = new Client("Komshito", shop2);
    client4.setName(client4.name);
    Client client5 = new Client("Jenata na komshito", shop2);
    client5.setName(client5.name);
    Client client6 = new Client("Sina na komshito", shop2);
    client6.setName(client6.name);
    client4.start();
    client5.start();
    client6.start();

    Shop shop3 = new Shop("Baba Qga");
    shop3.setName("Baba Qga");
    shop3.start();
    Client client7 = new Client("Edin ot Sofia", shop);
    client7.setName(client7.name);
    Client client8 = new Client("Edin ot Petrich", shop);
    client8.setName(client8.name);
    Client client9 = new Client("Vliubena dvoika", shop);
    client9.setName(client9.name);
    client7.start();
    client8.start();
    client9.start();

    Thread suplier = new Suplier("DOSTAVKI OOD");
    suplier.setName("DOSTAVKI OOD");
    suplier.start();
  }
  private Client createClient() {
    UserAdmin user = new UserAdmin(1l, 0);

    Client client = new Client();
    client.setTier(new ClientTier(3l));
    client.setContractEnd(LocalDate.now().plusYears(1));
    client.setContractStart(LocalDate.now());
    client.setRegion(new ClientRegion(1l));
    client.setName("Test Client " + RandomStringUtils.randomAlphanumeric(18));
    client.setType(new ClientType(1l));
    client.setContractOwner(user);
    client.setActive(false);
    client.setSalesForceAccount(new SalesForce(RandomStringUtils.randomAlphanumeric(18)));
    clientService.create(client);
    return client;
  }
 public static void serverLoop() {
   try {
     ss = new ServerSocket(RemoteControl.props.getInt("port", 11946));
   } catch (IOException e) {
     log.severe("RemoteControl could not bind to port");
   }
   try {
     while (loop) {
       Client c =
           RemoteControl.isParanoid()
               ? new SecureClient(ss.accept())
               : new NormalClient(ss.accept());
       clients.add(c);
       c.setName(c.getName().replace("Thread", "Client"));
       c.start();
     }
   } catch (IOException e) {
     log.info("RemoteControl could not set up connection to client" + " or was disabled");
   } catch (NullPointerException e) {
     // duhr, ss failed.
   }
 }