本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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();
}
示例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));
}
示例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());
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
});
}