當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicFactories類代碼示例

本文整理匯總了Java中org.waveprotocol.wave.model.testing.BasicFactories的典型用法代碼示例。如果您正苦於以下問題:Java BasicFactories類的具體用法?Java BasicFactories怎麽用?Java BasicFactories使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BasicFactories類屬於org.waveprotocol.wave.model.testing包,在下文中一共展示了BasicFactories類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
  super.setUp();

  FakeWaveView view = BasicFactories.fakeWaveViewBuilder().with(idgen).build();
  Wavelet userDataWavelet = view.createUserData();
  ObservablePrimitiveSupplement primitiveSupplement =
      WaveletBasedSupplement.create(userDataWavelet);
  WaveBasedConversationView conversationView = WaveBasedConversationView.create(view, idgen);
  conversationView.createRoot();
  QuasiConversationViewImpl quasiConversationView = QuasiConversationViewImpl.create(null);
  supplementedWave = new LiveSupplementedWaveImpl(primitiveSupplement, view, viewer,
      DefaultFollow.ALWAYS, quasiConversationView);
  quasiConversationView.initialize(conversationView, supplementedWave);
  monitor = ThreadReadStateMonitorImpl.create(supplementedWave, quasiConversationView);
  rootThread = quasiConversationView.getRoot().getRootThread();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:18,代碼來源:ThreadReadStateMonitorTest.java

示例2: testLoadOnDomainlessWaveletIdsDoesNotFail

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public void testLoadOnDomainlessWaveletIdsDoesNotFail() {
  DocInitialization readOp =
      BasicFactories.observableDocumentProvider().parse(
          "<wavelet i=\"conversation/root\"></wavelet>").toInitialization();
  DocInitialization archiveOp =
      BasicFactories.observableDocumentProvider().parse(
          "<archive i=\"conversation/root\"></archive>").toInitialization();
  DocInitialization seenOp =
      BasicFactories.observableDocumentProvider().parse(
          "<seen i=\"conversation/root\"></seen>").toInitialization();

  FakeWaveView view = BasicFactories.fakeWaveViewBuilder().build();
  Wavelet userData = view.createUserData();

  userData.getDocument(WaveletBasedSupplement.READSTATE_DOCUMENT).hackConsume(
      Nindo.fromDocOp(readOp, false));
  userData.getDocument(WaveletBasedSupplement.ARCHIVING_DOCUMENT).hackConsume(
      Nindo.fromDocOp(archiveOp, false));
  userData.getDocument(WaveletBasedSupplement.SEEN_DOCUMENT).hackConsume(
      Nindo.fromDocOp(seenOp, false));

  WaveletBasedSupplement.create(userData);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:24,代碼來源:WaveletBasedSupplementTest.java

示例3: createFullWrapper

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
/**
 * Creates a full wrapper with image and thumbnail elements populated.
 *
 * @return the new wrapper
 */
private AttachmentDocumentWrapper<Doc.N, Doc.E, Doc.T> createFullWrapper() {
  ObservableDocument document = BasicFactories.observableDocumentProvider()
      .parse(String.format(
          "<node key=\"upload_progress\" value=\"%d\"/>"
          + "<node key=\"creator\" value=\"%s\"/>"
          + "<node key=\"attachment_size\" value=\"%d\"/>"
          + "<node key=\"malware\" value=\"false\"/>"
          + "<node key=\"status\" value=\"%s\"/>"
          + "<node key=\"filename\" value=\"%s\"/>"
          + "<node key=\"mime_type\" value=\"%s\"/>"
          + "<node key=\"image_height\" value=\"%d\"/>"
          + "<node key=\"image_width\" value=\"%d\"/>"
          + "<node key=\"thumbnail_height\" value=\"%d\"/>"
          + "<node key=\"thumbnail_width\" value=\"%d\"/>",
          UPLOAD_PROGRESS, CREATOR, SIZE, UPLOAD_STATUS, FILENAME, MIME_TYPE, IMAGE_HEIGHT,
          IMAGE_WIDTH, THUMB_HEIGHT, THUMB_WIDTH));

  return new AttachmentDocumentWrapper<Doc.N, Doc.E, Doc.T>(document);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:25,代碼來源:AttachmentDocumentWrapperTest.java

示例4: testStringReplace

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public void testStringReplace() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "22 a b 22 c d 22 e f");
  while (true) {
    String contents = api.apiContents();
    int p = contents.indexOf("22");
    if (p < 0) {
      break;
    }
    api.insert(p, "q");
    assertInSync(document, api);
    api.delete(p + 1, p + 3);
    assertInSync(document, api);
  }
  assertEquals("\nq a b q c d q e f", api.apiContents());
  assertInSync(document, api);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:20,代碼來源:ApiViewTest.java

示例5: testShift

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public void testShift() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "0123456789");
  api.insert(4, new Image("id1", "caption"));
  api.insert(8, new Image("id1", "caption"));
  assertInSync(document, api);
  api.delete(2, 3);
  List<ElementInfo> elements = api.getElements();
  assertEquals(3, elements.size());
  api.delete(elements.get(1).apiPosition, elements.get(0).apiPosition + 1);
  assertInSync(document, api);
  api.delete(api.getElements().get(1).apiPosition, elements.get(0).apiPosition + 1);
  assertInSync(document, api);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:17,代碼來源:ApiViewTest.java

