当前位置: 首页>>代码示例>>Java>>正文


Java Constraint类代码示例

本文整理汇总了Java中org.jmock.core.Constraint的典型用法代码示例。如果您正苦于以下问题:Java Constraint类的具体用法?Java Constraint怎么用?Java Constraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Constraint类属于org.jmock.core包,在下文中一共展示了Constraint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的org.jmock.core.Constraint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。