Package com.moesol.geoserver.sync.json

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


  }
 
  private Sha1SyncJson computeNextLevel() {
      Sha1JsonLevelGrouper grouper = new Sha1JsonLevelGrouper(versionFeatures, m_featureSha1s);
      grouper.groupForLevel(m_server.level());
      Sha1SyncJson localSha1SyncJson = grouper.getJson();
     
      Sha1SyncJson outputSha1SyncJson = new Sha1SyncJson().level(m_server.level());
      // Copy over some of the local properties
      outputSha1SyncJson.max(localSha1SyncJson.max());
      outputSha1SyncJson.version(localSha1SyncJson.version());
     
      ClientReconciler recon = new ClientReconciler(localSha1SyncJson, m_server);
      recon.setDelete(m_deleter);
      recon.computeOutput(outputSha1SyncJson);
      return outputSha1SyncJson;
View Full Code Here


    m_outputFormat = outputFormat;
    m_atts = atts;
    m_json = json;
    if (this.forceVersion != null) {
      Gson gson = new Gson();
      Sha1SyncJson sha1SyncJson = gson.fromJson(json, Sha1SyncJson.class);
      sha1SyncJson.version(this.forceVersion.getToken());
      m_json = gson.toJson(sha1SyncJson);
    }
  }
View Full Code Here

    }
   
  }
 
  public void testMsg() {
    Sha1SyncJson remote = makeJson().level(1);
    try {
      new ReconcilerNotifier(makeJson(), remote, null);
      fail("ex");
    } catch (IllegalArgumentException e) {
      assertEquals("Local level(0) not equal to remote level(1)", e.getMessage());
View Full Code Here

//        assertEquals("Duplicate prefix()", e.getMessage());
//      }
//  }
 
  public void testFilterDownNextLevel_Level1() {
    Sha1SyncJson local = new Sha1SyncJson().level(0).max(2).hashes(
      new Sha1SyncPositionHash().position("").summary("010101")
    );
    Sha1SyncJson remote = new Sha1SyncJson().level(0).max(2).hashes(
      new Sha1SyncPositionHash().position("").summary("000000")
    );
    Sha1SyncJson output = new Sha1SyncJson().level(2).max(1).hashes(
      new Sha1SyncPositionHash().position("aa").summary("111111"),
      new Sha1SyncPositionHash().position("bb").summary("222222"),
      new Sha1SyncPositionHash().position("cc").summary("333333")
    );
    ServerReconciler r = new ServerReconciler(local, remote);
    r.filterDownNextLevel(output);
    check(output, 0, "aa", "111111");
    check(output, 1, "bb", "222222");
    check(output, 2, "cc", "333333");
    assertEquals(3, output.hashes().size());
  }
View Full Code Here

    check(output, 2, "cc", "333333");
    assertEquals(3, output.hashes().size());
  }
 
  public void testFilterDownNextLevel_Level2() {
    Sha1SyncJson local = new Sha1SyncJson().level(1).max(2).hashes(
      new Sha1SyncPositionHash().position("aa").summary("111111"),
      new Sha1SyncPositionHash().position("bb").summary("222222"),
      new Sha1SyncPositionHash().position("cc").summary("333333")
    );
    Sha1SyncJson remote = new Sha1SyncJson().level(1).max(2).hashes(
      new Sha1SyncPositionHash().position("aa").summary(null),
      new Sha1SyncPositionHash().position("bb").summary("212121"),
      new Sha1SyncPositionHash().position("dd").summary("444444")
    );
    Sha1SyncJson output = new Sha1SyncJson().level(2).max(1).hashes(
      new Sha1SyncPositionHash().position("aaaa").summary("aaaaaa"),
      new Sha1SyncPositionHash().position("aabb").summary("aabbbb"),
      new Sha1SyncPositionHash().position("bbbb").summary("bbbbbb"),
      new Sha1SyncPositionHash().position("ccaa").summary("ccaaaa")
    );
    ServerReconciler r = new ServerReconciler(local, remote);
    r.filterDownNextLevel(output);
    check(output, 0, "aaaa", "aaaaaa");
    check(output, 1, "aabb", "aabbbb");
    check(output, 2, "bbbb", "bbbbbb");
    check(output, 3, "dd", null);
    assertEquals(4, output.hashes().size());
  }
View Full Code Here

import junit.framework.TestCase;

public class VersionFeaturesTest extends TestCase {

  public void testFromSha1SyncJson() {
    Sha1SyncJson json = new Sha1SyncJson();
    json.v = null;
    assertEquals(VersionFeatures.VERSION1, VersionFeatures.fromSha1SyncJson(json));
   
    json.v = "1";
    assertEquals(VersionFeatures.VERSION1, VersionFeatures.fromSha1SyncJson(json));
View Full Code Here

  }

  public void write(FeatureCollectionResponse featureCollection) {
    captureFilterParameters();
    setCollection(featureCollection);
      Sha1SyncJson response = compute();
    LOGGER.log(Level.FINE, "output({0}})", response);
      if (TRACE_RESPONSE != null) {
        response.dumpSha1SyncJson("RESPONSE", TRACE_RESPONSE);
      }
    writeAsJsone(response);
      Sha1SyncFilterFunction.clearThreadLocals()
  }
View Full Code Here

      Sha1SyncFilterFunction.clearThreadLocals()
  }

  private void captureFilterParameters() {
    String atts = Sha1SyncFilterFunction.getFormatOptions();
    Sha1SyncJson sha1SyncJson = Sha1SyncFilterFunction.getSha1SyncJson();
   
    LOGGER.log(Level.FINER, "filter options {0}, filter JSON {1}",
        new Object[] { atts, sha1SyncJson });
    if (atts != null) {
      parseAttributesToInclude(atts);
View Full Code Here

      processAllCollections(resultsList);
     
     
      Sha1JsonLevelGrouper grouper = new Sha1JsonLevelGrouper(versionFeatures, m_featureSha1s);
      grouper.groupForLevel(m_remoteSha1SyncJson.level());
      Sha1SyncJson localSha1SyncJson = grouper.getJson();
     
      grouper.groupForLevel(m_remoteSha1SyncJson.level() + 1);
      Sha1SyncJson outputSha1SyncJson = grouper.getJson();
     
      ServerReconciler recon = new ServerReconciler(localSha1SyncJson, m_remoteSha1SyncJson);
      recon.filterDownNextLevel(outputSha1SyncJson);
     
    LOGGER.log(Level.FINER, "attributes({0}), local({1}), remote({2})",
View Full Code Here

    }
    String atts = args.get(0).toString();
    String json = args.get(1).toString();
   
    m_featureSha1Evaluator.parseAttributesToInclude(atts);
    Sha1SyncJson remoteSha1Sync = new Gson().fromJson(json, Sha1SyncJson.class);
    versionFeatures = VersionFeatures.fromSha1SyncJson(remoteSha1Sync);
    FORMAT_OPTIONS.set(atts);
    REMOTE_SHA1_SYNC.set(remoteSha1Sync);
    FEATURE_SHA1S.set(m_featureSha1s);
    LOGGER.log(Level.FINER, "Recorded: {0}/{1}/{2}",
View Full Code Here

TOP

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

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.