Skip to content

Commit e70143c

Browse files
committed
maven: Fix developer/pom.xml to use DatabaseCreator
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 03a3837 commit e70143c

1 file changed

Lines changed: 57 additions & 267 deletions

File tree

developer/pom.xml

Lines changed: 57 additions & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -90,200 +90,6 @@
9090
</executions>
9191
</plugin>
9292

93-
<!-- Database recreator -->
94-
<plugin>
95-
<groupId>org.codehaus.mojo</groupId>
96-
<artifactId>sql-maven-plugin</artifactId>
97-
<version>1.5</version>
98-
<dependencies>
99-
<!-- specify the dependent jdbc driver here -->
100-
<dependency>
101-
<groupId>mysql</groupId>
102-
<artifactId>mysql-connector-java</artifactId>
103-
<version>${cs.mysql.version}</version>
104-
</dependency>
105-
</dependencies>
106-
<configuration>
107-
<driver>org.gjt.mm.mysql.Driver</driver>
108-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
109-
<username>${db.cloud.username}</username>
110-
<password>${db.cloud.password}</password>
111-
<!--all executions are ignored if -Dmaven.test.skip=true -->
112-
<skip>${maven.test.skip}</skip>
113-
<forceMojoExecution>true</forceMojoExecution>
114-
</configuration>
115-
<executions>
116-
<execution>
117-
<id>drop-database</id>
118-
<phase>process-test-resources</phase>
119-
<goals>
120-
<goal>execute</goal>
121-
</goals>
122-
<configuration>
123-
<username>root</username>
124-
<password>${db.root.password}</password>
125-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
126-
<sqlCommand>drop database if exists `cloud`</sqlCommand>
127-
</configuration>
128-
</execution>
129-
<execution>
130-
<id>create-database</id>
131-
<phase>process-test-resources</phase>
132-
<goals>
133-
<goal>execute</goal>
134-
</goals>
135-
<configuration>
136-
<username>root</username>
137-
<password>${db.root.password}</password>
138-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
139-
<sqlCommand>create database `cloud`</sqlCommand>
140-
</configuration>
141-
</execution>
142-
<execution>
143-
<id>grant-user-cloud</id>
144-
<phase>process-test-resources</phase>
145-
<goals>
146-
<goal>execute</goal>
147-
</goals>
148-
<configuration>
149-
<username>root</username>
150-
<password>${db.root.password}</password>
151-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
152-
<sqlCommand>GRANT ALL ON cloud.* to
153-
${db.cloud.username}@`localhost` identified by
154-
'${db.cloud.password}';</sqlCommand>
155-
</configuration>
156-
</execution>
157-
<execution>
158-
<id>grant-user-cloud-all</id>
159-
<phase>process-test-resources</phase>
160-
<goals>
161-
<goal>execute</goal>
162-
</goals>
163-
<configuration>
164-
<username>root</username>
165-
<password>${db.root.password}</password>
166-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
167-
<sqlCommand>GRANT ALL ON cloud.* to
168-
${db.cloud.username}@`%` identified by
169-
'${db.cloud.password}';</sqlCommand>
170-
</configuration>
171-
</execution>
172-
<execution>
173-
<id>drop-database-usage</id>
174-
<phase>process-test-resources</phase>
175-
<goals>
176-
<goal>execute</goal>
177-
</goals>
178-
<configuration>
179-
<username>root</username>
180-
<password>${db.root.password}</password>
181-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
182-
<sqlCommand>drop database if exists `cloud_usage`</sqlCommand>
183-
</configuration>
184-
</execution>
185-
<execution>
186-
<id>create-database-usage</id>
187-
<phase>process-test-resources</phase>
188-
<goals>
189-
<goal>execute</goal>
190-
</goals>
191-
<configuration>
192-
<username>root</username>
193-
<password>${db.root.password}</password>
194-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
195-
<sqlCommand>create database `cloud_usage`</sqlCommand>
196-
</configuration>
197-
</execution>
198-
<execution>
199-
<id>grant-user-cloud-usage</id>
200-
<phase>process-test-resources</phase>
201-
<goals>
202-
<goal>execute</goal>
203-
</goals>
204-
<configuration>
205-
<username>root</username>
206-
<password>${db.root.password}</password>
207-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
208-
<sqlCommand>GRANT ALL ON cloud_usage.* to
209-
${db.cloud.username}@`localhost` identified by
210-
'${db.cloud.password}';</sqlCommand>
211-
</configuration>
212-
</execution>
213-
<execution>
214-
<id>grant-user-cloud-usage-all</id>
215-
<phase>process-test-resources</phase>
216-
<goals>
217-
<goal>execute</goal>
218-
</goals>
219-
<configuration>
220-
<username>root</username>
221-
<password>${db.root.password}</password>
222-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
223-
<sqlCommand>GRANT ALL ON cloud_usage.* to
224-
${db.cloud.username}@`%` identified by
225-
'${db.cloud.password}';</sqlCommand>
226-
</configuration>
227-
</execution>
228-
<execution>
229-
<id>drop-database-cloudbridge</id>
230-
<phase>process-test-resources</phase>
231-
<goals>
232-
<goal>execute</goal>
233-
</goals>
234-
<configuration>
235-
<username>root</username>
236-
<password>${db.root.password}</password>
237-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
238-
<sqlCommand>drop database if exists `cloudbridge`</sqlCommand>
239-
</configuration>
240-
</execution>
241-
<execution>
242-
<id>create-database-cloudbridge</id>
243-
<phase>process-test-resources</phase>
244-
<goals>
245-
<goal>execute</goal>
246-
</goals>
247-
<configuration>
248-
<username>root</username>
249-
<password>${db.root.password}</password>
250-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
251-
<sqlCommand>create database `cloudbridge`</sqlCommand>
252-
</configuration>
253-
</execution>
254-
<execution>
255-
<id>grant-user-cloudbridge</id>
256-
<phase>process-test-resources</phase>
257-
<goals>
258-
<goal>execute</goal>
259-
</goals>
260-
<configuration>
261-
<username>root</username>
262-
<password>${db.root.password}</password>
263-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
264-
<sqlCommand>GRANT ALL ON cloudbridge.* to
265-
${db.cloud.username}@`localhost` identified by
266-
'${db.cloud.password}';</sqlCommand>
267-
</configuration>
268-
</execution>
269-
<execution>
270-
<id>grant-user-cloudbridge-all</id>
271-
<phase>process-test-resources</phase>
272-
<goals>
273-
<goal>execute</goal>
274-
</goals>
275-
<configuration>
276-
<username>root</username>
277-
<password>${db.root.password}</password>
278-
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
279-
<sqlCommand>GRANT ALL ON cloudbridge.* to
280-
${db.cloud.username}@`%` identified by
281-
'${db.cloud.password}';</sqlCommand>
282-
</configuration>
283-
</execution>
284-
</executions>
285-
</plugin>
286-
28793
<!-- DatabaseCreator driver here -->
28894
<plugin>
28995
<groupId>org.codehaus.mojo</groupId>
@@ -365,6 +171,11 @@
365171
<argument>${basedir}/developer-prefill.sql</argument>
366172
<!-- Do database upgrade-->
367173
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
174+
<argument>--database=cloud,usage,awsapi</argument>
175+
<argument>--rootpassword=${db.root.password}</argument>
176+
<!-- Print help using -h or dash-dash-help -->
177+
<!-- Do dry run using -d or dash-dash-dry -->
178+
<!-- Enable verbosity by -v or dash-dash-verbose -->
368179
</arguments>
369180
</configuration>
370181
</plugin>
@@ -402,96 +213,75 @@
402213
</execution>
403214
</executions>
404215
</plugin>
216+
<!-- DatabaseCreator driver here -->
405217
<plugin>
406218
<groupId>org.codehaus.mojo</groupId>
407-
<artifactId>sql-maven-plugin</artifactId>
408-
<version>1.5</version>
219+
<artifactId>exec-maven-plugin</artifactId>
220+
<version>1.2.1</version>
409221
<dependencies>
222+
<!-- specify the dependent jdbc driver here -->
410223
<dependency>
411224
<groupId>mysql</groupId>
412225
<artifactId>mysql-connector-java</artifactId>
413226
<version>${cs.mysql.version}</version>
414227
</dependency>
228+
<dependency>
229+
<groupId>commons-dbcp</groupId>
230+
<artifactId>commons-dbcp</artifactId>
231+
<version>${cs.dbcp.version}</version>
232+
</dependency>
233+
<dependency>
234+
<groupId>commons-pool</groupId>
235+
<artifactId>commons-pool</artifactId>
236+
<version>${cs.pool.version}</version>
237+
</dependency>
238+
<dependency>
239+
<groupId>org.jasypt</groupId>
240+
<artifactId>jasypt</artifactId>
241+
<version>${cs.jasypt.version}</version>
242+
</dependency>
243+
<dependency>
244+
<groupId>org.apache.cloudstack</groupId>
245+
<artifactId>cloud-utils</artifactId>
246+
<version>${project.version}</version>
247+
</dependency>
248+
<dependency>
249+
<groupId>org.apache.cloudstack</groupId>
250+
<artifactId>cloud-server</artifactId>
251+
<version>${project.version}</version>
252+
</dependency>
415253
</dependencies>
416-
<configuration>
417-
<driver>org.gjt.mm.mysql.Driver</driver>
418-
<url>jdbc:mysql://${db.simulator.host}:3306/simulator</url>
419-
<username>${db.simulator.username}</username>
420-
<password>${db.simulator.password}</password>
421-
<skip>${maven.test.skip}</skip>
422-
<forceMojoExecution>true</forceMojoExecution>
423-
</configuration>
424254
<executions>
425255
<execution>
426-
<id>drop-database</id>
427-
<phase>process-test-resources</phase>
428-
<goals>
429-
<goal>execute</goal>
430-
</goals>
431-
<configuration>
432-
<username>root</username>
433-
<password>${db.root.password}</password>
434-
<url>jdbc:mysql://${db.simulator.host}:3306</url>
435-
<sqlCommand>drop database if exists `simulator`</sqlCommand>
436-
</configuration>
437-
</execution>
438-
<execution>
439-
<id>create-database</id>
440-
<phase>process-test-resources</phase>
441-
<goals>
442-
<goal>execute</goal>
443-
</goals>
444-
<configuration>
445-
<username>root</username>
446-
<password>${db.root.password}</password>
447-
<url>jdbc:mysql://${db.simulator.host}:3306</url>
448-
<sqlCommand>create database `simulator`</sqlCommand>
449-
</configuration>
450-
</execution>
451-
<execution>
452-
<id>grant-user-cloud</id>
453256
<phase>process-test-resources</phase>
454-
<goals>
455-
<goal>execute</goal>
456-
</goals>
457-
<configuration>
458-
<username>root</username>
459-
<password>${db.root.password}</password>
460-
<url>jdbc:mysql://${db.simulator.host}:3306</url>
461-
<sqlCommand>GRANT ALL ON simulator.* to
462-
${db.simulator.username}@`localhost` identified by
463-
'${db.simulator.password}';</sqlCommand>
464-
</configuration>
465-
</execution>
466-
<execution>
467-
<id>grant-user-cloud-all</id>
468-
<phase>process-test-resources</phase>
469-
<goals>
470-
<goal>execute</goal>
471-
</goals>
472-
<configuration>
473-
<username>root</username>
474-
<password>${db.root.password}</password>
475-
<url>jdbc:mysql://${db.simulator.host}:3306</url>
476-
<sqlCommand>GRANT ALL ON simulator.* to
477-
${db.simulator.username}@`%` identified by
478-
'${db.simulator.password}';</sqlCommand>
479-
</configuration>
480-
</execution>
481-
<execution>
482257
<id>create-schema</id>
483-
<phase>process-test-resources</phase>
484258
<goals>
485-
<goal>execute</goal>
259+
<goal>java</goal>
486260
</goals>
487-
<configuration>
488-
<srcFiles>
489-
<srcFile>${basedir}/target/db/create-schema-simulator.sql</srcFile>
490-
<srcFile>${basedir}/target/db/templates.simulator.sql</srcFile>
491-
</srcFiles>
492-
</configuration>
493261
</execution>
494262
</executions>
263+
<configuration>
264+
<includeProjectDependencies>false</includeProjectDependencies>
265+
<includePluginDependencies>true</includePluginDependencies>
266+
<executableDependency>
267+
<groupId>org.apache.cloudstack</groupId>
268+
<artifactId>cloud-server</artifactId>
269+
</executableDependency>
270+
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
271+
<arguments>
272+
<!-- db properties file -->
273+
<argument>${project.parent.basedir}/utils/conf/db.properties</argument>
274+
<argument>${project.parent.basedir}/utils/conf/db.properties.override</argument>
275+
<!-- simulator sql files -->
276+
<argument>${basedir}/target/db/create-schema-simulator.sql</argument>
277+
<argument>${basedir}/target/db/templates.simulator.sql</argument>
278+
<!-- database upgrade-->
279+
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
280+
<argument>--database=simulator</argument>
281+
<argument>--rootpassword=${db.root.password}</argument>
282+
<!-- enable verbosity by -v or dash-dash-verbose -->
283+
</arguments>
284+
</configuration>
495285
</plugin>
496286
</plugins>
497287
</build>

0 commit comments

Comments
 (0)