示例6: testComposeDocUsingAppend

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public void testComposeDocUsingAppend() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "hello");
  api.insert(1, new Image("id", "caption"));
  assertEquals(2, api.getElements().size());
  assertEquals("\n hello", api.apiContents());
  assertInSync(document, api);
  api.insert(api.apiContents().length(), " world");
  assertEquals("\n hello world", api.apiContents());
  assertInSync(document, api);
  api.insert(api.apiContents().length(), new Image("id", "caption"));
  assertInSync(document, api);
  api.insert(api.apiContents().length(), "!");
  assertEquals("\n hello world !", api.apiContents());
  assertInSync(document, api);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:19,代碼來源:ApiViewTest.java

示例7: testLocateElement

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public void testLocateElement() {
  Document document = BasicFactories.documentProvider().parse(
      LineContainers.debugContainerWrap("01234567890123456789"));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(3, new FormElement(ElementType.BUTTON, "buttonName"));
  FormElement button1 = new FormElement(ElementType.BUTTON, "buttonName");
  assertEquals(3, api.locateElement(button1));

  FormElement button2 = new FormElement(ElementType.BUTTON, "notInDocument");
  assertEquals(-1, api.locateElement(button2));

  api.insert(4, new Gadget("http://test.com"));
  Gadget gadget1 = new Gadget("http://test.com");
  assertEquals(4, api.locateElement(gadget1));

  Gadget gadget2 = new Gadget("http://test.com/something");
  assertEquals(-1, api.locateElement(gadget2));
  assertInSync(document, api);

  Element inlineBlip = new Element(ElementType.INLINE_BLIP);
  inlineBlip.setProperty("id", "b+1234");
  api.insert(5, inlineBlip);
  assertEquals(5, api.locateElement(inlineBlip));
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:25,代碼來源:ApiViewTest.java

示例8: setUp

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
  super.setUp();

  FakeWaveView view = BasicFactories.fakeWaveViewBuilder().with(idgen).build();
  Wavelet userDataWavelet = view.createUserData();
  ObservablePrimitiveSupplement primitiveSupplement =
      WaveletBasedSupplement.create(userDataWavelet);
  WaveBasedConversationView conversationView = WaveBasedConversationView.create(view, idgen);
  WaveletBasedConversation rootConversation = conversationView.createRoot();

  supplementedWave =
      new LiveSupplementedWaveImpl(primitiveSupplement, view, viewer, DefaultFollow.ALWAYS,
          conversationView);
  monitor = ThreadReadStateMonitorImpl.create(supplementedWave, conversationView);
  rootThread = rootConversation.getRootThread();
}
 
開發者ID:apache,項目名稱:incubator-wave,代碼行數:18,代碼來源:ThreadReadStateMonitorTest.java

