Beispiel #1
0
 @Test
 public void testGetRepositories() {
   List<DocumentRepoConfig> documentRepositories =
       Kernel.getDoc().getDocRepoConfigs(callingContext);
   int preexisting = documentRepositories.size();
   if (!Kernel.getDoc().docRepoExists(callingContext, repoUri)) {
     Kernel.getDoc().createDocRepo(callingContext, repoUri, config);
   }
   documentRepositories = Kernel.getDoc().getDocRepoConfigs(callingContext);
   assertEquals(
       JacksonUtil.jsonFromObject(documentRepositories),
       preexisting + 1,
       documentRepositories.size());
 }
Beispiel #2
0
  @Override
  public void addMetadata(CallingContext context, Map<String, String> values, Boolean overwrite) {
    if ((values == null) || values.isEmpty()) return;

    Map<String, String> metadata = context.getMetadata();
    if (metadata == null) metadata = new HashMap<String, String>();
    for (String key : values.keySet()) {
      if (!overwrite && metadata.containsKey(key)) {
        throw RaptureExceptionFactory.create(
            HttpURLConnection.HTTP_BAD_REQUEST, key + " exists and overwrite was disallowed");
      }
      metadata.put(key, values.get(key));
    }
    context.setMetadata(metadata);
    getEphemeralRepo()
        .addToStage(
            RaptureConstants.OFFICIAL_STAGE,
            "session/" + context.getContext(),
            JacksonUtil.jsonFromObject(context),
            false);
  }
 protected void addLatestToMetaStore(String latestKey, DocumentMetadata newMetaData) {
   metaStore.put(latestKey, JacksonUtil.jsonFromObject(newMetaData));
 }