Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
40e49a3bbb | |||
a17ca91389 | |||
b17515229a | |||
0303fee50b | |||
d40ee6acb4 | |||
eaacc3a3d6 | |||
4f1a466007 | |||
ca91a15396 | |||
e534a541d1 | |||
ecba48a615 | |||
71c9bb563a |
7 changed files with 1794 additions and 1123 deletions
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||||
*
|
*
|
||||||
* This file is part of SikevaDB, simple key value database.
|
* This file is part of SikevaDB, simple key value database.
|
||||||
*
|
*
|
||||||
|
@ -21,73 +21,349 @@ package fr.devinsy.sikevadb.core;
|
||||||
import fr.devinsy.util.strings.StringList;
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* The Interface SikevaDB.
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
public interface SikevaDB
|
public interface SikevaDB
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Delete all elements of current opened database.
|
||||||
|
*
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public void clear() throws SikevaDBException;
|
public void clear() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the current database session.
|
||||||
|
*
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public void close() throws SikevaDBException;
|
public void close() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of elements in current database.
|
||||||
|
*
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long countOfElements() throws SikevaDBException;
|
public long countOfElements() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of elements by key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long countOfElements(String key) throws SikevaDBException;
|
public long countOfElements(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of elements by key and subkey.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the subkey
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long countOfElements(String key, String subkey) throws SikevaDBException;
|
public long countOfElements(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the database.
|
||||||
|
*
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public void create() throws SikevaDBException;
|
public void create() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
void delete(final String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the subkey
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
void delete(final String key, final String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete many.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkeys
|
||||||
|
* the subkeys
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
void deleteMany(final String key, final String... subkeys) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an element by key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the element
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public Element getElement(String key) throws SikevaDBException;
|
public Element getElement(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an element by key and sub key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the sub key
|
||||||
|
* @return the element
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public Element getElement(String key, String subkey) throws SikevaDBException;
|
public Element getElement(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all elements in current database.
|
||||||
|
*
|
||||||
|
* @return the elements
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public Elements getElements() throws SikevaDBException;
|
public Elements getElements() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all elements of a top key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the elements
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public Elements getElements(String key) throws SikevaDBException;
|
public Elements getElements(String key) throws SikevaDBException;
|
||||||
|
|
||||||
public fr.devinsy.util.strings.StringList getKeys() throws SikevaDBException;
|
/**
|
||||||
|
* Gets all the top keys.
|
||||||
|
*
|
||||||
|
* @return the keys
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
public StringList getKeys() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the sub keys of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the subkeys
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public StringList getSubkeys(String key) throws SikevaDBException;
|
public StringList getSubkeys(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the value
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public String getValue(String key) throws SikevaDBException;
|
public String getValue(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of a key and a sub key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the sub key
|
||||||
|
* @return the value
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public String getValue(String key, String subkey) throws SikevaDBException;
|
public String getValue(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the values of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the values
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public StringList getValues(String key) throws SikevaDBException;
|
public StringList getValues(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is closed.
|
||||||
|
*
|
||||||
|
* @return true, if is closed
|
||||||
|
*/
|
||||||
public boolean isClosed();
|
public boolean isClosed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is created.
|
||||||
|
*
|
||||||
|
* @return true, if is created
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public boolean isCreated() throws SikevaDBException;
|
public boolean isCreated() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is opened.
|
||||||
|
*
|
||||||
|
* @return true, if is opened
|
||||||
|
*/
|
||||||
public boolean isOpened();
|
public boolean isOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the memory size of the elements in database.
|
||||||
|
*
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long memorySize() throws SikevaDBException;
|
public long memorySize() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the memory size of elements of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long memorySize(String key) throws SikevaDBException;
|
public long memorySize(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the memory size of element of a key and a sub key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the sub key
|
||||||
|
* @return the long
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
public long memorySize(String key, String subkey) throws SikevaDBException;
|
public long memorySize(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a database.
|
||||||
|
*
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void open() throws SikevaDBException;
|
void open() throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put an element in database.
|
||||||
|
*
|
||||||
|
* @param element
|
||||||
|
* the element
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void put(Element element) throws SikevaDBException;
|
void put(Element element) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put a value for a key in current opened database.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param value
|
||||||
|
* the value
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void put(String key, String value) throws SikevaDBException;
|
void put(String key, String value) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put a value for a key and a sub key in current opened database.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param subkey
|
||||||
|
* the subkey
|
||||||
|
* @param value
|
||||||
|
* the value
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void put(String key, String subkey, String value) throws SikevaDBException;
|
void put(String key, String subkey, String value) throws SikevaDBException;
|
||||||
|
|
||||||
void remove(final String key) throws SikevaDBException;
|
/**
|
||||||
|
* Rename a key.
|
||||||
void remove(final String key, final String subkey) throws SikevaDBException;
|
*
|
||||||
|
* @param oldKey
|
||||||
void removeMany(final String key, final String... subkeys) throws SikevaDBException;
|
* the old key
|
||||||
|
* @param newKey
|
||||||
|
* the new key
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void renameKey(final String oldKey, final String newKey) throws SikevaDBException;
|
void renameKey(final String oldKey, final String newKey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename a sub key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param oldSubKey
|
||||||
|
* the old sub key
|
||||||
|
* @param newSubKey
|
||||||
|
* the new sub key
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void renameSubKey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException;
|
void renameSubKey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace a substring in a value of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param tokens
|
||||||
|
* the tokens
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void replaceInValue(final String key, final String... tokens) throws SikevaDBException;
|
void replaceInValue(final String key, final String... tokens) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace a substring in values of all sub keys of a key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
* @param tokens
|
||||||
|
* the tokens
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
void replaceInValues(final String key, final String... tokens) throws SikevaDBException;
|
void replaceInValues(final String key, final String... tokens) throws SikevaDBException;
|
||||||
}
|
}
|
||||||
|
|
64
src/fr/devinsy/sikevadb/core/UnopenedDatabaseException.java
Normal file
64
src/fr/devinsy/sikevadb/core/UnopenedDatabaseException.java
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||||
|
*
|
||||||
|
* This file is part of SikevaDB, simple key value database.
|
||||||
|
*
|
||||||
|
* SikevaDB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* SikevaDB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package fr.devinsy.sikevadb.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||||
|
*/
|
||||||
|
public class UnopenedDatabaseException extends SikevaDBException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 8364599416669077052L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public UnopenedDatabaseException()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public UnopenedDatabaseException(final String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
public UnopenedDatabaseException(final String message, final Throwable cause)
|
||||||
|
{
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
public UnopenedDatabaseException(final Throwable cause)
|
||||||
|
{
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||||
*
|
*
|
||||||
* This file is part of SikevaDB, simple key value database.
|
* This file is part of SikevaDB, simple key value database.
|
||||||
*
|
*
|
||||||
|
@ -75,11 +75,11 @@ public class XMLSikevaDB
|
||||||
{
|
{
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
throw new NullPointerException("out is null.");
|
throw new IllegalArgumentException("out is null.");
|
||||||
}
|
}
|
||||||
else if (source == null)
|
else if (source == null)
|
||||||
{
|
{
|
||||||
throw new NullPointerException("source is null.");
|
throw new IllegalArgumentException("source is null.");
|
||||||
}
|
}
|
||||||
else if (fileName == null)
|
else if (fileName == null)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,6 @@ public class XMLSikevaDB
|
||||||
{
|
{
|
||||||
while (in.hasNextStartTag("element"))
|
while (in.hasNextStartTag("element"))
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
Element element = readElement(in);
|
Element element = readElement(in);
|
||||||
|
|
||||||
|
@ -225,11 +224,11 @@ public class XMLSikevaDB
|
||||||
|
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
throw new NullPointerException("out is null.");
|
throw new IllegalArgumentException("out is null.");
|
||||||
}
|
}
|
||||||
else if (source == null)
|
else if (source == null)
|
||||||
{
|
{
|
||||||
throw new NullPointerException("element is null.");
|
throw new IllegalArgumentException("element is null.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -278,7 +277,7 @@ public class XMLSikevaDB
|
||||||
{
|
{
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
throw new NullPointerException("out is null.");
|
throw new IllegalArgumentException("out is null.");
|
||||||
}
|
}
|
||||||
else if (source == null)
|
else if (source == null)
|
||||||
{
|
{
|
||||||
|
@ -290,19 +289,16 @@ public class XMLSikevaDB
|
||||||
|
|
||||||
for (String key : source.getKeys())
|
for (String key : source.getKeys())
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
Element root = source.getElement(key);
|
||||||
|
write(out, root);
|
||||||
|
|
||||||
//
|
//
|
||||||
Elements elements = source.getElements(key);
|
Elements elements = source.getElements(key);
|
||||||
for (Element element : elements)
|
for (Element element : elements)
|
||||||
{
|
{
|
||||||
write(out, element);
|
write(out, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
for (String subkey : source.getSubkeys(key))
|
|
||||||
{
|
|
||||||
Element subElement = source.getElement(key, subkey);
|
|
||||||
write(out, subElement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out.writeEndTag("elements");
|
out.writeEndTag("elements");
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON, DEVINSY
|
* Copyright (C) 2013-2018 Christian Pierre MOMON, DEVINSY
|
||||||
*
|
*
|
||||||
* This file is part of SikevaDB, simple key value database.
|
* This file is part of SikevaDB, simple key value database.
|
||||||
*
|
*
|
||||||
|
@ -34,6 +34,7 @@ import org.junit.Test;
|
||||||
import fr.devinsy.sikevadb.core.Element;
|
import fr.devinsy.sikevadb.core.Element;
|
||||||
import fr.devinsy.sikevadb.core.Elements;
|
import fr.devinsy.sikevadb.core.Elements;
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
import fr.devinsy.sikevadb.core.SikevaDBException;
|
||||||
|
import fr.devinsy.sikevadb.core.UnopenedDatabaseException;
|
||||||
import fr.devinsy.util.strings.StringList;
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +71,7 @@ public class TreeFileSikevaDBTest
|
||||||
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
||||||
|
|
||||||
Assert.assertEquals(0, database.getSubkeys("none").size());
|
Assert.assertEquals(0, database.getSubkeys("none").size());
|
||||||
|
Assert.assertEquals(5, database.getSubkeys("alpha01s").size());
|
||||||
|
|
||||||
//
|
//
|
||||||
logger.debug("===== test done.");
|
logger.debug("===== test done.");
|
||||||
|
@ -101,10 +103,11 @@ public class TreeFileSikevaDBTest
|
||||||
|
|
||||||
StringList keys = database.getKeys();
|
StringList keys = database.getKeys();
|
||||||
|
|
||||||
Assert.assertEquals(5, keys.size());
|
Assert.assertEquals(6, keys.size());
|
||||||
Assert.assertTrue(keys.contains("alpha03"));
|
Assert.assertTrue(keys.contains("alpha03"));
|
||||||
Assert.assertEquals(0, database.getSubkeys("alpha03s").size());
|
Assert.assertEquals(0, database.getSubkeys("alpha03s").size());
|
||||||
Assert.assertEquals(5, database.getSubkeys("alpha01s").size());
|
Assert.assertEquals(5, database.getSubkeys("alpha01s").size());
|
||||||
|
Assert.assertFalse(keys.contains("bravo4"));
|
||||||
|
|
||||||
//
|
//
|
||||||
logger.debug("===== test done.");
|
logger.debug("===== test done.");
|
||||||
|
@ -498,7 +501,7 @@ public class TreeFileSikevaDBTest
|
||||||
|
|
||||||
Assert.assertEquals(12, database.countOfElements());
|
Assert.assertEquals(12, database.countOfElements());
|
||||||
|
|
||||||
database.removeMany("alpha01", "bravo", "delta", "fox");
|
database.deleteMany("alpha01", "bravo", "delta", "fox");
|
||||||
|
|
||||||
Assert.assertEquals(9, database.countOfElements());
|
Assert.assertEquals(9, database.countOfElements());
|
||||||
|
|
||||||
|
@ -557,14 +560,14 @@ public class TreeFileSikevaDBTest
|
||||||
database.put("alpha03", "qlskjfmlqj");
|
database.put("alpha03", "qlskjfmlqj");
|
||||||
database.put("alpha04", "qlskjfmlqj");
|
database.put("alpha04", "qlskjfmlqj");
|
||||||
database.put("alpha05", "qlskjfmlqj");
|
database.put("alpha05", "qlskjfmlqj");
|
||||||
database.remove("alpha03");
|
database.delete("alpha03");
|
||||||
database.put("alpha01s", "bravo1", "qlskjfmlqja");
|
database.put("alpha01s", "bravo1", "qlskjfmlqja");
|
||||||
database.put("alpha01s", "bravo1", "qlskjfmlqjb");
|
database.put("alpha01s", "bravo1", "qlskjfmlqjb");
|
||||||
database.put("alpha01s", "bravo2", "qlskjfmlqj");
|
database.put("alpha01s", "bravo2", "qlskjfmlqj");
|
||||||
database.put("alpha01s", "bravo3", "qlskjfmlqj");
|
database.put("alpha01s", "bravo3", "qlskjfmlqj");
|
||||||
database.put("alpha01s", "bravo4", "qlskjfmlqj");
|
database.put("alpha01s", "bravo4", "qlskjfmlqj");
|
||||||
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
||||||
database.remove("alpha01s", "bravo3");
|
database.delete("alpha01s", "bravo3");
|
||||||
|
|
||||||
// System.out.println(database.countOfElements() + " " +
|
// System.out.println(database.countOfElements() + " " +
|
||||||
// database.countOfArchivedElements() + " " +
|
// database.countOfArchivedElements() + " " +
|
||||||
|
@ -605,10 +608,11 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws UnopenedDatabaseException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass()
|
public static void afterClass() throws UnopenedDatabaseException
|
||||||
{
|
{
|
||||||
if (database != null)
|
if (database != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -566,7 +566,7 @@ public class SQLSikevaDBTest
|
||||||
|
|
||||||
Assert.assertEquals(12, database.countOfElements());
|
Assert.assertEquals(12, database.countOfElements());
|
||||||
|
|
||||||
database.removeMany("alpha01", "bravo", "delta", "fox");
|
database.deleteMany("alpha01", "bravo", "delta", "fox");
|
||||||
|
|
||||||
Assert.assertEquals(9, database.countOfElements());
|
Assert.assertEquals(9, database.countOfElements());
|
||||||
|
|
||||||
|
@ -625,14 +625,14 @@ public class SQLSikevaDBTest
|
||||||
database.put("alpha03", "qlskjfmlqj");
|
database.put("alpha03", "qlskjfmlqj");
|
||||||
database.put("alpha04", "qlskjfmlqj");
|
database.put("alpha04", "qlskjfmlqj");
|
||||||
database.put("alpha05", "qlskjfmlqj");
|
database.put("alpha05", "qlskjfmlqj");
|
||||||
database.remove("alpha03");
|
database.delete("alpha03");
|
||||||
database.put("alpha01", "bravo1", "qlskjfmlqja");
|
database.put("alpha01", "bravo1", "qlskjfmlqja");
|
||||||
database.put("alpha01", "bravo1", "qlskjfmlqjb");
|
database.put("alpha01", "bravo1", "qlskjfmlqjb");
|
||||||
database.put("alpha01", "bravo2", "qlskjfmlqj");
|
database.put("alpha01", "bravo2", "qlskjfmlqj");
|
||||||
database.put("alpha01", "bravo3", "qlskjfmlqj");
|
database.put("alpha01", "bravo3", "qlskjfmlqj");
|
||||||
database.put("alpha01", "bravo4", "qlskjfmlqj");
|
database.put("alpha01", "bravo4", "qlskjfmlqj");
|
||||||
database.put("alpha01", "bravo5", "qlskjfmlqj");
|
database.put("alpha01", "bravo5", "qlskjfmlqj");
|
||||||
database.remove("alpha01", "bravo3");
|
database.delete("alpha01", "bravo3");
|
||||||
|
|
||||||
// System.out.println(database.countOfElements() + " " +
|
// System.out.println(database.countOfElements() + " " +
|
||||||
// database.countOfArchivedElements() + " " +
|
// database.countOfArchivedElements() + " " +
|
||||||
|
|
Loading…
Reference in a new issue