示例9: TestingWaveletData

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public TestingWaveletData(
    WaveId waveId, WaveletId waveletId, ParticipantId author, boolean isConversational) {
  waveletData =
      new WaveletDataImpl(waveletId, author, 1234567890, 0, HashedVersion.unsigned(0), 0,
          waveId, BasicFactories.observablePluggableMutableDocumentFactory());
  userWaveletData =
      new WaveletDataImpl(WaveletId.of("example.com", "[email protected]"), author,
          1234567890, 0, HashedVersion.unsigned(0), 0,
        waveId, BasicFactories.observablePluggableMutableDocumentFactory());

  OpBasedWavelet wavelet =
    new OpBasedWavelet(waveId, waveletData, new BasicWaveletOperationContextFactory(author),
        ParticipationHelper.DEFAULT,
        SilentOperationSink.Executor.<WaveletOperation, WaveletData>build(waveletData),
        SilentOperationSink.VOID);
  ReadOnlyWaveView waveView = new ReadOnlyWaveView(waveId);
  waveView.addWavelet(wavelet);

  if (isConversational) {
    ConversationView conversationView = WaveBasedConversationView.create(waveView, FakeIdGenerator.create());
    WaveletBasedConversation.makeWaveletConversational(wavelet);
    conversation = conversationView.getRoot();

    conversation.addParticipant(author);
  } else {
    conversation = null;
  }

  waveViewData = WaveViewDataImpl.create(waveId, ImmutableList.of(waveletData, userWaveletData));
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:31,代碼來源:TestingWaveletData.java

示例10: setUp

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
public void setUp() {
  WaveId waveId = WaveId.of("example.com", "c+123");
  WaveletId waveletId = WaveletId.of("example.com", IdConstants.CONVERSATION_ROOT_WAVELET);
  wavelet = new WaveletDataImpl(waveletId, CREATOR, 0L, 0L,
      HashedVersion.unsigned(0), 0L, waveId,
      BasicFactories.pluggableMutableDocumentFactory());
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:9,代碼來源:AddParticipantTest.java

示例11: setUp

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
  super.setUp();

  context = new WaveletOperationContext(fred, CONTEXT_TIMESTAMP, 1L);
  WaveletDataImpl.Factory holderFactory =
      WaveletDataImpl.Factory.create(BasicFactories.fakeDocumentFactory());
  waveletData = WaveletDataFactory.of(holderFactory).create();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:10,代碼來源:OperationTestBase.java

示例12: createEmptyMap

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
/** Creates an empty ObservableBasicSetImpl to work with. */
@Override
protected void createEmptyMap() {
  ObservablePluggableMutableDocument doc = BasicFactories.observableDocumentProvider().create(
      "data", Collections.<String, String> emptyMap());

  set = DocumentBasedBasicSet.create(
      DefaultDocumentEventRouter.create(doc), doc.getDocumentElement(), Serializer.STRING,
      ENTRY_TAG, VALUE_ATTR);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:11,代碼來源:ObservableBasicSetWithDocumentBasedBasicSetTest.java

示例13: createMap

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
protected void createMap() {
  ObservablePluggableMutableDocument doc = BasicFactories.observableDocumentProvider().create(
      "data", Collections.<String, String> emptyMap());

  map = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(doc),
      doc.getDocumentElement(), Serializer.STRING, Serializer.INTEGER, ENTRY_TAG,
      KEY_ATTR, VALUE_ATTR);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:10,代碼來源:ObservableBasicMapWithDocumentBasedBasicMapTest.java

示例14: getIndexability

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
@Override
protected MutableIndexability getIndexability() {
  ObservableDocument doc =
      BasicFactories.createDocument(AccountSchemas.INDEXABILITY_SCHEMA_CONSTRAINTS);
  DefaultDocEventRouter router = DefaultDocEventRouter.create(doc);
  return DocumentBasedIndexability.create(router);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:8,代碼來源:DocumentBasedIndexabilityTest.java

示例15: PrimitiveSupplementWithWaveletBasedSupplementTest

import org.waveprotocol.wave.model.testing.BasicFactories; //導入依賴的package包/類
public PrimitiveSupplementWithWaveletBasedSupplementTest() {
  super(new Factory<WaveletBasedSupplement>() {
    @Override
    public WaveletBasedSupplement create() {
      return WaveletBasedSupplement.create(
          BasicFactories.fakeWaveViewBuilder().build().createUserData());
    }
  });
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:10,代碼來源:PrimitiveSupplementWithWaveletBasedSupplementTest.java


注:本文中的org.waveprotocol.wave.model.testing.BasicFactories類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。