예제 #1
0
 @Test
 public void testProcessingMessagePatrullaInexistente() throws MessageProcessingException {
   String patrulla = "avkclf";
   MessageProcessor mp = new MessageProcessor();
   Inbox entrada = new Inbox();
   entrada.setDatagramaTetra("|30|" + patrulla + "|");
   entrada.setMarcaTemporal(Calendar.getInstance().getTime());
   entrada.setOrigen("08000002");
   entrada.setProcesado(false);
   mp.processingMessage(entrada);
   assertTrue(entrada.isProcesado());
 }
예제 #2
0
 @Test
 public void testProcessingMessagePatrulla() throws MessageProcessingException {
   List<Patrulla> patrullas = PatrullaConsultas.getAll();
   if (patrullas.size() > 0) {
     String patrulla = patrullas.get(0).getNombre();
     MessageProcessor mp = new MessageProcessor();
     Inbox entrada = new Inbox();
     entrada.setDatagramaTetra("|30|" + patrulla + "|");
     entrada.setMarcaTemporal(Calendar.getInstance().getTime());
     entrada.setOrigen("08000002");
     entrada.setProcesado(false);
     mp.processingMessage(entrada);
     assertTrue(entrada.isProcesado());
   }
 }
예제 #3
0
 @Test
 public void testProyeccion() {
   GeometryFactory factory = new GeometryFactory();
   final String sourceSRID = "EPSG:4326";
   final String targetSRID = "EPSG:3395";
   Geometry geom = factory.createPoint(new Coordinate(42.349167d, 3.684722d));
   geom = MessageProcessor.transform(geom, sourceSRID, targetSRID);
   assertEquals(geom.toText(), "POINT (410181.3767547725 5184634.982024495)");
 }
예제 #4
0
  @Test
  public void testProcessingMessagePosicion() throws MessageProcessingException {
    final Double y = new Double(42.349167);
    final Double x = new Double(3.684722);
    MessageProcessor mp = new MessageProcessor();
    Inbox entrada = new Inbox();
    entrada.setDatagramaTetra("|16|" + y + ",N|" + x + ",W|1|");
    entrada.setMarcaTemporal(Calendar.getInstance().getTime());
    entrada.setOrigen("08000002");
    entrada.setProcesado(false);
    mp.processingMessage(entrada);

    final Recurso getbyDispositivo = RecursoConsultas.getbyDispositivo("08000002");
    if (getbyDispositivo != null) {
      HistoricoGPS historico = getbyDispositivo.getHistoricoGps();

      assertEquals(historico.getGeom().getSRID(), 4326);
      assertEquals((Double) (-x), (Double) historico.getPosX());
      assertEquals(y, (Double) historico.getPosY());
    }
    assertTrue(entrada.isProcesado());
  }