Package com.moesol.geoserver.sync.json

Examples of com.moesol.geoserver.sync.json.Sha1SyncPositionHash


          +    "</ogc:PropertyIsEqualTo> "
          +   "</ogc:Filter> "
          "</wfs:Query> "
          + "</wfs:GetFeature>";
        Sha1SyncJson client = new Sha1SyncJson().level(1).hashes(
        new Sha1SyncPositionHash().position("64").summary("70e1fd1423bedd80c917c55e858b88261396a1d9"),
        new Sha1SyncPositionHash().position("ff").summary("2e0d1f5425c8eb74040c899f64fb331ca6ea6559")
        );
        String clientJson = new Gson().toJson(client);
        String xml = String.format(tmpl, clientJson);

        String result = postAsServletResponse( "wfs", xml ).getOutputStreamContent();
View Full Code Here


  protected void localMissingPosition(String position, Sha1SyncPositionHash remote) {
    // Tell remote side this branch is empty unless remote thinks its empty too.
    if (remote.summary() == null) {
      return; // skip, remote thinks its empty
    }
    m_result.add(new Sha1SyncPositionHash().position(position));
  }
View Full Code Here

    m_json.h = new ArrayList<Sha1SyncPositionHash>();
  }

  @Override
  protected void groupCompleted(GroupPosition prefix, Sha1Value sha1Value) {
    Sha1SyncPositionHash hash = new Sha1SyncPositionHash();
    hash.p = prefix.toString();
    hash.s = sha1Value.toString();
    m_json.h.add(hash);
  }
View Full Code Here

  public void testSha1Match() throws ParseException, NoSuchAlgorithmException {
    Sha1Value featureSha1 = new Sha1Value(EXPECTED_SHA1);
    MessageDigest SHA1 = MessageDigest.getInstance("SHA-1");
    Sha1Value sha1OfSha1 = new Sha1Value(SHA1.digest(featureSha1.get()));
    List<Sha1SyncPositionHash> hashes = new ArrayList<Sha1SyncPositionHash>();
    hashes.add(new Sha1SyncPositionHash().position("").summary(sha1OfSha1.toString()));
    Sha1SyncJson sync = new Sha1SyncJson().level(0).max(1).hashes(hashes);
   
    List<Expression> args = new ArrayList<Expression>();
    args.add(ff.literal("-all"));
    args.add(ff.literal(new Gson().toJson(sync)));
View Full Code Here

  public void testSha1Match_InSameGroupButNotSame() throws ParseException, NoSuchAlgorithmException {
    Sha1Value featureSha1 = new Sha1Value("F6e82e2d2452830bbdb9bc1ce353a2e159996308");
    MessageDigest SHA1 = MessageDigest.getInstance("SHA-1");
    Sha1Value sha1OfSha1 = new Sha1Value(SHA1.digest(featureSha1.get()));
    List<Sha1SyncPositionHash> hashes = new ArrayList<Sha1SyncPositionHash>();
    hashes.add(new Sha1SyncPositionHash().position("").summary(sha1OfSha1.toString()));
    Sha1SyncJson sync = new Sha1SyncJson().level(0).max(1).hashes(hashes);
   
    List<Expression> args = new ArrayList<Expression>();
    args.add(ff.literal("-all"));
    args.add(ff.literal(new Gson().toJson(sync)));
View Full Code Here

  public void testSha1MatchShallow() throws ParseException, NoSuchAlgorithmException {
    Sha1Value featureSha1 = new Sha1Value("56e82e2d2452830bbdb9bc1ce353a2e159996308");
    MessageDigest SHA1 = MessageDigest.getInstance("SHA-1");
    Sha1Value sha1OfSha1 = new Sha1Value(SHA1.digest(featureSha1.get()));
    List<Sha1SyncPositionHash> hashes = new ArrayList<Sha1SyncPositionHash>();
    hashes.add(new Sha1SyncPositionHash().position("").summary(sha1OfSha1.toString()));
    Sha1SyncJson sync = new Sha1SyncJson().level(0).max(2).hashes(hashes);
   
    List<Expression> args = new ArrayList<Expression>();
    args.add(ff.literal("-all"));
    args.add(ff.literal(new Gson().toJson(sync)));
View Full Code Here

    public void testComput_Level1() throws Exception {
    FeatureCollectionResponse featureCollectionResponse = buildSomeFeatures("US");
    m_sha1Sync.setCollection(featureCollectionResponse);

    Sha1SyncJson client = new Sha1SyncJson().level(1).hashes(
        new Sha1SyncPositionHash().position("56").summary("deadbeef"),
        new Sha1SyncPositionHash().position("ed").summary("deadbeef")
    );
    m_sha1Sync.parseSha1SyncJson(client.toString());
   
    Sha1SyncJson sync = m_sha1Sync.compute();
   
View Full Code Here

    public void testComput_Level1_Partial() throws Exception {
    FeatureCollectionResponse featureCollectionResponse = buildSomeFeatures("US");
    m_sha1Sync.setCollection(featureCollectionResponse);
   
    Sha1SyncJson client = new Sha1SyncJson().level(1).hashes(
        new Sha1SyncPositionHash().position("ed").summary("deadbeef")
    );
    m_sha1Sync.parseSha1SyncJson(client.toString());
   
    Sha1SyncJson sync = m_sha1Sync.compute();
   
View Full Code Here

  @Test
    public void testComput_Level1_Partial_Extra() throws Exception {
    FeatureCollectionResponse featureCollectionResponse = buildSomeFeatures("US");
    m_sha1Sync.setCollection(featureCollectionResponse);
    Sha1SyncJson client = new Sha1SyncJson().level(1).hashes(
        new Sha1SyncPositionHash().position("ed").summary("deadbeef"),
        new Sha1SyncPositionHash().position("ff").summary("deadbeef")
    );
    m_sha1Sync.parseSha1SyncJson(client.toString());
   
    Sha1SyncJson sync = m_sha1Sync.compute();
   
View Full Code Here

    FeatureCollectionResponse featureCollectionResponse = buildSomeFeatures("US");

    // An empty client should produce 256 empty hashes
    List<Sha1SyncPositionHash> h = new ArrayList<Sha1SyncPositionHash>();
    for (int i = 0; i < 256; i++) {
      h.add(new Sha1SyncPositionHash().position(String.format("%02x", i)));
     
    }
    m_sha1Sync.setCollection(featureCollectionResponse);
    Sha1SyncJson client = new Sha1SyncJson().level(1).hashes(h);
    m_sha1Sync.parseSha1SyncJson(client.toString());
View Full Code Here

TOP

Related Classes of com.moesol.geoserver.sync.json.Sha1SyncPositionHash

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.