- 浏览: 64464 次
- 性别:
- 来自: 大连
-
文章分类
最新评论
-
xnxylxh:
辛苦了
JTest的使用 -
bruceyu:
Teeda和dbFlute的相关知识,若是有的话,不妨贴出,大 ...
日本流行的Seasar开源框架学习笔记 -
yangpeihai:
不错不错,都是我要的,楼主辛苦了
Flex书籍 -
likeblood:
这全是做软件的 没有开饭店的 最好别从这找出路 给你出主意也是 ...
老程序员想开饭店做老板,如何将发挥长处,在餐饮业进行软件开发实践可行么? -
凯旋人生:
up下呀。
老程序员想开饭店做老板,如何将发挥长处,在餐饮业进行软件开发实践可行么?
DBUnit官方网站:www.dbunit.org
About DbUnit
DbUnit is a JUnit extension (also usable with Ant) targeted at database-driven projects that, among other things, puts your database into a known state between test runs. This is an excellent way to avoid the myriad of problems that can occur when one test case corrupts the database and causes subsequent tests to fail or exacerbate the damage.
DbUnit has the ability to export and import your database data to and from XML datasets. Since version 2.0, DbUnit can also work with very large datasets when used in streaming mode. DbUnit can also help you to verify that your database data match an expected set of values.
1.添加dbunit-2.3.0.jar
DBUnit依赖于Simple Logging Facade for Java (SLF4J)项目 官网:http://www.slf4j.org/
2.添加slf4j-api-1.5.3.jar
3.添加slf4j-jcl-1.5.3.jar
SLF4J依赖于Apache的 Commons-Logging.
4.添加commons-logging.jar
★ 导出数据库中的数据到xml文件
------------------------------------------------------------------------------------------------------------
package com.test.dbunit;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.QueryDataSet;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatDtdDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
public class Test {
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost/dbunit","root","admin");
//使用DBunit的DatabaseConnection类封装jdbc的连接,它实现了接口IDatabaseConnection
IDatabaseConnection connection =new DatabaseConnection(conn);
//QueryDataSet和.net中的数据集的概念类似,它是数据库的一个映像
QueryDataSet partial=new QueryDataSet(connection);
//把task表中的数据导出到xml文件中
partial.addTable("task");
//partial.addTable("users","select * from users where id= 1 ");
partial.addTable("users");
//把数据内容导出到xml文件中
FlatXmlDataSet.write(partial,new FileOutputStream("partial.xml"));
//将数据库中所有的数据导出
IDataSet full =connection.createDataSet();
FlatXmlDataSet.write(full, new FileOutputStream("full.xml"));
//导出Dtd文件
FlatDtdDataSet.write(full, new FileOutputStream("full.dtd"));
}
}
------------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataset SYSTEM "full.dtd">
<dataset>
<task/>
<users id="1" username="张三" password="123"/>
<users id="2" username="李四" password="456"/>
<users id="3" username="王五" password="789"/>
</dataset>
------------------------------------------------------------------------------------------------------------
<!ELEMENT dataset (
task*,
users*)>
<!ELEMENT task EMPTY>
<!ATTLIST task
id CDATA #IMPLIED
name CDATA #IMPLIED
description CDATA #IMPLIED
>
<!ELEMENT users EMPTY>
<!ATTLIST users
id CDATA #REQUIRED
username CDATA #REQUIRED
password CDATA #REQUIRED
>
------------------------------------------------------------------------------------------------------------------
//使用dbunti测试的简单例子
package com.test.dbunit;
import java.io.File;
import java.io.FileInputStream;
import org.dbunit.Assertion;
import org.dbunit.DBTestCase;
import org.dbunit.PropertiesBasedJdbcDatabaseTester;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.SortedTable;
import org.dbunit.dataset.filter.DefaultColumnFilter;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.operation.DatabaseOperation;
public class SampleTest extends DBTestCase{
//重写构造方法
public SampleTest(String name){
super(name);
//在系统属性中添加数据库练接用到的属性
System.setProperty(
PropertiesBasedJdbcDatabaseTester.DBUNIT_DRIVER_CLASS,
"com.mysql.jdbc.Driver");
System.setProperty(
PropertiesBasedJdbcDatabaseTester.DBUNIT_CONNECTION_URL,
"jdbc:mysql://localhost/dbunit");
System.setProperty(
PropertiesBasedJdbcDatabaseTester.DBUNIT_USERNAME,
"root");
System.setProperty(
PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD,
"admin");
}
/**
* 在每次测试执行之前都先执行getSetUpOperation()操作
*/
public DatabaseOperation getSetUpOperation() throws Exception{
//默认在setUPOperation中就是执行CLEAN_INSERT ,
//CLEAN_INSERT是DELETE_ALL和INSERT的组合,数据库会恢复到xml文件中的数据。
return DatabaseOperation.CLEAN_INSERT;
//刷新会更新xml内容到数据库中,数据存,xml中都存在的updata,数据库不存在insert,
//数据库中有xml中没有的保持不变
//return DatabaseOperation.REFRESH;
}
/**
* 每次测试执行之后会执行该操作。
*/
public DatabaseOperation getTearDownOperation() throws Exception{
//什么都不做--默认
//return DatabaseOperation.NONE;
//清空数据库
return DatabaseOperation.DELETE_ALL;
}
/**
* 将数据文件转换成数据集,这个方法是在dbunit启动的时候自动启动
*/
@Override
protected IDataSet getDataSet() throws Exception {
return new FlatXmlDataSet(new FileInputStream("full.xml"));
}
public void test1() throws Exception{
IDataSet dataSet = getConnection().createDataSet();
//数据库中实际的表
ITable actualTable = dataSet.getTable("users");
//期望值
IDataSet dataSet2 = new FlatXmlDataSet(new File("full.xml"));
ITable expectedTable = dataSet2.getTable("users");
//DBUnit的Assertion类
Assertion.assertEquals(expectedTable,actualTable);
}
//比较过滤二种方法之一,包含哪些列
public void test2() throws Exception{
IDataSet dataSet = getConnection().createDataSet();
ITable actualTable = dataSet.getTable("users");
//期望值-没有id列
IDataSet dataSet2 = new FlatXmlDataSet(new File("Full2.xml"));
ITable expectedTable = dataSet2.getTable("users");
//用过滤器过滤掉actualtable的中的id列
actualTable = DefaultColumnFilter.includedColumnsTable(actualTable,
expectedTable.getTableMetaData().getColumns());
Assertion.assertEquals(expectedTable, actualTable);
}
//方法2,比较用户名相同的。排除掉不需要比较的各个字段,
public void test3() throws Exception{
IDataSet dataSet =getConnection().createDataSet();
ITable actualTable = dataSet.getTable("users");
IDataSet dataSet2 = new FlatXmlDataSet(new File("full2.xml"));
ITable expectedTable = dataSet2.getTable("users");
ITable filterActualTable =DefaultColumnFilter.excludedColumnsTable(
actualTable, new String[]{"id","password"});
ITable filterExpectedTable =DefaultColumnFilter.excludedColumnsTable(
expectedTable,new String[]{"password"});
Assertion.assertEquals(filterExpectedTable,filterActualTable);
}
//排序表格
public void test4() throws Exception{
IDataSet dataSet = getConnection().createDataSet();
//数据库中实际的表
ITable actualTable = dataSet.getTable("users");
//期望值
IDataSet dataSet2 = new FlatXmlDataSet(new File("expected.xml"));
ITable expectedTable = dataSet2.getTable("users");
//把表按照字段排序,默认是按照字符串排序
SortedTable sortedTable1 = new SortedTable(actualTable,new String[]{"id"});
//按照数据库中字段排序
sortedTable1.setUseComparable(true);
SortedTable sortedTable2 = new SortedTable(expectedTable,new String[]{"id"});
//按照数据库中字段排序
sortedTable2.setUseComparable(true);
//DBUnit的Assertion类
Assertion.assertEquals(sortedTable2,sortedTable1);
}
// 表操作测试的实例:
public void testSave() throws Exception{
UsersDB db =new UsersDB();
Users users =new Users();
users.setId(9);
users.setUserName("langsin");
users.setPassword("helloworld");
db.save(users);
IDataSet dataSet = getConnection().createDataSet();
ITable actualTable = dataSet.getTable("users");
IDataSet dataSet2 = new FlatXmlDataSet(new File("expected2.xml"));
ITable expectedTable =dataSet.getTable("users");
Assertion.assertEquals(expectedTable, actualTable);
}
------------------------------------------------------------------------
package com.test.bean;
public class Users {
private int id;
private String userName;
private String password;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
------------------------------------------------------------------------
package com.test.dbunit;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.test.bean.Users;
public class UsersDB {
public void save(Users users){
Connection conn=null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost/dbunit",
"root", "admin");
String sql="insert into users(id,username,password) values(?,?,?)";
PreparedStatement ps =conn.prepareStatement(sql);
ps.setInt(1, users.getId());
ps.setString(2,users.getUserName());
ps.setString(3,users.getPassword());
ps.executeUpdate();
}catch(Exception ex){
ex.printStackTrace();
}finally
{
if(null!= conn)
{
try
{
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
}
}
}
}
---------------------------expected2.xml------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataset SYSTEM "full.dtd">
<dataset>
<task/>
<users id="1" username="张三" password="123"/>
<users id="2" username="李四" password="456"/>
<users id="3" username="王五" password="789"/>
<users id="9" username="langsin" password="helloworld"/>
</dataset>
***********************************************************************
使用DBUnit进行单元测试的基本流程
1.根据业务,做好测试用的准备数据和预想结果数据,通常为XML格式文件。
2.在setUp()方法里面边备份数据库中的关联表。
3.在setUP()方法里面边读入准备数据。
4.对测试类的对应测试方法进行调用:执行对象方法,把数据库中的实际执行
结果和预想结果进行比较。
5.在tearDown()方法里面,把数据库还原到测试前状态。
***********************************************************************
Getting Started
- Database setup with DBTestCase subclass
- Database setup with your own TestCase subclass
- Database data verification
- DbUnit Ant task and Canoo WebTest
Database setup with DBTestCase subclass
Step 1: Create your dataset file
Your test need some data to work with. This means you must create a dataset. In most situations you will work with xml datasets. You can manually create a flat XML dataset from scratch or create one by exporting some data from your database.
Step 2: Extend the DBTestCase class
Now you need to create a test class. The easiest way to use Dbunit is to make your test class extend the DBTestCase class. DBTestCase extends the JUnit TestCase class. A template method is required to be implemented: getDataSet() to return the dataset you created in step 1. DBTestCase relies on a IDatabaseTester to do its work, the default configuration uses PropertiesBasedJdbcDatabaseTester, it locates configuration for the DriverManager within the Sytem properties. The simplest way to configure it would be in the constructor of your test class. You may modify this behavior by overriding getDatabaseTester(),CLEAN_INSERT operation before executing each test and performs no cleanup operation afterward. You can modify this behavior by overriding getSetUpOperation() and getTearDownOperation().
Database setup with your own TestCase subclass
In order to use Dbunit you are not required to extend the DBTestCase class. You can override the standard JUnit setUp() method and execute the desired operation on your database. Do something similar in teardown() if you need to perform clean-up.
For example:
Since version 2.2 you may use the new IDatabaseTester to accomplish the same feat. As explained in the previous topic, DBTestCase uses a IDatabaseTester internally to do its work; your test class may also use this feature to manipulate DataSets. Currently there are 4 convenient implementations:
JdbcDatabaseTester | uses a DriverManager to create connections. |
PropertiesBasedJdbcDatabaseTester | also uses DriverManager, but the configuration is taken from system properties. This is the default implementation used by DBTestCase. |
DataSourceDatabaseTester | uses a javax.sql.DataSource to create connections. |
JndiDatabaseTester | uses a javax.sql.DataSource located through JNDI. |
You may also provide your own IDatabaseTester implementation. It is recommended to use AbstractDatabaseTester as a starting point.
Example:
Database data verification
Dbunit provides support for verifying whether two tables or datasets contain identical data. The following two methods can be used to verify if your database contains the expected data during test cases execution.
Sample
The following sample, show how to compare a database table snapshot against a flat XML table.
The actual dataset is a database snapshot you want to verify against an expected dataset. As its name imply, the expected dataset contains the expectation values.
The expected dataset must be different from the one you have used to setup your database. Therefore you need two datasets to do that; one to setup your database before a test and another to provide the expected data during the test.
Using a query to take the database snapshot
You can also verify if the result of a query match an expected set of data. The query can be used to select only a subset of a table or even join multiple tables together.
Ignoring some columns in comparison
Sometimes this is desirable to ignore some columns to perform the comparison; particularly for primary keys, date or time columns having values generated by the code under test. One way to do this is to omit to declare unwanted columns in your expected table. You can then filter the actual database table to only expose the expected table columns.
The following code snippet shows you how to filter the actual table. To works, the actual table MUST contain at least ALL the columns from the expected table. Extra columns can exist in the actual table but not in the expected one.
A major limitation of this technique is that you cannot use a DTD with your expected flat XML dataset. With a DTD you need to filter columns from both the expected and the actual table. See the FAQ about excluding some table columns at runtime.
Row ordering
By default, database table snapshot taken by DbUnit are sorted by primary keys. If a table does not have a primary key or the primary key is automatically generated by your database, the rows ordering is not predictable and assertEquals
will fail.
You must order your database snapshot manually by using IDatabaseConnection.createQueryTable
with an "ORDER BY" clause. Or you can use the SortedTable
decorator class like this:
DbUnit Ant task and Canoo WebTest
By Eric Pugh
With Dbunit Ant tasks, Dbunit makes it much easier to run Canoo WebTest scripts for database centric applications. WebTest is a tool to simulate a user's browser clicking through the pages on a web site. It allows you to create a series of Ant based tests for your website. In fact, this can be used to perform User Acceptance tests for websites built using non Java technologies like ColdFusion or ASP! This document walks you through a suggested format for storing tests.
Step 1: Create your dataset file
Your first step is to create your dataset file that you want to load into your database before running your WebTest script. Use one of the various methods described above. Put the various datasets you need in a /data
directory.
Step 2: Create your Ant build.xml file
A suggested setup is to have a single build.xml file that is the entry point for all your tests. This would include a couple targets like:
test
: Runs all the testSuites that you have createdtest:single
: Runs a single test in a specific testSuitetest:suite
: Runs all the tests for a specific testSuite
Step 3: Create your various Test Suites
Once you have your build.xml file set up, you can now call the various TestSuites. Create a separate TestSuiteXXX.xml for the various modules that you would like to test. In your TestSuiteXXX.xml, you should have your default target testSuite call all the testcases you have definied:
This way you can either run all the test's in your Test Suite, or just run a specific one, all from build.xml!
Step 4: Create your various Tests
Now you need to write your various testcases. For more information on WebTest, please refer to the WebTest home page. If you have find you are duplicating pieces of XML, then place them in a /includes
directory. If you have a single set of properties, then load them as part of build.xml by specifing them in your build.properties file. If you have multiple databases you need to connect to, then declare your sql connection properties in a TestSuiteXXX.properties file that you load on a per suite basis. In this example, we are using doing a clean insert into the database, and using the MSSQL_CLEAN_INSERT instead of CLEAN_INSERT because of the requirement to do identity column inserts.
Sample Directory Layout
When you are done, you will have a series of files that look like this:
using one of the other 3 provided IDatabaseTester implementations or your own. You may also use the other subclasses of DBTestCase described in the next table:
JdbcBasedDBTestCase | uses a DriverManager to create connections (with the aid of a JdbcDatabaseTester). |
DataSourceBasedDBTestCase | uses a javax.sql.DataSource to create connections (with the aid of a DataSourceDatabaseTester). |
JndiBasedDBTestCase | uses a javax.sql.DataSource located through JNDI (with the aid of a JndiDatabaseTester). |
Following is a sample implementation that returns a connection to a Hypersonic database and a xml dataset:
Step 3: (Optional) Implement getSetUpOperation() and getTearDownOperation() methods
By default, Dbunit performs a
The following example demonstrates how you can easily override the operation executed before or after your test.
Step 4: Implement your testXXX() methods
Implement your test methods as you normally would with JUnit. Your database is now initialized before and cleaned-up after each test methods according to what you did in previous steps.
Core Components
This document attemps to give you an overview of the core classes that make up DbUnit. Following are the core interfaces or abstract classes:
IDatabaseConnection | Interface representing a DbUnit connection to a database. |
IDataSet | Interface representing a collection of tables. |
DatabaseOperation | Abstract class representing an operation performed on the database before and after each test. |
IDatabaseConnection
The IDatabaseConnection interface represents a DbUnit connection to a database.
DatabaseConnection | Wraps a JDBC connection. |
DatabaseDataSourceConnection | Wraps a JDBC DataSource. |
IDataSet
The IDataSet interface represents is a collection of tables. This is the primary abstraction used by DbUnit to manipulate tabular data.
Most commonly used implemetations:
FlatXmlDataSet | Reads and writes flat XML dataset document. Each XML element corresponds to a table row. Each XML element name corresponds to a table name. The XML attributes correspond to table columns. Flat XML dataset document sample: <!DOCTYPE dataset SYSTEM "my-dataset.dtd"> <dataset> <TEST_TABLE COL0="row 0 col 0" COL1="row 0 col 1" COL2="row 0 col 2"/> <TEST_TABLE COL1="row 1 col 1"/> <SECOND_TABLE COL0="row 0 col 0" COL1="row 0 col 1" /> <EMPTY_TABLE/> </dataset>
To specify null values, omit corresponding attribute. In the above example, missing COL0 and COL2 attributes of TEST_TABLE second row represents null values. Table metadata is deduced from the first row of each table by default, whereas it is possible to enable the column sensing feature as described in differentcolumnnumberBeware you may get a NoSuchColumnException if the first row of a table has one or more null values. Because of that, this is highly recommended to use DTD. DbUnit will use the columns declared in the DTD as table metadata. DbUnit only support external system URI. The URI can be absolute or relative. Another way to cope with this problem is to use the ReplacementDataSet. |
||||||||
XmlDataSet | Reads and writes original XML dataset document. This format is very verbose and must conform to the following DTD:
<?xml version="1.0" encoding="UTF-8"?> <!ELEMENT dataset (table+)> <!ELEMENT table (column*, row*)> <!ATTLIST table name CDATA #REQUIRED > <!ELEMENT column (#PCDATA)> <!ELEMENT row (value | null | none)*> <!ELEMENT value (#PCDATA)> <!ELEMENT null EMPTY>
XML dataset document sample: <!DOCTYPE dataset SYSTEM "dataset.dtd"> <dataset> <table name="TEST_TABLE"> <column>COL0</column> <column>COL1</column> <column>COL2</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> </row> <row> <null/> <value>row 1 col 1</value> <null/> </row> </table> <table name="SECOND_TABLE"> <column>COLUMN0</column> <column>COLUMN1</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> </row> </table> <table name='EMPTY_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> </table> </dataset>
|
||||||||
StreamingDataSet | Consumes a producer and expose its content as a dataset. Provides cursor like forward only access to it and only keeps the active row in memory. Can be used with FlatXmlProducer and XmlProvider. This is a very efficient way to load XML dataset document when working with forward only database operations (UPDATE, INSERT, REFRESH). Following sample shows how to load a flat XML dataset with the StreamingDataSet: IDataSetProducer producer = new FlatXmlProducer( new InputSource("dataset.xml")); IDataSet dataSet = new StreamingDataSet(producer);
|
||||||||
DatabaseDataSet | Adapter that provides access to a database instance as a dataset. This class is not usually instantiated directly but from the factory method IDatabaseConnection.createDataSet() . |
||||||||
QueryDataSet | Holds collection of tables resulting from database queries. Following sample snippet creates a dataset containing two tables: FOO, resulting from specified query and BAR, resulting from generated query "SELECT * FROM BAR". QueryDataSet dataSet = new QueryDataSet(connection); dataSet.addTable("FOO", "SELECT * FROM TABLE WHERE COL='VALUE'"); dataSet.addTable("BAR");
|
||||||||
DefaultDataSet | Uses to create datasets programmatically. | ||||||||
CompositeDataSet | Combines multiple datasets into a single logical dataset. | ||||||||
FilteredDataSet | Decorator that exposes only some tables from decorated dataset. Can be used with different filtering strategies. Some strategies can include/exclude tables without altering their order while others expose tables with a different order.
|
||||||||
XlsDataSet | Read and writes MS Excel dataset documents. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. | ||||||||
ReplacementDataSet | Decorator that replaces placeholder objects from the decorated dataset with replacement objects. Substring substitution is also possible. Interestingly this provides a new way to specify null values in flat XML datasets. For example you can use a placeholder value, like "[NULL]" in your flat XML dataset and replace it with null at runtime.
<?xml version="1.0"?> <dataset> <TEST_TABLE COL0="row 0 col 0" COL1="[null]"/> <TEST_TABLE COL1="row 1 col 0" COL2="row 1 col 1"/> </dataset>
Loading the flat XML dataset: ReplacementDataSet dataSet = new ReplacementDataSet( new FlatXmlDataSet(…)); dataSet.addReplacementObject("[NULL]", null);
You can choose to use a fail-fast replacement to ensure that all placeholders are actually set and no one is missing in the replacement map. If one is missing the replacement will fail immediately throwing an exception. (Note that the default behaviour is to leave the non-replaced placeholder there and proceeding work silently): replacementDataSet.setStrictReplacement(true);
|
DatabaseOperation
DatabaseOperation is an abstract class that represents an operation performed on the database before and after each test.
The two most usefull operations are REFRESH and CLEAN_INSERT. They are the ones you will deal usualy with. They represent two testing strategies with different benefits and tradeoffs.
DatabaseOperation.UPDATE | This operation updates the database from the dataset contents. This operation assumes that table data already exists in the target database and fails if this is not the case. |
DatabaseOperation.INSERT | This operation inserts the dataset contents into the database. This operation assumes that table data does not exist in the target database and fails if this is not the case. To prevent problems with foreign keys, tables must be sequenced appropriately in the dataset. |
DatabaseOperation.DELETE | This operation deletes only the dataset contents from the database. This operation does not delete the entire table contents but only data that are present in the dataset. |
DatabaseOperation.DELETE_ALL | Deletes all rows of tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence. |
DatabaseOperation.TRUNCATE | Truncate tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence. |
DatabaseOperation.REFRESH | This operation literally refreshes dataset contents into the target database. This means that data of existing rows are updated and non-existing row get inserted. Any rows which exist in the database but not in dataset stay unaffected. This approach is more appropriate for tests that assume other data may exist in the database. if they are correctly written, tests using this strategy can even be performed on a populated database like a copy of a production database. |
DatabaseOperation.CLEAN_INSERT | This composite operation performs a DELETE_ALL operation followed by an INSERT operation. This is the safest approach to ensure that the database is in a known state. This is appropriate for tests that require the database to only contain a specific set of data. |
DatabaseOperation.NONE | Empty operation that does absolutely nothing. |
CompositeOperation | This operation combines multiple operations into a single one. |
TransactionOperation | This operation decorates an operation and executes it within the context of a transaction. |
IdentityInsertOperation | This operation decorates an insert operation and disables the MS SQL Server automatic identifier generation (IDENTITY) during its execution. Use following constants InsertIdentityOperation.INSERT, InsertIdentityOperation.CLEAN_INSERT or InsertIdentityOperation.REFRESH instead of those defined in DatabaseOperation. |
相关推荐
毕业论文- 深蓝健身房瑜伽馆行业小程序V4.15.0 前端+后端-整站商业源码.zip
36氪:2019中国开放式创新观察.pdf
毕业论文-化妆品商城-整站商业源码.zip
毕业论文-MNews2.4-整站商业源码.zip
X-AnyLabeling自动标注模型
【鼎软天下】科技赋能物流,数字驱动变革.pdf
实训商业源码-王中王掌上游戏机网页源码,怀旧小游戏-毕业设计.zip
内容概要:本文提出了一种基于强化学习(RL)的前向纠错(FEC)调整方法——R-FEC,旨在优化WebRTC视频会议中的用户体验质量(QoE)。传统方法在确定适当的FEC比例时面临挑战,因为过高的FEC会增加延迟并降低视频质量,而过低则无法有效应对丢包。R-FEC通过RL算法动态调整视频和FEC比特率,在不同的网络条件下最大化QoE,同时最小化网络拥塞。实验表明,R-FEC相比现有最佳解决方案可提高视频速率达27%,并改善视频质量6dB。 适合人群:对视频会议系统优化、网络通信协议、机器学习特别是强化学习有兴趣的研究人员和技术人员。 使用场景及目标:①需要在视频会议中实现实时通信的应用开发者;②希望提升视频通话质量、减少延迟的技术团队;③研究如何在动态网络环境中优化数据传输的研究机构。 其他说明:R-FEC不仅解决了现有方法中FEC设置不合理的问题,还展示了在实际网络环境下显著优于其他方法的表现。此外,作者指出未来工作将扩展到多方通话场景,并考虑更多复杂的网络条件。该研究得到了Cisco Systems和韩国国家研究基金会的支持。
内容概要:本文介绍了流量整形(Traffic Shaping)与增强传输选择(Enhanced Transmission Selection, ETS)技术在多虚拟函数(VFs)共享单个物理网络接口控制器(NIC)端口情况下的应用。流量整形通过对数据发送速率进行限制来管理网络流量,确保节点不会超过设定的最大带宽,同时保证最小带宽。ETS是IEEE 802.1Qaz标准的一部分,旨在数据中心桥接环境中为不同类型的流量分配带宽。文章详细描述了在多VF组中实现每类流量带宽保证的技术挑战和解决方案,包括使用令牌桶算法、加权循环调度(DWRR)、多队列优先级(MQPRIO)以及信任模式(Trust Mode)进行流量分类。此外,还探讨了如何通过扩展devlink-rate工具指定每个流量类别的带宽比例。 适合人群:网络工程师、系统管理员、云服务提供商以及对网络流量管理和优化感兴趣的IT专业人员。 使用场景及目标:①理解流量整形的基本概念及其在网络通信中的作用;②掌握如何配置虚拟功能(VF)以实现对特定流量类别的带宽控制;③学习如何利用ETS机制确保关键业务获得足够的网络资源;④了解最新的devlink-rate扩展功能及其在实际部署中的应用。 其他说明:本文基于Netdev 0x19会议上的演讲整理而成,提供了从背景介绍到具体实施步骤的全面讲解,并附有详细的参考资料链接供进一步研究。
实训商业源码-自适应极简多引擎搜索源码-毕业设计.zip
该源码库为LilyGo T_QT开发板量身定制,专注于物联网通信功能,包含1792个文件,涵盖512个头文件、448个C语言源文件、213个Arduino脚本文件、151个Python脚本、139个Markdown文档、63个PNG图片文件、55个reStructuredText文件、38个Vera Lite Widget文件、18个文本文件、18个C++源文件。语言多样,支持C、C++、Python、C++、Shell、HTML、CSS和Ruby。库内容丰富,是进行物联网通信开发不可或缺的资源。
学生心理健康服务平台是一个集心理咨询、心理测评、资源共享和社区互动于一体的综合服务平台,包含Web/移动端应用和管理后台两部分。该项目旨在为高校学生提供便捷、专业的心理健康服务,帮助学生缓解心理压力,促进心理健康发展。
毕业论文-二次元应用下载页源码 带弹幕-整站商业源码.zip
实训商业源码-影视资源站源码 电脑+手机模板-毕业设计.zip
Baidunetdisk_AndroidPhone_1023843j (6).apk
《Creo Simulation Live》数据表.pdf
实训商业源码-源授权V1.5-毕业设计.zip
实训商业源码-微信淘宝客5.99.78 加密-毕业设计.zip
毕业论文-红包拓客生意宝 2.0.2-整站商业源码.zip
ABB制造执行系统-MES,助力中国智能制造2025.pdf