use of org.eclipse.sw360.datahandler.db.ComponentSearchHandler in project sw360portal by sw360.
the class ComponentSearchHandlerTest method setUp.
@Before
public void setUp() throws Exception {
assumeCanConnectTo(ThriftClients.BACKEND_URL + "/couchdblucene/");
components = new ArrayList<>();
Component component1 = new Component().setId("C1").setName("component1").setDescription("d1").setCreatedBy(email1);
component1.addToLanguages("C");
component1.addToCategories("library");
component1.addToOperatingSystems("linux");
component1.addToSoftwarePlatforms("boost");
component1.addToReleaseIds("R1A");
component1.addToReleaseIds("R1B");
component1.addToVendorNames("V1");
components.add(component1);
Component component2 = new Component().setId("C2").setName("component2").setDescription("d2").setCreatedBy(email2);
component2.addToLanguages("D");
component2.addToLanguages("C");
component2.addToCategories("test");
component2.addToOperatingSystems("test");
component2.addToSoftwarePlatforms("test");
component2.addToReleaseIds("R2A");
component2.addToReleaseIds("R2B");
component2.addToReleaseIds("R2C");
component1.addToVendorNames("V2");
components.add(component2);
Component component3 = new Component().setId("C3").setName("component3").setDescription("d3").setCreatedBy(email1);
component3.addToSubscribers(email1);
component3.addToLanguages("E");
components.add(component3);
// Create the database
TestUtils.createDatabase(DatabaseSettings.getConfiguredHttpClient(), dbName);
// Prepare the database
DatabaseConnector databaseConnector = new DatabaseConnector(DatabaseSettings.getConfiguredHttpClient(), dbName);
for (Component component : components) {
databaseConnector.add(component);
}
// Prepare the handler
searchHandler = new ComponentSearchHandler(DatabaseSettings.getConfiguredHttpClient(), dbName);
}
Aggregations