repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class InsertTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/ContentGuessingDataSetLoaderTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
/**
* @author Rafael Pestano
*/
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ContentGuessingDataSetLoaderTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/ContentGuessingDataSetLoaderTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
/**
* @author Rafael Pestano
*/
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ContentGuessingDataSetLoaderTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/ContentGuessingDataSetLoaderTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
/**
* @author Rafael Pestano
*/
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ContentGuessingDataSetLoaderTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/ContentGuessingDataSetLoaderTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
/**
* @author Rafael Pestano
*/
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ContentGuessingDataSetLoaderTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.yml", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.REFRESH) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ExpectedNonStrictOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnMethodTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ExpectedNonStrictOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ExpectedNonStrictOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnMethodTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class ExpectedNonStrictOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) | @ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
@ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
public class ExpectedNonStrictUnorderedOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
@ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
public class ExpectedNonStrictUnorderedOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteAllSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteAllSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteAllSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteAllSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/InsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/operation/MicrosoftSqlDatabaseOperationLookupTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
| import static org.junit.Assert.assertSame;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import org.dbunit.ext.mssql.InsertIdentityOperation;
import org.junit.Test; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.operation;
/**
* Tests for {@link MicrosoftSqlDatabaseOperationLookup}.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
public class MicrosoftSqlDatabaseOperationLookupTest {
@Test
public void shouldLookup() throws Exception {
DefaultDatabaseOperationLookup lookup = new MicrosoftSqlDatabaseOperationLookup(); | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/operation/MicrosoftSqlDatabaseOperationLookupTest.java
import static org.junit.Assert.assertSame;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import org.dbunit.ext.mssql.InsertIdentityOperation;
import org.junit.Test;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.operation;
/**
* Tests for {@link MicrosoftSqlDatabaseOperationLookup}.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
public class MicrosoftSqlDatabaseOperationLookupTest {
@Test
public void shouldLookup() throws Exception {
DefaultDatabaseOperationLookup lookup = new MicrosoftSqlDatabaseOperationLookup(); | assertSame(org.dbunit.operation.DatabaseOperation.UPDATE, lookup.get(DatabaseOperation.UPDATE)); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../update-db.xml", type = DatabaseOperation.UPDATE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../update-db.xml", type = DatabaseOperation.UPDATE)
public class UpdateSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../update-db.xml", type = DatabaseOperation.UPDATE)
public class UpdateSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL)
public class DeleteAllSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteAllSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL)
public class DeleteAllSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertSetupOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category"));
}
@Test
public void testAgain() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category")); | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertSetupOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category"));
}
@Test
public void testAgain() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category")); | InventoryCategory category = inventoryRepository.findByName("default_category"); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnClassTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedNonStrictOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictOnClassTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedNonStrictOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class TruncateTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class MixedTearDownOnClassAndMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class MixedTearDownOnClassAndMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class MixedTearDownOnClassAndMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../extra_category_with_items.xml", type = DatabaseOperation.INSERT)
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MixedTearDownOnClassAndMethodTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class MixedTearDownOnClassAndMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../extra_category_with_items.xml", type = DatabaseOperation.INSERT)
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../refresh-db.xml", type = DatabaseOperation.REFRESH) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../refresh-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../refresh-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../refresh-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/RefreshTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../refresh-db.xml", type = DatabaseOperation.REFRESH)
public class RefreshTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category"));
}
@Test
@DatabaseSetup(value = {"../setup-db.xml","../extra_category_with_items.xml"}, type = DatabaseOperation.CLEAN_INSERT)
public void testAgain() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category", "extra_category")); | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class CleanInsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category"));
}
@Test
@DatabaseSetup(value = {"../setup-db.xml","../extra_category_with_items.xml"}, type = DatabaseOperation.CLEAN_INSERT)
public void testAgain() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("default_category", "extra_category")); | InventoryCategory category = inventoryRepository.findByName("default_category"); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassJsonTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/JsonDataSetLoader.java
// public class JsonDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new JsonDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.JsonDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = JsonDataSetLoader.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/JsonDataSetLoader.java
// public class JsonDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new JsonDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassJsonTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.JsonDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = JsonDataSetLoader.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.json", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DatabaseTest
public class ExpectedFailureOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DatabaseTest
public class ExpectedFailureOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DatabaseTest
public class ExpectedFailureOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DatabaseTest
public class ExpectedFailureOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @ExpectedDatabase(value = "../expected_fail.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
| import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/ | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java
import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/ | Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
| import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/ | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java
import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/ | Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
| import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/
Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class;
/**
* Returns the class that will be used to lookup DBUnit database operations. The specific class must implement
* {@link DatabaseOperationLookup} and must have a default constructor.
* @return the database operation lookup
*/ | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java
import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/
Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class;
/**
* Returns the class that will be used to lookup DBUnit database operations. The specific class must implement
* {@link DatabaseOperationLookup} and must have a default constructor.
* @return the database operation lookup
*/ | Class<? extends DatabaseOperationLookup> databaseOperationLookup() default DefaultDatabaseOperationLookup.class; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
| import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/
Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class;
/**
* Returns the class that will be used to lookup DBUnit database operations. The specific class must implement
* {@link DatabaseOperationLookup} and must have a default constructor.
* @return the database operation lookup
*/ | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/DataSetLoader.java
// public interface DataSetLoader {
//
// /**
// * Loads and returns {@link IDataSet dataset} for the specified class and location.
// * If the dataset cannot be found <tt>null</tt> may be returned.
// *
// * @param testClass The class under test
// * @param location The location to load
// * @return a {@link IDataSet dataset} or <tt>null</tt>
// * @throws Exception If the {@link IDataSet dataset} cannot be loaded
// */
// IDataSet loadDataSet(Class<?> testClass, String location) throws Exception;
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ContentGuessingDatasetLoader.java
// public class ContentGuessingDatasetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// String uri = resourceUrl.toString();
// String extension = uri.substring(uri.lastIndexOf(".")+1).toLowerCase();
// IDataSet iDataSet = null;
// switch (extension) {
// case "xml": {
// iDataSet = new FlatXmlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "yml": {
// iDataSet = new YamlDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// case "json": {
// iDataSet = new JsonDataSetLoader().createDataSet(resourceUrl);
// break;
// }
// default: {
// throw new RuntimeException(String.format("Dataset format %s not supported",extension));
// }
// }
// return iDataSet;
//
// }
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DatabaseOperationLookup.java
// public interface DatabaseOperationLookup {
//
// /**
// * Returns the DBUnit {@link org.dbunit.operation.DatabaseOperation Database Operation} that should
// * be used for the specified internal operation or {@code null} if the operation is not supported.
// *
// * @param operation the enum value
// * @return the DBUnit databsae operation or {@code null}.
// */
// org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation);
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/operation/DefaultDatabaseOperationLookup.java
// public class DefaultDatabaseOperationLookup implements DatabaseOperationLookup {
//
// private static Map<DatabaseOperation, org.dbunit.operation.DatabaseOperation> OPERATION_LOOKUP;
// static {
// OPERATION_LOOKUP = new HashMap<>();
// OPERATION_LOOKUP.put(DatabaseOperation.UPDATE, org.dbunit.operation.DatabaseOperation.UPDATE);
// OPERATION_LOOKUP.put(DatabaseOperation.INSERT, org.dbunit.operation.DatabaseOperation.INSERT);
// OPERATION_LOOKUP.put(DatabaseOperation.REFRESH, org.dbunit.operation.DatabaseOperation.REFRESH);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE, org.dbunit.operation.DatabaseOperation.DELETE);
// OPERATION_LOOKUP.put(DatabaseOperation.DELETE_ALL, org.dbunit.operation.DatabaseOperation.DELETE_ALL);
// OPERATION_LOOKUP.put(DatabaseOperation.TRUNCATE_TABLE, org.dbunit.operation.DatabaseOperation.TRUNCATE_TABLE);
// OPERATION_LOOKUP.put(DatabaseOperation.CLEAN_INSERT, org.dbunit.operation.DatabaseOperation.CLEAN_INSERT);
// }
//
// public org.dbunit.operation.DatabaseOperation get(DatabaseOperation operation) {
// return OPERATION_LOOKUP.get(operation);
// }
//
// }
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DbUnitConfiguration.java
import com.github.deltaspikedbunit.dataset.DataSetLoader;
import com.github.deltaspikedbunit.dataset.ContentGuessingDatasetLoader;
import com.github.deltaspikedbunit.operation.DatabaseOperationLookup;
import com.github.deltaspikedbunit.operation.DefaultDatabaseOperationLookup;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.dbunit.dataset.IDataSet;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.annotation;
/**
* Configures a test run.
*
* @author Luigi Bitonti
* @author Phillip Webb
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DbUnitConfiguration {
/**
* Returns the class that will be used to load {@link IDataSet} resources. The specified class must implement
* {@link DataSetLoader} and must have a default constructor.
* @return the data set loader class
*/
Class<? extends DataSetLoader> dataSetLoader() default ContentGuessingDatasetLoader.class;
/**
* Returns the class that will be used to lookup DBUnit database operations. The specific class must implement
* {@link DatabaseOperationLookup} and must have a default constructor.
* @return the database operation lookup
*/ | Class<? extends DatabaseOperationLookup> databaseOperationLookup() default DefaultDatabaseOperationLookup.class; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedQueryWithModifierOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ReplacementDataSetModifier.java
// public abstract class ReplacementDataSetModifier implements DataSetModifier {
//
// public IDataSet modify(IDataSet dataSet) {
// if (!(dataSet instanceof ReplacementDataSet)) {
// dataSet = new ReplacementDataSet(dataSet);
// }
// addReplacements((ReplacementDataSet) dataSet);
// return dataSet;
// }
//
// protected abstract void addReplacements(ReplacementDataSet dataSet);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.dataset.ReplacementDataSetModifier;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.dbunit.dataset.ReplacementDataSet;
import org.junit.Test;
import org.junit.runner.RunWith; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(modifiers = ExpectedQueryWithModifierOnMethodTest.OuterModifier.class)
public class ExpectedQueryWithModifierOnMethodTest {
@Test
@ExpectedDatabase(value = "../expected_query_modified.xml", modifiers = InnerModifier.class,
query = "select * from inventory_item where id in (1900,1901)", table = "inventory_item")
public void test() throws Exception {
}
| // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/ReplacementDataSetModifier.java
// public abstract class ReplacementDataSetModifier implements DataSetModifier {
//
// public IDataSet modify(IDataSet dataSet) {
// if (!(dataSet instanceof ReplacementDataSet)) {
// dataSet = new ReplacementDataSet(dataSet);
// }
// addReplacements((ReplacementDataSet) dataSet);
// return dataSet;
// }
//
// protected abstract void addReplacements(ReplacementDataSet dataSet);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedQueryWithModifierOnMethodTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.dataset.ReplacementDataSetModifier;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.dbunit.dataset.ReplacementDataSet;
import org.junit.Test;
import org.junit.runner.RunWith;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(modifiers = ExpectedQueryWithModifierOnMethodTest.OuterModifier.class)
public class ExpectedQueryWithModifierOnMethodTest {
@Test
@ExpectedDatabase(value = "../expected_query_modified.xml", modifiers = InnerModifier.class,
query = "select * from inventory_item where id in (1900,1901)", table = "inventory_item")
public void test() throws Exception {
}
| private class InnerModifier extends ReplacementDataSetModifier { |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
// this should not be reached because of the override (otherwise it should fail) | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
// this should not be reached because of the override (otherwise it should fail) | @ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
// this should not be reached because of the override (otherwise it should fail)
@ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedOnClassAndMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
// this should not be reached because of the override (otherwise it should fail)
@ExpectedDatabase(value = "../expected_nonstrict.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedOnClassAndMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class ExpectedNonStrictUnorderedOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class ExpectedNonStrictUnorderedOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class ExpectedNonStrictUnorderedOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedNonStrictUnorderedOnMethodTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class ExpectedNonStrictUnorderedOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodYamlTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest
public class CleanInsertSetupOnMethodYamlTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodYamlTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest
public class CleanInsertSetupOnMethodYamlTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"}, | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"}, | type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"},
type = DatabaseOperation.INSERT)
public class MultipleInsertTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"},
type = DatabaseOperation.INSERT)
public class MultipleInsertTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"},
type = DatabaseOperation.INSERT)
public class MultipleInsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/MultipleInsertTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = {"../setup-db.xml", "../extra_category_with_items.xml"},
type = DatabaseOperation.INSERT)
public class MultipleInsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
public class InsertSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class) | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class) | @DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest | @ExpectedDatabase(value = "../expected_fail.yml", assertionMode = DatabaseAssertionMode.NON_STRICT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_fail.yml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedFailureOnClassYmlTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedFailureOnClassYmlTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import com.github.deltaspikedbunit.testutils.ExpectedFailure;
import junit.framework.ComparisonFailure;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@ExpectedFailure(failure = ComparisonFailure.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_fail.yml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public class ExpectedFailureOnClassYmlTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class RefreshSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class RefreshSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class RefreshSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/RefreshSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class RefreshSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.REFRESH) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class UpdateSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class UpdateSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class UpdateSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/UpdateSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class UpdateSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../update-db.xml", type = DatabaseOperation.UPDATE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/TruncateTearDownOnClassTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/DeleteSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class DeleteSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.DELETE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodJsonTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/JsonDataSetLoader.java
// public class JsonDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new JsonDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.JsonDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = JsonDataSetLoader.class)
@DatabaseTest
public class CleanInsertSetupOnMethodJsonTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/JsonDataSetLoader.java
// public class JsonDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new JsonDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnMethodJsonTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.JsonDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = JsonDataSetLoader.class)
@DatabaseTest
public class CleanInsertSetupOnMethodJsonTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("existing_category"));
}
@After
public void afterTest() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/CleanInsertTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.CLEAN_INSERT)
public class CleanInsertTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("existing_category"));
}
@After
public void afterTest() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateSetupOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateSetupOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateSetupOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("existing_category")); | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/TruncateSetupOnClassTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../truncate-db.xml", type = DatabaseOperation.TRUNCATE_TABLE)
public class TruncateSetupOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception {
List<String> names = inventoryRepository.findAllNames();
assertThat(names, contains("existing_category")); | InventoryCategory category = inventoryRepository.findByName("existing_category"); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL)
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteAllTearDownOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
public class DeleteAllTearDownOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE_ALL)
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) | @ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
@ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
public class ExpectedOnClassAndMethodWithoutOverrideTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedOnClassAndMethodWithoutOverrideTest.java
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT)
@ExpectedDatabase(value = "../expected_nonstrict_unordered.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
public class ExpectedOnClassAndMethodWithoutOverrideTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest | @DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public class DeleteTearDownOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public class DeleteTearDownOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public class DeleteTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/teardown/DeleteTearDownOnClassTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseTearDown;
import com.github.deltaspikedbunit.deltaspike.DatabaseNoRollbackTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.teardown;
@RunWith(CdiTestRunner.class)
@DatabaseNoRollbackTest
@DatabaseTearDown(value = "../setup-db.xml", type = DatabaseOperation.DELETE)
public class DeleteTearDownOnClassTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test
public void test() throws Exception { | List<InventoryCategory> categories = inventoryRepository.findAll(); |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/MixedSetupOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml")
public class MixedSetupOnClassAndMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/MixedSetupOnClassAndMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml")
public class MixedSetupOnClassAndMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/MixedSetupOnClassAndMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml")
public class MixedSetupOnClassAndMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/MixedSetupOnClassAndMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@DatabaseSetup(value = "../setup-db.xml")
public class MixedSetupOnClassAndMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../extra_category_with_items.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassYamlTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/dataset/YamlDataSetLoader.java
// public class YamlDataSetLoader extends AbstractDataSetLoader {
//
// @Override
// protected IDataSet createDataSet(URL resourceUrl) throws Exception {
// return new YamlDataSet(resourceUrl.openStream());
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/entity/InventoryCategory.java
// @Entity
// @Table(name = "inventory_category")
// public class InventoryCategory {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private int id;
// @Version
// @Column(name = "version")
// private int version;
// @Column(name = "category_name", nullable = false, unique = true)
// private String categoryName;
// @Column(name = "category_description")
// private String categoryDescription;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
// private Set<InventoryItem> items = new HashSet<>();
//
//
// public InventoryCategory() {
// }
//
// public InventoryCategory(String categoryName, String categoryDescription) {
// this.categoryName = categoryName;
// this.categoryDescription = categoryDescription;
// }
//
//
// public String getCategoryName() {
// return categoryName;
// }
// public void setCategoryName(String name) {
// this.categoryName = name;
// }
//
// public String getCategoryDescription() {
// return categoryDescription;
// }
// public void setCategoryDescription(String description) {
// this.categoryDescription = description;
// }
//
// int getVersion() {
// return version;
// }
// void setVersion(int version) {
// this.version = version;
// }
//
// public int getId() {
// return id;
// }
// void setId(int id) {
// this.id = id;
// }
//
// public Set<InventoryItem> getItems() {
// return items;
// }
// void setItems(Set<InventoryItem> items) {
// this.items = items;
// }
//
// public void addItem(InventoryItem item) {
// if (item != null) {
// this.items.add(item);
// item.setCategory(this);
// }
// }
//
// public void addItems(InventoryItem... items) {
// if (items != null) {
// for (InventoryItem ii : items) {
// addItem(ii);
// }
// }
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/CleanInsertSetupOnClassYamlTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.annotation.DbUnitConfiguration;
import com.github.deltaspikedbunit.dataset.YamlDataSetLoader;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.entity.InventoryCategory;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DbUnitConfiguration(dataSetLoader = YamlDataSetLoader.class)
@DatabaseTest | @DatabaseSetup(value = "../setup-db.yml", type = DatabaseOperation.CLEAN_INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class InsertSetupOnMethodTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class InsertSetupOnMethodTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnMethodTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class InsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/annotation/DatabaseOperation.java
// public enum DatabaseOperation {
//
// /**
// * Updates the contents of existing database tables from the dataset.
// */
// UPDATE,
//
// /**
// * Inserts new database tables and contents from the dataset.
// */
// INSERT,
//
// /**
// * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
// * database rows that are not in the dataset remain unaffected.
// */
// REFRESH,
//
// /**
// * Deletes database table rows that match rows from the dataset.
// */
// DELETE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset remain unaffected.
// * @see #TRUNCATE_TABLE
// */
// DELETE_ALL,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
// * in the dataset are unaffected. Identical to {@link #DELETE_ALL} except this operation cannot be rolled back and
// * is supported by less database vendors.
// * @see #DELETE_ALL
// */
// TRUNCATE_TABLE,
//
// /**
// * Deletes all rows from a database table when the table is specified in the dataset and subsequently insert new
// * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
// */
// CLEAN_INSERT
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/setup/InsertSetupOnMethodTest.java
import com.github.deltaspikedbunit.annotation.DatabaseOperation;
import com.github.deltaspikedbunit.annotation.DatabaseSetup;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.setup;
@RunWith(CdiTestRunner.class)
@DatabaseTest
public class InsertSetupOnMethodTest {
@Inject
private InventoryCategoryRepository inventoryRepository;
@Test | @DatabaseSetup(value = "../setup-db.xml", type = DatabaseOperation.INSERT) |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedTableNonStrictOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml", | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedTableNonStrictOnClassTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml", | assertionMode = DatabaseAssertionMode.NON_STRICT, table = "inventory_category") |
lbitonti/deltaspike-dbunit | deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedTableNonStrictOnClassTest.java | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
| import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; | /*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml",
assertionMode = DatabaseAssertionMode.NON_STRICT, table = "inventory_category")
public class ExpectedTableNonStrictOnClassTest {
@Inject | // Path: deltaspike-dbunit/src/main/java/com/github/deltaspikedbunit/assertion/DatabaseAssertionMode.java
// public enum DatabaseAssertionMode {
//
// /**
// * Default DbUnit data sets assertions (i.e. checks all columns and their order).
// */
// DEFAULT(new DefaultDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set. Unspecified tables and columns are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order must match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT(new NonStrictDatabaseAssertion()),
//
// /**
// * Allows specifying only specific columns and tables in expected data set and ignoring row orders in expected and
// * actual data set. Unspecified tables and columns are ignored. Row orders in expected and actual data sets are
// * ignored.
// * <p>
// * <strong>Notes:</strong>
// * <ul>
// * <li>Expected row order does not need to match order in actual data set.</li>
// * <li>Specified columns must match in all rows, e.g. specifying 'column1' value without 'column2' value in one row
// * and only 'column2' value in another is not allowed - both 'column1' and 'column2' values must be specified in all
// * rows.</li>
// * </ul>
// */
// NON_STRICT_UNORDERED(new NonStrictUnorderedDatabaseAssertion());
//
//
// private DatabaseAssertion databaseAssertion;
//
// DatabaseAssertionMode(DatabaseAssertion databaseAssertion) {
// this.databaseAssertion = databaseAssertion;
// }
//
//
// public DatabaseAssertion getDatabaseAssertion() {
// return this.databaseAssertion;
// }
//
// }
//
// Path: deltaspike-dbunit-sample/src/main/java/com/github/deltaspikedbunit/sample/inventory/repository/InventoryCategoryRepository.java
// @Repository
// public abstract class InventoryCategoryRepository extends AbstractEntityRepository<InventoryCategory, Integer> {
//
// @Query(value = "select ic from InventoryCategory ic where ic.categoryName = :categoryName",
// singleResult = SingleResultType.OPTIONAL)
// public abstract InventoryCategory findByName(@QueryParam("categoryName") String categoryName);
//
// }
// Path: deltaspike-dbunit/src/test/java/com/github/deltaspikedbunit/expected/ExpectedTableNonStrictOnClassTest.java
import com.github.deltaspikedbunit.annotation.ExpectedDatabase;
import com.github.deltaspikedbunit.assertion.DatabaseAssertionMode;
import com.github.deltaspikedbunit.deltaspike.DatabaseTest;
import com.github.deltaspikedbunit.sample.inventory.repository.InventoryCategoryRepository;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
/*
* Copyright 2002-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.deltaspikedbunit.expected;
@RunWith(CdiTestRunner.class)
@DatabaseTest
@ExpectedDatabase(value = "../expected_nonstrict.xml",
assertionMode = DatabaseAssertionMode.NON_STRICT, table = "inventory_category")
public class ExpectedTableNonStrictOnClassTest {
@Inject | private InventoryCategoryRepository inventoryRepository; |
SOM-Research/EMFtoCSP | plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct; | /*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution; | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java
import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct;
/*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution; | protected IModelReader<R, P, C, AS, AT, OP> modelReader; |
SOM-Research/EMFtoCSP | plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct; | /*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution;
protected IModelReader<R, P, C, AS, AT, OP> modelReader; | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java
import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct;
/*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution;
protected IModelReader<R, P, C, AS, AT, OP> modelReader; | protected List<AssocStruct> assocStructures; |
SOM-Research/EMFtoCSP | plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct; | /*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution;
protected IModelReader<R, P, C, AS, AT, OP> modelReader;
protected List<AssocStruct> assocStructures; | // Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelBuilder.java
// public interface IModelBuilder <R, P, C, AS, AT, OP,ST> {
//
// boolean isAssoc(String s);
// void generateInstance(String path);
// void decorticateResult();
// void setSolution(ST solution);
// boolean solutionIsEmpty();
//
//
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/IModelReader.java
// public interface IModelReader<R, P, C, AS, AT, OP> {
//
// public R getModelResource();
//
// public List<P> getPackages();
//
// public List<C> getClasses();
//
// public List<String> getClassesNames();
//
// public List<AT> getClassAttributes(C c);
//
// public List<OP> getClassOperations(C c);
//
// public List<C> getClassSubtypes(List<C> classList, C c);
//
// public void getClassSubtypes(List<C> cList, C c, List<C> subTypes);
//
// public C getBaseClass(C c);
//
// public List<AS> getAssociations();
//
// public List<String> getAssociationsNames();
//
// public String getAssociationName(AS as);
//
// public String getAssociationEndName(AT asEnd);
//
// public List<String> getAssociationNamesOfNonAbsClasses();
//
// public R getResource();
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/AssocStruct.java
// public class AssocStruct extends Struct {
//
// public AssocStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// srcOid=(Integer) cp.arg(1);
// trgOid=(Integer) cp.arg(2);
// }
// private int srcOid;
// private int trgOid;
// @Override
// public String toString() {
// return "AssocStruct [srcOid=" + srcOid + ", trgOid=" + trgOid + "]";
// }
// public int getSrcOid() {
// return srcOid;
// }
// public void setSrcOid(int srcOid) {
// this.srcOid = srcOid;
// }
// public int getTrgOid() {
// return trgOid;
// }
// public void setTrgOid(int trgOid) {
// this.trgOid = trgOid;
// }
//
//
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/ObjectStruct.java
// public class ObjectStruct extends Struct {
//
// private List<Field> fields;
//
// public List<Field> getFields() {
// return fields;
// }
//
//
// public void setFields(List<Field> fields) {
// this.fields = fields;
// }
//
//
// public ObjectStruct(CompoundTerm cp, String functor) {
// super(functor);
// // TODO Auto-generated constructor stub
// fields = new LinkedList<Field>();
// for (int i=1; i<= cp.arity(); i++)
// fields.add(new Field(cp.arg(i),i));
// }
//
//
// public int getOid(){
// return (Integer) fields.get(0).getValue() ;
//
// }
// @Override
// public String toString() {
// return "ObjectStruct [fields=" + fields + "]";
// }
// }
//
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/modelbuilder/Struct.java
// public class Struct {
//
// public Struct(String functor) {
// name=functor;
// }
// private String name;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/impl/ModelBuilder.java
import java.util.List;
import javax.annotation.Generated;
import org.eclipse.core.resources.IFolder;
import fr.inria.atlanmod.emftocsp.IModelBuilder;
import fr.inria.atlanmod.emftocsp.IModelReader;
import fr.inria.atlanmod.emftocsp.modelbuilder.AssocStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.ObjectStruct;
import fr.inria.atlanmod.emftocsp.modelbuilder.Struct;
/*******************************************************************************
* Copyright (c) 2013 INRIA Rennes Bretagne-Atlantique.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* INRIA Rennes Bretagne-Atlantique - initial API and implementation
*******************************************************************************/
package fr.inria.atlanmod.emftocsp.impl;
/**
* @author <a href="mailto:amine.benelallam@inria.fr">Amine Benelallam</a>
*
*/
public abstract class ModelBuilder<R, P, C, AS, AT, OP,ST> implements IModelBuilder<R, P, C, AS, AT, OP,ST> {
protected ST solution;
protected IModelReader<R, P, C, AS, AT, OP> modelReader;
protected List<AssocStruct> assocStructures; | protected List<ObjectStruct> objectStructures; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.