本文整理汇总了Java中org.jmock.core.Constraint类的典型用法代码示例。如果您正苦于以下问题:Java Constraint类的具体用法?Java Constraint怎么用?Java Constraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constraint类属于org.jmock.core包,在下文中一共展示了Constraint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testTakeOperation
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeOperation() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(0l),
eq(0),
same(false)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
Object actualRetVal = gs.take(template);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DefaultGigaSpacesTests.java
示例2: testTakeOperationWithDefaultTimeout
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeOperationWithDefaultTimeout() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(10l),
eq(0),
same(false)};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultTakeTimeout(10l);
Object actualRetVal = gs.take(template);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DefaultGigaSpacesTests.java
示例3: testTakeOperationWithTimeoutParameter
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeOperationWithTimeoutParameter() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(11l),
eq(0),
same(false)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
Object actualRetVal = gs.take(template, 11l);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DefaultGigaSpacesTests.java
示例4: testTakeIfExistsOperation
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeIfExistsOperation() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(0l),
eq(0),
eq(Boolean.TRUE)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
Object actualRetVal = gs.takeIfExists(template);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DefaultGigaSpacesTests.java
示例5: testTakeIfExistsOperationWithDefaultTimeout
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeIfExistsOperationWithDefaultTimeout() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(10l),
eq(0),
eq(Boolean.TRUE)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultTakeTimeout(10l);
Object actualRetVal = gs.takeIfExists(template);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:20,代码来源:DefaultGigaSpacesTests.java
示例6: testTakeIfExistsOperationWithTimeoutParameter
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeIfExistsOperationWithTimeoutParameter() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(11l),
eq(0),
eq(Boolean.TRUE)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
Object actualRetVal = gs.takeIfExists(template, 11l);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:20,代码来源:DefaultGigaSpacesTests.java
示例7: testTakeWithDefaultTakeModifiers
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testTakeWithDefaultTakeModifiers() {
Object template = new Object();
Object retVal = new Object();
Constraint[] constraints = new Constraint[] {
same(template),
NULL,
eq(11l),
eq(TakeModifiers.MEMORY_ONLY_SEARCH.getCode()),
eq(Boolean.TRUE)
};
mockIJSpace.expects(once()).method("take").with(constraints).will(returnValue(retVal));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultTakeModifiers(TakeModifiers.MEMORY_ONLY_SEARCH);
Object actualRetVal = gs.takeIfExists(template, 11l);
assertEquals(retVal, actualRetVal);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:21,代码来源:DefaultGigaSpacesTests.java
示例8: testWriteOperation
import org.jmock.core.Constraint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testWriteOperation() {
Object entry = new Object();
Mock mockLeaseContext = mock(LeaseContext.class);
LeaseContext<Object> leaseContext = (LeaseContext<Object>) mockLeaseContext.proxy();
Constraint[] constraints = new Constraint[] {
same(entry),
NULL,
eq(Long.MAX_VALUE),
eq(0l),
eq(WriteModifiers.NONE.getCode())
};
mockIJSpace.expects(once()).method("write").with(constraints).will(returnValue(leaseContext));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
LeaseContext<Object> actualLeaseContext = gs.write(entry);
assertEquals(leaseContext, actualLeaseContext);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:21,代码来源:DefaultGigaSpacesTests.java
示例9: testWriteOperationWithDefaultLease
import org.jmock.core.Constraint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testWriteOperationWithDefaultLease() {
Object entry = new Object();
Mock mockLeaseContext = mock(LeaseContext.class);
LeaseContext<Object> leaseContext = (LeaseContext<Object>) mockLeaseContext.proxy();
Constraint[] constraints = new Constraint[] {
same(entry),
NULL,
eq(10l),
eq(0l),
eq(WriteModifiers.NONE.getCode())
};
mockIJSpace.expects(once()).method("write").with(constraints).will(returnValue(leaseContext));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultWriteLease(10l);
LeaseContext actualLeaseContext = gs.write(entry);
assertEquals(leaseContext, actualLeaseContext);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:23,代码来源:DefaultGigaSpacesTests.java
示例10: testWriteOperationWithLeaseParameter
import org.jmock.core.Constraint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testWriteOperationWithLeaseParameter() {
Object entry = new Object();
Mock mockLeaseContext = mock(LeaseContext.class);
LeaseContext<Object> leaseContext = (LeaseContext<Object>) mockLeaseContext.proxy();
Constraint[] constraints = new Constraint[] {
same(entry),
NULL,
eq(10l),
eq(0l),
eq(WriteModifiers.NONE.getCode())
};
mockIJSpace.expects(once()).method("write").with(constraints).will(returnValue(leaseContext));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
LeaseContext<Object> actualLeaseContext = gs.write(entry, 10l);
assertEquals(leaseContext, actualLeaseContext);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:22,代码来源:DefaultGigaSpacesTests.java
示例11: testWriteOperationWithLeaseTimeoutModifiersParameters
import org.jmock.core.Constraint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testWriteOperationWithLeaseTimeoutModifiersParameters() {
Object entry = new Object();
Mock mockLeaseContext = mock(LeaseContext.class);
LeaseContext<Object> leaseContext = (LeaseContext<Object>) mockLeaseContext.proxy();
mockIJSpace.expects(once())
.method("write")
.with(new Constraint[] { same(entry), NULL, eq(10l), eq(2l), eq(3) })
.will(returnValue(leaseContext));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
LeaseContext actualLeaseContext = gs.write(entry, 10l, 2l, 3);
assertEquals(leaseContext, actualLeaseContext);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:17,代码来源:DefaultGigaSpacesTests.java
示例12: testWriteOperationWithDefaultWriteModifiers
import org.jmock.core.Constraint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testWriteOperationWithDefaultWriteModifiers() {
Object entry = new Object();
Mock mockLeaseContext = mock(LeaseContext.class);
LeaseContext<Object> leaseContext = (LeaseContext<Object>) mockLeaseContext.proxy();
Constraint[] constraints = new Constraint[] {
same(entry),
NULL,
eq(Long.MAX_VALUE),
eq(0l),
eq(WriteModifiers.ONE_WAY.getCode())
};
mockIJSpace.expects(once()).method("write").with(constraints).will(returnValue(leaseContext));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultWriteModifiers(WriteModifiers.ONE_WAY);
LeaseContext actualLeaseContext = gs.write(entry);
assertEquals(leaseContext, actualLeaseContext);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:23,代码来源:DefaultGigaSpacesTests.java
示例13: testClearWithDefaultModifiers
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testClearWithDefaultModifiers() {
Object entry1 = new Object();
Constraint[] constraints = new Constraint[] {
same(entry1),
NULL,
eq(ClearModifiers.MEMORY_ONLY_SEARCH.getCode())
};
mockIJSpace.expects(once()).method("clear").with(constraints).will(returnValue(0));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultClearModifiers(ClearModifiers.MEMORY_ONLY_SEARCH);
gs.clear(entry1);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:17,代码来源:DefaultGigaSpacesTests.java
示例14: testCountWithDefaultModifiers
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testCountWithDefaultModifiers() {
int expectedCount = 2;
Object entry1 = new Object();
Constraint[] constraints = new Constraint[] {
same(entry1),
NULL,
eq(CountModifiers.MEMORY_ONLY_SEARCH.add(CountModifiers.READ_COMMITTED).getCode())
};
mockIJSpace.expects(once()).method("count").with(constraints).will(returnValue(expectedCount));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
mockTxProvider.expects(once()).method("getCurrentTransactionIsolationLevel").with(eq(gs)).will(returnValue(TransactionDefinition.ISOLATION_READ_COMMITTED));
gs.setDefaultCountModifiers(CountModifiers.MEMORY_ONLY_SEARCH);
int count = gs.count(entry1);
assertEquals(expectedCount, count);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:20,代码来源:DefaultGigaSpacesTests.java
示例15: testCountWithDefaultModifiersIsolationLevelOverride
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testCountWithDefaultModifiersIsolationLevelOverride() {
int expectedCount = 2;
Object entry1 = new Object();
Constraint[] constraints = new Constraint[] {
same(entry1),
NULL,
eq(CountModifiers.READ_COMMITTED.getCode())
};
mockIJSpace.expects(once()).method("count").with(constraints).will(returnValue(expectedCount));
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
mockTxProvider.expects(once()).method("getCurrentTransactionIsolationLevel").with(eq(gs)).will(returnValue(TransactionDefinition.ISOLATION_READ_COMMITTED));
gs.setDefaultCountModifiers(CountModifiers.DIRTY_READ);
int count = gs.count(entry1);
assertEquals(expectedCount, count);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:20,代码来源:DefaultGigaSpacesTests.java
示例16: testChangeWithDefaultModifiers
import org.jmock.core.Constraint; //导入依赖的package包/类
public void testChangeWithDefaultModifiers() {
Object entry1 = new Object();
Constraint[] constraints = new Constraint[] {
same(entry1),
NULL,
NULL,
eq(0l),
same(ChangeModifiers.RETURN_DETAILED_RESULTS)
};
mockIJSpace.expects(once()).method("change").with(constraints);
mockTxProvider.expects(once()).method("getCurrentTransaction").with(eq(gs), eq(gs.getSpace()));
gs.setDefaultChangeModifiers(ChangeModifiers.RETURN_DETAILED_RESULTS);
gs.change(entry1, null);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DefaultGigaSpacesTests.java
示例17: setStandardDragFixture
import org.jmock.core.Constraint; //导入依赖的package包/类
/**
* Fixture for standard drag operations.
*/
private void setStandardDragFixture() {
Point2D origin = new Point2D.Double(0, 0);
// start dragging somewhere in the selection
selection.startDragging(100.0, 100.0);
assertTrue(selection.isDragging());
// move it a little
mockOperations.expects(atLeastOnce()).method("getDiagram").
will(returnValue(mockDiagram.proxy()));
mockDiagram.expects(atLeastOnce()).method("getOrigin").
will(returnValue(origin));
mockDiagram.expects(atLeastOnce()).method("snap");
selection.updatePosition(150.0, 150.0);
// and draw it
Constraint[] params = {eq(52.0), eq(55.0), eq(320.0), eq(420.0), NULL};
mockDrawingContext.expects(once()).method("drawRectangle").
with(params);
selection.draw((DrawingContext) mockDrawingContext.proxy());
}
开发者ID:ligenzatomas,项目名称:firebird-vizualization-tool,代码行数:22,代码来源:NodeSelectionTest.java
示例18: testDragResizeSe
import org.jmock.core.Constraint; //导入依赖的package包/类
/**
* Simulates a dragging operation for resizing.
*/
public void testDragResizeSe() {
Dimension2D minimumSize = new DoubleDimension(10, 10);
// start dragging somewhere in the SE handle (322+, 425+)
selection.startDragging(324.0, 427.0);
assertTrue(selection.isDragging());
// make it a little bigger
setFullResizeExpectations(minimumSize);
selection.updatePosition(330.0, 450.0);
// and draw it
// don't forget that sizes are truncated to the local system'
Constraint[] params = {eq(2.0), eq(5.0), eq(326.0), eq(443.0), NULL};
mockDrawingContext.expects(once()).method("drawRectangle").
with(params);
selection.draw((DrawingContext) mockDrawingContext.proxy());
// stop dragging
mockOperations.expects(once()).method("resizeElement").
with(eq(selection.getElement()), eq(new Point2D.Double(2.0, 5.0)),
eq(new DoubleDimension(326.0, 443.0)));
selection.stopDragging(330.0, 450.0);
assertFalse(selection.isDragging());
}
开发者ID:ligenzatomas,项目名称:firebird-vizualization-tool,代码行数:26,代码来源:NodeSelectionTest.java
示例19: testDragResizeSeWithTruncation
import org.jmock.core.Constraint; //导入依赖的package包/类
/**
* Simulates a dragging operation for resizing with truncation.
*/
public void testDragResizeSeWithTruncation() {
// At SE resize, the position is < 22 and 25
Dimension2D minimumSize = new DoubleDimension(20, 20);
// start dragging somewhere in the SE handle (322+, 425+)
selection.startDragging(324.0, 427.0);
assertTrue(selection.isDragging());
// make it a little smaller
setResizeExpectations(minimumSize);
selection.updatePosition(21.0, 23.0);
// and draw it
// don't forget that sizes are truncated to the local system'
Constraint[] params = {eq(2.0), eq(5.0), eq(20.0), eq(20.0), NULL};
mockDrawingContext.expects(once()).method("drawRectangle").
with(params);
selection.draw((DrawingContext) mockDrawingContext.proxy());
}
开发者ID:ligenzatomas,项目名称:firebird-vizualization-tool,代码行数:20,代码来源:NodeSelectionTest.java
示例20: testDragResizeNw
import org.jmock.core.Constraint; //导入依赖的package包/类
/**
* Simulates a dragging operation for resizing on the NW corner.
*/
public void testDragResizeNw() {
Point2D origin = new Point2D.Double(0, 0);
Dimension2D minimumSize = new DoubleDimension(20, 20);
// start dragging somewhere in the NW handle (2-, 5-)
selection.startDragging(1, 3);
assertTrue(selection.isDragging());
// make it a little bigger
setFullResizeExpectations(minimumSize);
selection.updatePosition(-10.0, -10.0);
// and draw it
// don't forget that sizes are truncated to the local system'
Constraint[] params = {eq(-9.0), eq(-8.0), eq(331.0), eq(433.0), NULL};
mockDrawingContext.expects(once()).method("drawRectangle").
with(params);
selection.draw((DrawingContext) mockDrawingContext.proxy());
// stop dragging
mockOperations.expects(once()).method("resizeElement").
with(eq(selection.getElement()), eq(new Point2D.Double(-9.0, -8.0)),
eq(new DoubleDimension(331.0, 433.0)));
selection.stopDragging(-10.0, -10.0);
assertFalse(selection.isDragging());
}
开发者ID:ligenzatomas,项目名称:firebird-vizualization-tool,代码行数:27,代码来源:NodeSelectionTest.java
注:本文中的org.jmock.core.Constraint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论