diff --git a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java new file mode 100644 index 0000000000..e6b0094f49 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java @@ -0,0 +1,370 @@ +/******************************************************************************* + * Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs + * + * 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 org.opennebula.client.secgroup; + + +import org.opennebula.client.Client; +import org.opennebula.client.OneResponse; +import org.opennebula.client.PoolElement; +import org.w3c.dom.Node; + +/** + * This class represents an OpenNebula security group. + * It also offers static XML-RPC call wrappers. + */ +public class SecurityGroup extends PoolElement{ + + private static final String METHOD_PREFIX = "secgroup."; + private static final String ALLOCATE = METHOD_PREFIX + "allocate"; + private static final String INFO = METHOD_PREFIX + "info"; + private static final String UPDATE = METHOD_PREFIX + "update"; + private static final String DELETE = METHOD_PREFIX + "delete"; + private static final String CHOWN = METHOD_PREFIX + "chown"; + private static final String CHMOD = METHOD_PREFIX + "chmod"; + private static final String CLONE = METHOD_PREFIX + "clone"; + private static final String RENAME = METHOD_PREFIX + "rename"; + + /** + * Creates a new security group representation. + * + * @param id The security group id. + * @param client XML-RPC Client. + */ + public SecurityGroup(int id, Client client) + { + super(id, client); + } + + /** + * @see PoolElement + */ + protected SecurityGroup(Node xmlElement, Client client) + { + super(xmlElement, client); + } + + // ================================= + // Static XML-RPC methods + // ================================= + + /** + * Allocates a new security group in OpenNebula. + * + * @param client XML-RPC Client. + * @param description A string containing the template + * of the security group. + * + * @return If successful the message contains the associated + * id generated for this security group. + */ + public static OneResponse allocate( + Client client, + String description) + { + return client.call(ALLOCATE, description); + } + + /** + * Retrieves the information of the given security group + * + * @param client XML-RPC Client. + * @param id the id for the security group to + * retrieve the information from. + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse info(Client client, int id) + { + return client.call(INFO, id); + } + + /** + * Deletes a security group from OpenNebula. + * + * @param client XML-RPC Client. + * @param id The id of the target security group. + * @return A encapsulated response. + */ + public static OneResponse delete(Client client, int id) + { + return client.call(DELETE, id); + } + + /** + * Changes the owner/group + * + * @param client XML-RPC Client. + * @param id The id of the target security group. + * @param uid The new owner user ID. Set it to -1 to leave the current one. + * @param gid The new group ID. Set it to -1 to leave the current one. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse chown(Client client, int id, int uid, int gid) + { + return client.call(CHOWN, id, uid, gid); + } + + /** + * Changes the security group permissions + * + * @param client XML-RPC Client. + * @param id The id of the target security group. + * @param owner_u 1 to allow, 0 deny, -1 do not change + * @param owner_m 1 to allow, 0 deny, -1 do not change + * @param owner_a 1 to allow, 0 deny, -1 do not change + * @param group_u 1 to allow, 0 deny, -1 do not change + * @param group_m 1 to allow, 0 deny, -1 do not change + * @param group_a 1 to allow, 0 deny, -1 do not change + * @param other_u 1 to allow, 0 deny, -1 do not change + * @param other_m 1 to allow, 0 deny, -1 do not change + * @param other_a 1 to allow, 0 deny, -1 do not change + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse chmod(Client client, int id, + int owner_u, int owner_m, int owner_a, + int group_u, int group_m, int group_a, + int other_u, int other_m, int other_a) + { + return chmod(client, CHMOD, id, + owner_u, owner_m, owner_a, + group_u, group_m, group_a, + other_u, other_m, other_a); + } + + /** + * Changes the permissions + * + * @param client XML-RPC Client. + * @param id The id of the target object. + * @param octet Permissions octed , e.g. 640 + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse chmod(Client client, int id, String octet) + { + return chmod(client, CHMOD, id, octet); + } + + /** + * Changes the permissions + * + * @param client XML-RPC Client. + * @param id The id of the target object. + * @param octet Permissions octed , e.g. 640 + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse chmod(Client client, int id, int octet) + { + return chmod(client, CHMOD, id, octet); + } + + /** + * Replaces the security group template contents. + * + * @param client XML-RPC Client. + * @param id The id of the target security group we want to modify. + * @param new_template New template contents. + * @param append True to append new attributes instead of replace the whole template + * @return If successful the message contains the security group id. + */ + public static OneResponse update(Client client, int id, String new_template, + boolean append) + { + return client.call(UPDATE, id, new_template, append ? 1 : 0); + } + + /** + * Clones this security group into a new one + * + * @param client XML-RPC Client. + * @param id The id of the target security group. + * @param name Name for the new template. + * @return If successful the message contains the new security group ID. + */ + public static OneResponse clone(Client client, int id, String name) + { + return client.call(CLONE, id, name); + } + + /** + * Renames this security group + * + * @param client XML-RPC Client. + * @param id The id of the target security group. + * @param name New name for the security group. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse rename(Client client, int id, String name) + { + return client.call(RENAME, id, name); + } + + // ================================= + // Instanced object XML-RPC methods + // ================================= + + /** + * Loads the xml representation of the security group. + * The info is also stored internally. + * + * @see SecurityGroup#info(Client, int) + */ + public OneResponse info() + { + OneResponse response = info(client, id); + super.processInfo(response); + return response; + } + + /** + * Deletes the security group from OpenNebula. + * + * @return A encapsulated response. + */ + public OneResponse delete() + { + return delete(client, id); + } + + /** + * Changes the owner/group + * + * @param uid The new owner user ID. Set it to -1 to leave the current one. + * @param gid The new group ID. Set it to -1 to leave the current one. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chown(int uid, int gid) + { + return chown(client, id, uid, gid); + } + + /** + * Changes the owner + * + * @param uid The new owner user ID. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chown(int uid) + { + return chown(uid, -1); + } + + /** + * Changes the group + * + * @param gid The new group ID. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chgrp(int gid) + { + return chown(-1, gid); + } + + /** + * Changes the security group permissions + * + * @param owner_u 1 to allow, 0 deny, -1 do not change + * @param owner_m 1 to allow, 0 deny, -1 do not change + * @param owner_a 1 to allow, 0 deny, -1 do not change + * @param group_u 1 to allow, 0 deny, -1 do not change + * @param group_m 1 to allow, 0 deny, -1 do not change + * @param group_a 1 to allow, 0 deny, -1 do not change + * @param other_u 1 to allow, 0 deny, -1 do not change + * @param other_m 1 to allow, 0 deny, -1 do not change + * @param other_a 1 to allow, 0 deny, -1 do not change + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chmod(int owner_u, int owner_m, int owner_a, + int group_u, int group_m, int group_a, + int other_u, int other_m, int other_a) + { + return chmod(client, id, + owner_u, owner_m, owner_a, + group_u, group_m, group_a, + other_u, other_m, other_a); + } + + /** + * Changes the permissions + * + * @param octet Permissions octed , e.g. 640 + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chmod(String octet) + { + return chmod(client, id, octet); + } + + /** + * Changes the permissions + * + * @param octet Permissions octed , e.g. 640 + * @return If an error occurs the error message contains the reason. + */ + public OneResponse chmod(int octet) + { + return chmod(client, id, octet); + } + + /** + * Replaces the security group template contents. + * + * @param new_template New template contents. + * @return If successful the message contains the security group id. + */ + public OneResponse update(String new_template) + { + return update(new_template, false); + } + + /** + * Replaces the security group template contents. + * + * @param new_template New template contents. + * @param append True to append new attributes instead of replace the whole template + * @return If successful the message contains the security group id. + */ + public OneResponse update(String new_template, boolean append) + { + return update(client, id, new_template, append); + } + + /** + * Clones this security group into a new one + * + * @param name Name for the new security group. + * @return If successful the message contains the new security group ID. + */ + public OneResponse clone(String name) + { + return clone(client, id, name); + } + + /** + * Renames this security group + * + * @param name New name for the security group. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse rename(String name) + { + return rename(client, id, name); + } + + // ================================= + // Helpers + // ================================= + +} diff --git a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java new file mode 100644 index 0000000000..1769a07db3 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java @@ -0,0 +1,261 @@ +/******************************************************************************* + * Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs + * + * 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 org.opennebula.client.secgroup; + +import java.util.AbstractList; +import java.util.Iterator; + + +import org.opennebula.client.Client; +import org.opennebula.client.OneResponse; +import org.opennebula.client.Pool; +import org.opennebula.client.PoolElement; +import org.w3c.dom.Node; + +/** + * This class represents an OpenNebula Security Group pool. + * It also offers static XML-RPC call wrappers. + */ +public class SecurityGroupPool extends Pool implements Iterable{ + + private static final String ELEMENT_NAME = "SECURITY_GROUP"; + private static final String INFO_METHOD = "secgrouppool.info"; + + private int filter; + + /** + * Creates a new Security Group pool with the default filter flag value + * set to {@link Pool#MINE_GROUP} (Security Groups belonging to the connected user, + * and the ones in his group) + * + * @param client XML-RPC Client. + * + * @see SecurityGroupPool#SecurityGroupPool(Client, int) + */ + public SecurityGroupPool(Client client) + { + super(ELEMENT_NAME, client, INFO_METHOD); + this.filter = MINE_GROUP; + } + + /** + * Creates a new Security Group pool. + * + * @param client XML-RPC Client. + * @param filter Filter flag to use by default in the method + * {@link SecurityGroupPool#info()}. Possible values: + * + */ + public SecurityGroupPool(Client client, int filter) + { + super(ELEMENT_NAME, client, INFO_METHOD); + this.filter = filter; + } + + @Override + public PoolElement factory(Node node) + { + return new SecurityGroup(node, client); + } + + /** + * Retrieves all or part of the Security Groups in the pool. + * + * @param client XML-RPC Client. + * @param filter Filter flag to use. Possible values: + * + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse info(Client client, int filter) + { + return Pool.info(client, INFO_METHOD, filter, -1, -1); + } + + /** + * Retrieves all the Security Groups in the pool. + * + * @param client XML-RPC Client. + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse infoAll(Client client) + { + return Pool.infoAll(client, INFO_METHOD); + } + + /** + * Retrieves all the connected user's Security Groups. + * + * @param client XML-RPC Client. + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse infoMine(Client client) + { + return Pool.infoMine(client, INFO_METHOD); + } + + /** + * Retrieves all the connected user's Security Groups and the ones in + * his group. + * + * @param client XML-RPC Client. + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse infoGroup(Client client) + { + return Pool.infoGroup(client, INFO_METHOD); + } + + /** + * Retrieves all or part of the Security Groups in the pool. The Security Groups to retrieve + * can be also filtered by Id, specifying the first and last Id to include. + * + * @param client XML-RPC Client. + * @param filter Filter flag to use. Possible values: + * + * @param startId Lowest Id to retrieve + * @param endId Biggest Id to retrieve + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public static OneResponse info(Client client, int filter, + int startId, int endId) + { + return Pool.info(client, INFO_METHOD, filter, startId, endId); + } + + /** + * Loads the xml representation of all or part of the + * Security Groups in the pool. The filter used is the one set in + * the constructor. + * + * @see SecurityGroupPool#info(Client, int) + * + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public OneResponse info() + { + return super.info(filter, -1, -1); + } + + /** + * Loads the xml representation of all the Security Groups in the pool. + * + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public OneResponse infoAll() + { + return super.infoAll(); + } + + /** + * Loads the xml representation of all the connected user's Security Groups. + * + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public OneResponse infoMine() + { + return super.infoMine(); + } + + /** + * Loads the xml representation of all the connected user's Security Groups and + * the ones in his group. + * + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public OneResponse infoGroup() + { + return super.infoGroup(); + } + + /** + * Retrieves all or part of the Security Groups in the pool. The Security Groups to retrieve + * can be also filtered by Id, specifying the first and last Id to include. + * + * @param filter Filter flag to use. Possible values: + * + * @param startId Lowest Id to retrieve + * @param endId Biggest Id to retrieve + * @return If successful the message contains the string + * with the information returned by OpenNebula. + */ + public OneResponse info(int filter, int startId, int endId) + { + return super.info(filter, startId, endId); + } + + public Iterator iterator() + { + AbstractList ab = new AbstractList() + { + public int size() + { + return getLength(); + } + + public SecurityGroup get(int index) + { + return (SecurityGroup) item(index); + } + }; + + return ab.iterator(); + } + + /** + * Returns the Security Group with the given Id from the pool. If it is not found, + * then returns null. The method {@link #info()} must be called before. + * + * @param id of the Security Group to retrieve + * @return The Image with the given Id, or null if it was not found. + */ + public SecurityGroup getById(int id) + { + return (SecurityGroup) super.getById(id); + } +} diff --git a/src/oca/java/test/SecurityGroupTest.java b/src/oca/java/test/SecurityGroupTest.java new file mode 100644 index 0000000000..1e7143c284 --- /dev/null +++ b/src/oca/java/test/SecurityGroupTest.java @@ -0,0 +1,266 @@ +/******************************************************************************* + * Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs + * + * 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. + ******************************************************************************/ +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.opennebula.client.Client; +import org.opennebula.client.OneResponse; +import org.opennebula.client.group.Group; +import org.opennebula.client.secgroup.*; +import org.opennebula.client.user.User; + + + + +public class SecurityGroupTest +{ + + private static SecurityGroup sg; + private static SecurityGroupPool pool; + + private static Client client; + + private static OneResponse res; + private static String name = "new_test_sg"; + + + private static String template_str = + "NAME = \"" + name + "\"\n" + + "DESCRIPTION = \"test security group\"\n"+ + "ATT1 = \"VAL1\"\n" + + "ATT2 = \"VAL2\""; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception + { + client = new Client(); + pool = new SecurityGroupPool(client); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception + { + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception + { + res = SecurityGroup.allocate(client, template_str); + + int oid = res.isError() ? -1 : Integer.parseInt(res.getMessage()); + sg = new SecurityGroup(oid, client); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception + { + sg.delete(); + } + + @Test + public void allocate() + { + sg.delete(); + + res = SecurityGroup.allocate(client, template_str); + assertTrue( res.getErrorMessage(), !res.isError() ); + + int oid = res.isError() ? -1 : Integer.parseInt(res.getMessage()); + sg = new SecurityGroup(oid, client); + + + pool.info(); + + boolean found = false; + for(SecurityGroup temp : pool) + { + found = found || temp.getName().equals(name); + } + + assertTrue( found ); + } + + @Test + public void info() + { + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.getName().equals(name) ); + } + + @Test + public void update() + { + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.xpath("TEMPLATE/ATT1").equals( "VAL1" ) ); + assertTrue( sg.xpath("TEMPLATE/ATT2").equals( "VAL2" ) ); + + String new_sg = "ATT2 = NEW_VAL\n" + + "ATT3 = VAL3"; + + res = sg.update(new_sg); + assertTrue( res.getErrorMessage(), !res.isError() ); + + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + assertTrue( sg.xpath("TEMPLATE/ATT1").equals( "" ) ); + assertTrue( sg.xpath("TEMPLATE/ATT2").equals( "NEW_VAL" ) ); + assertTrue( sg.xpath("TEMPLATE/ATT3").equals( "VAL3" ) ); + } + + @Test + public void chmod() + { + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + String owner_a = sg.xpath("PERMISSIONS/OWNER_A"); + String group_a = sg.xpath("PERMISSIONS/GROUP_A"); + + res = sg.chmod(0, 1, -1, 1, 0, -1, 1, 1, 0); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.xpath("PERMISSIONS/OWNER_U").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_M").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_A").equals(owner_a) ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_M").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_A").equals(group_a) ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_M").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_A").equals("0") ); + } + + @Test + public void chmod_octet() + { + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.chmod(640); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.xpath("PERMISSIONS/OWNER_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_M").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_A").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_M").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_A").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_U").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_M").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_A").equals("0") ); + + res = sg.chmod("147"); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.xpath("PERMISSIONS/OWNER_U").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_M").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OWNER_A").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_M").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/GROUP_A").equals("0") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_U").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_M").equals("1") ); + assertTrue( sg.xpath("PERMISSIONS/OTHER_A").equals("1") ); + } + + @Test + public void attributes() + { + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + +// assertTrue( sg.xpath("ID").equals("0") ); + assertTrue( sg.xpath("NAME").equals(name) ); + } + + @Test + public void delete() + { + res = sg.delete(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.info(); + assertTrue( res.isError() ); + } + + @Test + public void chown() + { + // Create a new User and Group + res = User.allocate(client, "sg_test_user", "password"); + assertTrue( res.getErrorMessage(), !res.isError() ); + + int uid = Integer.parseInt(res.getMessage()); + + res = Group.allocate(client, "sg_test_group"); + assertTrue( res.getErrorMessage(), !res.isError() ); + + int gid = Integer.parseInt(res.getMessage()); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.uid() == 0 ); + assertTrue( sg.gid() == 0 ); + + res = sg.chown(uid, gid); + assertTrue( res.getErrorMessage(), !res.isError() ); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.uid() == uid ); + assertTrue( sg.gid() == gid ); + + res = sg.chgrp(0); + + res = sg.info(); + assertTrue( res.getErrorMessage(), !res.isError() ); + + assertTrue( sg.uid() == uid ); + assertTrue( sg.gid() == 0 ); + } +} diff --git a/src/oca/java/test/all_tests.sh b/src/oca/java/test/all_tests.sh index e0a5d79529..8d967214ab 100755 --- a/src/oca/java/test/all_tests.sh +++ b/src/oca/java/test/all_tests.sh @@ -70,4 +70,7 @@ let RC=RC+$? ./test.sh VdcTest let RC=RC+$? +./test.sh SecurityGroupTest +let RC=RC+$? + exit $RC \ No newline at end of file diff --git a/src/oca/java/test/test.sh b/src/oca/java/test/test.sh index ee72582cdc..0918a6c5ca 100755 --- a/src/oca/java/test/test.sh +++ b/src/oca/java/test/test.sh @@ -24,9 +24,11 @@ JUNIT_JAR="/usr/share/java/junit4.jar" if [ -z $ONE_LOCATION ]; then DB_LOCATION="/var/lib/one/one.db" LOG_LOCATION="/var/log/one" + AUTH_LOCATION="/var/lib/one/.one" else DB_LOCATION="$ONE_LOCATION/var/one.db" LOG_LOCATION="$ONE_LOCATION/var" + AUTH_LOCATION="$ONE_LOCATION/var/.one" fi if [ -f $DB_LOCATION ]; then @@ -38,6 +40,8 @@ echo "=========================================================================" echo "Doing $1" echo "=========================================================================" +rm -rf $AUTH_LOCATION + PID=$$ oned -f &