@Before @Override /** * Create component, store and application and start server * * @throws java.lang.Exception */ public void setUp() throws Exception { if (this.component == null) { this.component = new Component(); this.component.getServers().add(Protocol.HTTP, getTestPort()); this.component.getClients().add(Protocol.HTTP); this.component.getClients().add(Protocol.FILE); this.component.getClients().add(Protocol.CLAP); // Context Context ctx = this.component.getContext().createChildContext(); ctx.getAttributes().put(ContextAttributes.SETTINGS, SitoolsSettings.getInstance()); if (store == null) { File storeDirectory = new File(getTestRepository() + "/map"); storeDirectory.mkdirs(); cleanDirectory(storeDirectory); cleanMapDirectories(storeDirectory); store = new DataSetStoreXMLMap(storeDirectory, ctx); } ctx.getAttributes().put(ContextAttributes.APP_STORE, store); Map<String, Object> stores = new ConcurrentHashMap<String, Object>(); stores.put(Consts.APP_STORE_DATASET, store); SitoolsSettings.getInstance().setStores(stores); // Create dataset Resource res = new Resource(); res.setId(dataSourceId); res.setType("datasource"); res.setMediaType("datasource"); DataSet dataset = new DataSet(); dataset.setId("DATASET_FOR_TESTS"); dataset.setName("DATASET_FOR_TESTS"); dataset.setDescription("dataset for tests"); // dataset.addColumn(new Column()); dataset.setDatasource(res); dataset.setSitoolsAttachementForUsers("/sitools/DATASET_FOR_TESTS"); store.create(dataset); this.component .getDefaultHost() .attach(getAttachUrl(), new DataSetAdministration(this.component.getDefaultHost(), ctx)); } if (!this.component.isStarted()) { this.component.start(); } }